Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
2ec43747
Commit
2ec43747
authored
Nov 22, 2010
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge MWL#121-125 DS-MRR improvements
- Address Monty's review feedback, part 1
parent
c635eb33
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
26 deletions
+28
-26
mysql-test/t/subselect_sj2.test
mysql-test/t/subselect_sj2.test
+0
-1
sql/multi_range_read.cc
sql/multi_range_read.cc
+24
-21
sql/multi_range_read.h
sql/multi_range_read.h
+1
-1
sql/opt_range.cc
sql/opt_range.cc
+1
-1
sql/sql_lifo_buffer.h
sql/sql_lifo_buffer.h
+2
-2
No files found.
mysql-test/t/subselect_sj2.test
View file @
2ec43747
...
...
@@ -586,7 +586,6 @@ if (`select @@join_cache_level=6`)
--
echo
# Not anymore:
--
echo
# The following query gives wrong result due to Bug#49129
}
select
*
from
t0
where
t0
.
a
in
(
select
t1
.
a
from
t1
,
t2
where
t2
.
a
=
t0
.
a
and
t1
.
b
=
t2
.
b
);
...
...
sql/multi_range_read.cc
View file @
2ec43747
...
...
@@ -341,14 +341,14 @@ int Mrr_ordered_index_reader::get_next(char **range_info)
DBUG_RETURN
(
HA_ERR_END_OF_FILE
);
}
while
(
1
)
for
(;;
)
{
bool
have_record
=
FALSE
;
if
(
scanning_key_val_iter
)
{
if
((
res
=
kv_it
.
get_next
()))
{
kv_it
.
close
();
kv_it
.
close
_
();
scanning_key_val_iter
=
FALSE
;
if
((
res
!=
HA_ERR_KEY_NOT_FOUND
&&
res
!=
HA_ERR_END_OF_FILE
))
DBUG_RETURN
(
res
);
...
...
@@ -439,24 +439,22 @@ int Mrr_ordered_index_reader::refill_buffer()
}
/* Put key, or {key, range_id} pair into the buffer */
if
(
keypar
.
use_key_pointers
)
key_ptr
=
(
uchar
*
)
&
cur_range
.
start_key
.
key
;
else
key_ptr
=
(
uchar
*
)
cur_range
.
start_key
.
key
;
key_ptr
=
(
keypar
.
use_key_pointers
)
?
(
uchar
*
)
&
cur_range
.
start_key
.
key
:
(
uchar
*
)
cur_range
.
start_key
.
key
;
key_buffer
->
write
();
}
bool
no_more_keys
=
test
(
res
);
/* Force get_next() to start with kv_it.init() call: */
scanning_key_val_iter
=
FALSE
;
if
(
no_more_keys
&&
(
!
know_key_tuple_params
||
key_buffer
->
is_empty
()))
if
(
test
(
res
)
&&
(
!
know_key_tuple_params
||
key_buffer
->
is_empty
()))
DBUG_RETURN
(
HA_ERR_END_OF_FILE
);
key_buffer
->
sort
((
key_buffer
->
type
()
==
Lifo_buffer
::
FORWARD
)
?
(
qsort2_cmp
)
Mrr_ordered_index_reader
::
key_tuple_cmp_reverse
:
(
qsort2_cmp
)
Mrr_ordered_index_reader
::
key_tuple_cmp
,
(
void
*
)
this
);
this
);
DBUG_RETURN
(
0
);
}
...
...
@@ -558,7 +556,7 @@ int Mrr_ordered_rndpos_reader::refill_buffer()
if
(
index_reader_exhausted
)
DBUG_RETURN
(
HA_ERR_END_OF_FILE
);
while
((
res
=
refill_from_key_buffer
()
==
HA_ERR_END_OF_FILE
)
)
while
((
res
=
refill_from_key_buffer
()
)
==
HA_ERR_END_OF_FILE
)
{
if
((
res
=
index_reader
->
refill_buffer
()))
{
...
...
@@ -603,11 +601,16 @@ int Mrr_ordered_rndpos_reader::refill_from_key_buffer()
res
=
index_reader
->
get_next
(
&
range_info
);
if
(
res
)
{
if
(
res
!=
HA_ERR_END_OF_FILE
)
DBUG_RETURN
(
res
);
index_reader_exhausted
=
TRUE
;
break
;
}
/* Put rowid, or {rowid, range_id} pair into the buffer */
index_reader
->
position
();
/* Put rowid, or {rowid, range_id} pair into the buffer */
rowid_buffer
->
write
();
}
...
...
@@ -658,7 +661,7 @@ int Mrr_ordered_rndpos_reader::get_next(char **range_info)
}
}
while
(
1
)
for
(;;
)
{
last_identical_rowid
=
NULL
;
...
...
@@ -1052,8 +1055,8 @@ void DsMrr_impl::setup_buffer_sizes(uint key_size_in_keybuf,
Ok if we got here we need to allocate one part of the buffer
for keys and another part for rowids.
*/
u
int
rowid_buf_elem_size
=
h
->
ref_length
+
(
int
)
is_mrr_assoc
*
sizeof
(
char
*
);
u
longlong
rowid_buf_elem_size
=
h
->
ref_length
+
(
int
)
is_mrr_assoc
*
sizeof
(
char
*
);
/*
Use rec_per_key statistics as a basis to find out how many rowids
...
...
@@ -1070,8 +1073,8 @@ void DsMrr_impl::setup_buffer_sizes(uint key_size_in_keybuf,
}
double
fraction_for_rowids
=
(
(
double
)
rowid_buf_elem_size
/
((
double
)
rowid_buf_elem_size
+
key_buff_elem_size
));
(
ulonglong2double
(
rowid_buf_elem_size
)
/
(
ulonglong2double
(
rowid_buf_elem_size
)
+
key_buff_elem_size
));
size_t
bytes_for_rowids
=
round
(
fraction_for_rowids
*
(
full_buf_end
-
full_buf
));
...
...
@@ -1080,7 +1083,7 @@ void DsMrr_impl::setup_buffer_sizes(uint key_size_in_keybuf,
if
(
bytes_for_keys
<
key_buff_elem_size
+
1
)
{
u
int
add
=
key_buff_elem_size
+
1
-
bytes_for_keys
;
u
long
add
=
key_buff_elem_size
+
1
-
bytes_for_keys
;
bytes_for_keys
=
key_buff_elem_size
+
1
;
bytes_for_rowids
-=
add
;
DBUG_ASSERT
(
bytes_for_rowids
>=
rowid_buf_elem_size
+
1
);
...
...
@@ -1088,7 +1091,7 @@ void DsMrr_impl::setup_buffer_sizes(uint key_size_in_keybuf,
if
(
bytes_for_rowids
<
rowid_buf_elem_size
+
1
)
{
u
int
add
=
rowid_buf_elem_size
+
1
-
bytes_for_rowids
;
u
long
add
=
rowid_buf_elem_size
+
1
-
bytes_for_rowids
;
bytes_for_rowids
=
rowid_buf_elem_size
+
1
;
bytes_for_keys
-=
add
;
DBUG_ASSERT
(
bytes_for_keys
>=
key_buff_elem_size
+
1
);
...
...
@@ -1185,7 +1188,7 @@ int Key_value_records_iterator::init(Mrr_ordered_index_reader *owner_arg)
if
(
res
)
{
close
();
close
_
();
return
res
;
}
get_next_row
=
FALSE
;
...
...
@@ -1223,7 +1226,7 @@ int Key_value_records_iterator::get_next()
}
void
Key_value_records_iterator
::
close
()
void
Key_value_records_iterator
::
close
_
()
{
while
(
!
owner
->
key_buffer
->
read
()
&&
(
cur_index_tuple
!=
last_identical_key_ptr
))
{}
...
...
sql/multi_range_read.h
View file @
2ec43747
...
...
@@ -137,7 +137,7 @@ class Key_value_records_iterator
public:
int
init
(
Mrr_ordered_index_reader
*
owner_arg
);
int
get_next
();
void
close
();
void
close
_
();
};
...
...
sql/opt_range.cc
View file @
2ec43747
...
...
@@ -8006,7 +8006,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
quick
->
mrr_buf_size
=
thd
->
variables
.
mrr_buff_size
;
if
(
table
->
file
->
multi_range_read_info
(
quick
->
index
,
1
,
(
uint
)
records
,
uint
(
-
1
)
,
~
0
,
&
quick
->
mrr_buf_size
,
&
quick
->
mrr_flags
,
&
cost
))
goto
err
;
...
...
sql/sql_lifo_buffer.h
View file @
2ec43747
...
...
@@ -150,7 +150,7 @@ public:
enum_direction
type
()
{
return
FORWARD
;
}
size_t
used_size
()
{
return
pos
-
start
;
return
(
size_t
)(
pos
-
start
)
;
}
void
reset
()
{
...
...
@@ -243,7 +243,7 @@ public:
size_t
used_size
()
{
return
end
-
pos
;
return
(
size_t
)(
end
-
pos
)
;
}
void
reset
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment