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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
8dc612e6
Commit
8dc612e6
authored
Dec 16, 2010
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MWL#121-125 DS-MRR improvements
- Address Monty's review feedback, portion 3
parent
3e633eea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
30 deletions
+26
-30
sql/multi_range_read.cc
sql/multi_range_read.cc
+10
-12
sql/sql_lifo_buffer.h
sql/sql_lifo_buffer.h
+16
-18
No files found.
sql/multi_range_read.cc
View file @
8dc612e6
...
...
@@ -414,8 +414,6 @@ void Mrr_ordered_index_reader::resume_read()
int
Mrr_ordered_index_reader
::
refill_buffer
(
bool
initial
)
{
KEY_MULTI_RANGE
cur_range
;
uchar
**
range_info_ptr
=
(
uchar
**
)
&
cur_range
.
ptr
;
uchar
*
key_ptr
;
DBUG_ENTER
(
"Mrr_ordered_index_reader::refill_buffer"
);
DBUG_ASSERT
(
key_buffer
->
is_empty
());
...
...
@@ -425,9 +423,8 @@ int Mrr_ordered_index_reader::refill_buffer(bool initial)
buf_manager
->
reset_buffer_sizes
(
buf_manager
->
arg
);
key_buffer
->
reset
();
key_buffer
->
setup_writing
(
&
key_ptr
,
keypar
.
key_size_in_keybuf
,
is_mrr_assoc
?
(
uchar
**
)
&
range_info_ptr
:
NULL
,
is_mrr_assoc
?
sizeof
(
uchar
*
)
:
0
);
key_buffer
->
setup_writing
(
keypar
.
key_size_in_keybuf
,
is_mrr_assoc
?
sizeof
(
char
*
)
:
0
);
while
(
key_buffer
->
can_write
()
&&
!
(
source_exhausted
=
mrr_funcs
.
next
(
mrr_iter
,
&
cur_range
)))
...
...
@@ -435,9 +432,10 @@ int Mrr_ordered_index_reader::refill_buffer(bool initial)
DBUG_ASSERT
(
cur_range
.
range_flag
&
EQ_RANGE
);
/* Put key, or {key, range_id} pair into the buffer */
key_ptr
=
(
keypar
.
use_key_pointers
)
?
(
uchar
*
)
&
cur_range
.
start_key
.
key
:
(
uchar
*
)
cur_range
.
start_key
.
key
;
key_buffer
->
write_ptr1
=
keypar
.
use_key_pointers
?
(
uchar
*
)
&
cur_range
.
start_key
.
key
:
(
uchar
*
)
cur_range
.
start_key
.
key
;
key_buffer
->
write_ptr2
=
(
uchar
*
)
&
cur_range
.
ptr
;
key_buffer
->
write
();
}
...
...
@@ -591,16 +589,14 @@ void Mrr_index_reader::position()
int
Mrr_ordered_rndpos_reader
::
refill_from_index_reader
()
{
char
*
range_info
;
uchar
**
range_info_ptr
=
(
uchar
**
)
&
range_info
;
int
res
;
DBUG_ENTER
(
"Mrr_ordered_rndpos_reader::refill_from_index_reader"
);
DBUG_ASSERT
(
rowid_buffer
->
is_empty
());
index_rowid
=
index_reader
->
get_rowid_ptr
();
rowid_buffer
->
reset
();
rowid_buffer
->
setup_writing
(
&
index_rowid
,
file
->
ref_length
,
is_mrr_assoc
?
(
uchar
**
)
&
range_info_ptr
:
NULL
,
is_mrr_assoc
?
sizeof
(
char
*
)
:
0
);
rowid_buffer
->
setup_writing
(
file
->
ref_length
,
is_mrr_assoc
?
sizeof
(
char
*
)
:
0
);
last_identical_rowid
=
NULL
;
...
...
@@ -620,6 +616,8 @@ int Mrr_ordered_rndpos_reader::refill_from_index_reader()
index_reader
->
position
();
/* Put rowid, or {rowid, range_id} pair into the buffer */
rowid_buffer
->
write_ptr1
=
index_rowid
;
rowid_buffer
->
write_ptr2
=
(
uchar
*
)
&
range_info
;
rowid_buffer
->
write
();
}
...
...
sql/sql_lifo_buffer.h
View file @
8dc612e6
...
...
@@ -28,18 +28,18 @@ class Backward_lifo_buffer;
class
Lifo_buffer
{
protected:
/**
Pointers to data to be written. write() call will assume that
(*write_ptr1) points to size1 bytes of data to be written.
If write_ptr2 != NULL then the buffer stores pairs, and (*write_ptr2)
points to size2 bytes of data that form the second component.
*/
uchar
**
write_ptr1
;
size_t
size1
;
uchar
**
write_ptr2
;
size_t
size2
;
public:
/**
write() will put into buffer size1 bytes pointed by write_ptr1. If
size2!=0, then they will be accompanied by size2 bytes pointed by
write_ptr2.
*/
uchar
*
write_ptr1
;
uchar
*
write_ptr2
;
/**
read() will do reading by storing pointers to read data into read_ptr1 or
into (read_ptr1, read_ptr2), depending on whether the buffer was set to
...
...
@@ -75,11 +75,9 @@ class Lifo_buffer
Specify where write() should get the source data from, as well as source
data size.
*/
void
setup_writing
(
uchar
**
data1
,
size_t
len1
,
uchar
**
data2
,
size_t
len2
)
void
setup_writing
(
size_t
len1
,
size_t
len2
)
{
write_ptr1
=
data1
;
size1
=
len1
;
write_ptr2
=
data2
;
size2
=
len2
;
}
...
...
@@ -95,7 +93,7 @@ class Lifo_buffer
bool
can_write
()
{
return
have_space_for
(
size1
+
(
write_ptr2
?
size2
:
0
)
);
return
have_space_for
(
size1
+
size2
);
}
virtual
void
write
()
=
0
;
...
...
@@ -104,7 +102,7 @@ class Lifo_buffer
void
sort
(
qsort2_cmp
cmp_func
,
void
*
cmp_func_arg
)
{
uint
elem_size
=
size1
+
(
write_ptr2
?
size2
:
0
)
;
uint
elem_size
=
size1
+
size2
;
uint
n_elements
=
used_size
()
/
elem_size
;
my_qsort2
(
used_area
(),
n_elements
,
elem_size
,
cmp_func
,
cmp_func_arg
);
}
...
...
@@ -164,9 +162,9 @@ class Forward_lifo_buffer: public Lifo_buffer
void
write
()
{
write_bytes
(
*
write_ptr1
,
size1
);
if
(
write_ptr
2
)
write_bytes
(
*
write_ptr2
,
size2
);
write_bytes
(
write_ptr1
,
size1
);
if
(
size
2
)
write_bytes
(
write_ptr2
,
size2
);
}
void
write_bytes
(
const
uchar
*
data
,
size_t
bytes
)
{
...
...
@@ -257,8 +255,8 @@ class Backward_lifo_buffer: public Lifo_buffer
void
write
()
{
if
(
write_ptr2
)
write_bytes
(
*
write_ptr2
,
size2
);
write_bytes
(
*
write_ptr1
,
size1
);
write_bytes
(
write_ptr2
,
size2
);
write_bytes
(
write_ptr1
,
size1
);
}
void
write_bytes
(
const
uchar
*
data
,
size_t
bytes
)
{
...
...
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