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
d63d7710
Commit
d63d7710
authored
Nov 01, 2010
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-initialization reworked
parent
4fbbdeb6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
23 deletions
+54
-23
sql/multi_range_read.cc
sql/multi_range_read.cc
+51
-22
sql/multi_range_read.h
sql/multi_range_read.h
+3
-1
No files found.
sql/multi_range_read.cc
View file @
d63d7710
...
...
@@ -332,6 +332,9 @@ int Mrr_simple_index_reader::init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
int
Mrr_ordered_index_reader
::
get_next
(
char
**
range_info_arg
)
{
DBUG_ENTER
(
"Mrr_ordered_index_reader::get_next"
);
if
(
!
know_key_tuple_params
)
/* We're in startup phase */
DBUG_RETURN
(
HA_ERR_END_OF_FILE
);
while
(
1
)
{
...
...
@@ -352,7 +355,7 @@ int Mrr_ordered_index_reader::get_next(char **range_info_arg)
{
if
(
key_buffer
->
is_empty
())
{
if
(
auto_refill
)
/*
if (auto_refill)
{
int res;
if ((res= refill_buffer()))
...
...
@@ -364,6 +367,7 @@ int Mrr_ordered_index_reader::get_next(char **range_info_arg)
}
}
else
*/
{
/* Buffer refills are managed by somebody else for us */
index_scan_eof
=
TRUE
;
...
...
@@ -521,10 +525,11 @@ int Mrr_ordered_rndpos_reader::init(handler *h_arg,
//rowid_buff_elem_size= h->ref_length;
//if (!(mode & HA_MRR_NO_ASSOCIATION))
// rowid_buff_elem_size += sizeof(char*);
int
res
=
index_reader
->
refill_buffer
();
if
(
res
&&
res
!=
HA_ERR_END_OF_FILE
)
return
res
;
index_reader_exhausted
=
FALSE
;
///int res= index_reader->refill_buffer();
///if (res && res!=HA_ERR_END_OF_FILE)
/// return res;
return
0
;
}
...
...
@@ -547,13 +552,36 @@ int Mrr_ordered_rndpos_reader::init(handler *h_arg,
@retval other Error
*/
int
Mrr_ordered_rndpos_reader
::
refill_buffer
()
{
int
res
;
DBUG_ENTER
(
"Mrr_ordered_rndpos_reader::refill_buffer"
);
if
(
index_reader_exhausted
)
DBUG_RETURN
(
HA_ERR_END_OF_FILE
);
while
((
res
=
refill2
()
==
HA_ERR_END_OF_FILE
))
{
if
((
res
=
index_reader
->
refill_buffer
()))
{
if
(
res
==
HA_ERR_END_OF_FILE
)
index_reader_exhausted
=
TRUE
;
break
;
}
}
DBUG_RETURN
(
res
);
}
/* This one refills without calling index_reader->refill_buffer(). */
int
Mrr_ordered_rndpos_reader
::
refill2
()
{
char
*
range_info
;
uchar
**
range_info_ptr
=
(
uchar
**
)
&
range_info
;
int
res
;
DBUG_ENTER
(
"Mrr_ordered_rndpos_reader::refill
_buffer
"
);
DBUG_ENTER
(
"Mrr_ordered_rndpos_reader::refill
2
"
);
DBUG_ASSERT
(
rowid_buffer
->
is_empty
());
index_rowid
=
index_reader
->
get_rowid_ptr
();
rowid_buffer
->
reset
();
...
...
@@ -563,9 +591,6 @@ int Mrr_ordered_rndpos_reader::refill_buffer()
last_identical_rowid
=
NULL
;
if
(
index_reader
->
eof
())
DBUG_RETURN
(
HA_ERR_END_OF_FILE
);
while
(
rowid_buffer
->
can_write
())
{
res
=
index_reader
->
get_next
(
&
range_info
);
...
...
@@ -578,10 +603,6 @@ int Mrr_ordered_rndpos_reader::refill_buffer()
rowid_buffer
->
write
();
}
if
(
res
&&
res
!=
HA_ERR_END_OF_FILE
)
DBUG_RETURN
(
res
);
/* Sort the buffer contents by rowid */
rowid_buffer
->
sort
((
qsort2_cmp
)
rowid_cmp_reverse
,
(
void
*
)
h
);
...
...
@@ -589,7 +610,7 @@ int Mrr_ordered_rndpos_reader::refill_buffer()
rowid_buffer
->
setup_reading
(
&
rowid
,
h
->
ref_length
,
is_mrr_assoc
?
(
uchar
**
)
&
rowids_range_id
:
NULL
,
sizeof
(
void
*
));
DBUG_RETURN
(
(
rowid_buffer
->
is_empty
()
&&
res
)
?
HA_ERR_END_OF_FILE
:
0
);
DBUG_RETURN
(
rowid_buffer
->
is_empty
()
?
HA_ERR_END_OF_FILE
:
0
);
}
...
...
@@ -630,6 +651,7 @@ int Mrr_ordered_rndpos_reader::get_next(char **range_info)
while
(
1
)
{
#if 0
if (rowid_buffer->is_empty()) /* We're out of rowids */
{
/* First, finish off the sorted keys we have */
...
...
@@ -647,12 +669,12 @@ int Mrr_ordered_rndpos_reader::get_next(char **range_info)
reader, then refill us.
*/
// TODO: if key buffer is empty, too, redistribute the buffer space.
if ((res= index_reader->refill_buffer()) ||
(res= refill_buffer()))
return res;
}
}
#endif
last_identical_rowid
=
NULL
;
...
...
@@ -795,8 +817,8 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
if
(
strategy
==
index_strategy
)
{
if
(
ordered_idx_reader
)
ordered_idx_reader
->
auto_refill
=
TRUE
;
///
if (ordered_idx_reader)
//
ordered_idx_reader->auto_refill= TRUE;
/* Index strategy serves it all. We don't need two handlers, etc */
/* Give the buffer to index strategy */
if
((
res
=
index_strategy
->
init
(
h
,
seq_funcs
,
seq_init_param
,
n_ranges
,
...
...
@@ -815,8 +837,8 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
if
((
res
=
setup_two_handlers
()))
DBUG_RETURN
(
res
);
if
(
ordered_idx_reader
)
ordered_idx_reader
->
auto_refill
=
FALSE
;
///
if (ordered_idx_reader)
///
ordered_idx_reader->auto_refill= FALSE;
if
((
res
=
index_strategy
->
init
(
h2
,
seq_funcs
,
seq_init_param
,
n_ranges
,
mode
,
this
))
||
...
...
@@ -827,7 +849,7 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
}
res
=
strategy
->
refill_buffer
();
if
(
res
&&
res
!=
HA_ERR_END_OF_FILE
)
if
(
res
&&
res
!=
HA_ERR_END_OF_FILE
)
//psergey-todo: remove EOF check here
goto
error
;
/*
...
...
@@ -1215,7 +1237,14 @@ void Key_value_records_iterator::close()
int
DsMrr_impl
::
dsmrr_next
(
char
**
range_info
)
{
return
strategy
->
get_next
(
range_info
);
int
res
;
while
((
res
=
strategy
->
get_next
(
range_info
))
==
HA_ERR_END_OF_FILE
)
{
if
((
res
=
strategy
->
refill_buffer
()))
break
;
/* EOF or error */
}
return
res
;
//return strategy->get_next(range_info);
}
...
...
sql/multi_range_read.h
View file @
d63d7710
...
...
@@ -233,7 +233,7 @@ class Mrr_ordered_index_reader : public Mrr_index_reader
RANGE_SEQ_IF
mrr_funcs
;
range_seq_t
mrr_iter
;
bool
auto_refill
;
//
bool auto_refill;
bool
index_scan_eof
;
...
...
@@ -256,6 +256,7 @@ class Mrr_ordered_rndpos_reader : public Mrr_reader
Lifo_buffer
*
buf
);
int
get_next
(
char
**
range_info
);
int
refill_buffer
();
int
refill2
();
void
cleanup
();
private:
handler
*
h
;
...
...
@@ -264,6 +265,7 @@ class Mrr_ordered_rndpos_reader : public Mrr_reader
/* This what we get (rowid, range_info) pairs from */
Mrr_index_reader
*
index_reader
;
uchar
*
index_rowid
;
bool
index_reader_exhausted
;
/* TRUE <=> need range association, buffers hold {rowid, range_id} pairs */
bool
is_mrr_assoc
;
...
...
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