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
dbc63bed
Commit
dbc63bed
authored
Sep 05, 2010
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MWL#121-125: DS-MRR improvements
- Address review feedback, step 1
parent
fae27347
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
172 additions
and
81 deletions
+172
-81
sql/handler.h
sql/handler.h
+4
-0
sql/multi_range_read.cc
sql/multi_range_read.cc
+104
-75
sql/multi_range_read.h
sql/multi_range_read.h
+64
-6
No files found.
sql/handler.h
View file @
dbc63bed
...
...
@@ -1807,6 +1807,10 @@ public:
inline
int
ha_index_first
(
uchar
*
buf
);
inline
int
ha_index_last
(
uchar
*
buf
);
inline
int
ha_index_next_same
(
uchar
*
buf
,
const
uchar
*
key
,
uint
keylen
);
/*
TODO: should we make for those functions non-virtual ha_func_name wrappers,
too?
*/
virtual
ha_rows
multi_range_read_info_const
(
uint
keyno
,
RANGE_SEQ_IF
*
seq
,
void
*
seq_init_param
,
uint
n_ranges
,
uint
*
bufsz
,
...
...
sql/multi_range_read.cc
View file @
dbc63bed
This diff is collapsed.
Click to expand it.
sql/multi_range_read.h
View file @
dbc63bed
...
...
@@ -61,20 +61,51 @@ class SimpleBuffer
-1 <=> everthing is done from end to start instead.
*/
int
direction
;
/* Pointers to read data from */
uchar
**
write_ptr1
;
size_t
write_size1
;
/* Same as above, but may be NULL */
uchar
**
write_ptr2
;
size_t
write_size2
;
/* Pointers to write data to */
uchar
**
read_ptr1
;
size_t
read_size1
;
/* Same as above, but may be NULL */
uchar
**
read_ptr2
;
size_t
read_size2
;
public:
/* Set up writing*/
void
setup_writing
(
uchar
**
data1
,
size_t
len1
,
uchar
**
data2
,
size_t
len2
);
void
sort
(
qsort2_cmp
cmp_func
,
void
*
cmp_func_arg
);
/* Write-mode functions */
void
reset_for_writing
();
void
write
(
const
uchar
*
data
,
size_t
bytes
);
void
write
();
bool
have_space_for
(
size_t
bytes
);
private:
void
write
(
const
uchar
*
data
,
size_t
bytes
);
uchar
*
used_area
()
{
return
(
direction
==
1
)
?
read_pos
:
write_pos
;
}
size_t
used_size
();
public:
bool
is_empty
()
{
return
used_size
()
==
0
;
}
/* Read-mode functions */
void
reset_for_reading
();
// todo: join with setup-writing?
void
setup_reading
(
uchar
**
data1
,
size_t
len1
,
uchar
**
data2
,
size_t
len2
);
bool
read
();
private:
uchar
*
read
(
size_t
bytes
);
public:
bool
have_data
(
size_t
bytes
);
uchar
*
end_of_space
();
...
...
@@ -135,7 +166,6 @@ public:
DBUG_ASSERT
(
0
);
/* Attempt to grow buffer in wrong direction */
}
//friend class PeekIterator;
class
PeekIterator
{
// if direction==1 : pointer to what to return next
...
...
@@ -148,6 +178,26 @@ public:
sb
=
sb_arg
;
pos
=
sb
->
read_pos
;
}
/*
If the buffer stores tuples, this call will return pointer to the first
component.
*/
bool
read_next
()
{
// Always read the first component first? (because we do inverted-writes
// if needed, so no measures need to be taken here).
uchar
*
res
;
if
((
res
=
get_next
(
sb
->
read_size1
)))
{
*
(
sb
->
read_ptr1
)
=
res
;
if
(
sb
->
read_ptr2
)
*
sb
->
read_ptr2
=
get_next
(
sb
->
read_size2
);
return
FALSE
;
}
return
TRUE
;
/* EOF */
}
private:
/* Return pointer to next chunk of nbytes bytes and avance over it */
uchar
*
get_next
(
size_t
nbytes
)
{
...
...
@@ -170,6 +220,7 @@ public:
};
};
/*
DS-MRR implementation for one table. Create/use one object of this class for
each ha_{myisam/innobase/etc} object. That object will be further referred to
...
...
@@ -206,8 +257,6 @@ public:
scanning.
*/
class
DsMrr_impl
{
public:
...
...
@@ -252,7 +301,16 @@ private:
/* Buffer to store rowids, or (rowid, range_id) pairs */
SimpleBuffer
rowid_buffer
;
uchar
*
identical_rowid_ptr
;
/* Reads from rowid buffer go to here: */
uchar
*
rowid
;
uchar
*
rowids_range_id
;
/*
not-NULL: we're traversing a group of (rowid, range_id) pairs with
identical rowid values, and this is the pointer to the last one.
NULL: we're not in the group of indentical rowids.
*/
uchar
*
last_identical_rowid
;
/* Identical keys */
bool
in_identical_keys_range
;
...
...
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