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
d9a8dd22
Commit
d9a8dd22
authored
Oct 31, 2010
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DS-MRR/CPK improvements: correct buffer exhaustion handling
parent
8e4c627e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
12 deletions
+25
-12
sql/multi_range_read.cc
sql/multi_range_read.cc
+15
-10
sql/multi_range_read.h
sql/multi_range_read.h
+10
-2
No files found.
sql/multi_range_read.cc
View file @
d9a8dd22
...
@@ -484,7 +484,7 @@ int Mrr_ordered_index_reader::refill_buffer()
...
@@ -484,7 +484,7 @@ int Mrr_ordered_index_reader::refill_buffer()
scanning_key_val_iter
=
FALSE
;
scanning_key_val_iter
=
FALSE
;
index_scan_eof
=
FALSE
;
index_scan_eof
=
FALSE
;
DBUG_RETURN
(
0
);
DBUG_RETURN
(
(
no_more_keys
&&
key_buffer
->
is_empty
())
?
HA_ERR_END_OF_FILE
:
0
);
}
}
...
@@ -521,8 +521,11 @@ int Mrr_ordered_rndpos_reader::init(handler *h_arg,
...
@@ -521,8 +521,11 @@ int Mrr_ordered_rndpos_reader::init(handler *h_arg,
//rowid_buff_elem_size= h->ref_length;
//rowid_buff_elem_size= h->ref_length;
//if (!(mode & HA_MRR_NO_ASSOCIATION))
//if (!(mode & HA_MRR_NO_ASSOCIATION))
// rowid_buff_elem_size += sizeof(char*);
// rowid_buff_elem_size += sizeof(char*);
return
index_reader
->
refill_buffer
();
int
res
=
index_reader
->
refill_buffer
();
if
(
res
&&
res
!=
HA_ERR_END_OF_FILE
)
return
res
;
return
0
;
}
}
...
@@ -561,7 +564,7 @@ int Mrr_ordered_rndpos_reader::refill_buffer()
...
@@ -561,7 +564,7 @@ int Mrr_ordered_rndpos_reader::refill_buffer()
last_identical_rowid
=
NULL
;
last_identical_rowid
=
NULL
;
if
(
index_reader
->
eof
())
if
(
index_reader
->
eof
())
DBUG_RETURN
(
0
);
DBUG_RETURN
(
HA_ERR_END_OF_FILE
);
while
(
rowid_buffer
->
can_write
())
while
(
rowid_buffer
->
can_write
())
{
{
...
@@ -584,9 +587,9 @@ int Mrr_ordered_rndpos_reader::refill_buffer()
...
@@ -584,9 +587,9 @@ int Mrr_ordered_rndpos_reader::refill_buffer()
rowid_buffer
->
sort
((
qsort2_cmp
)
rowid_cmp_reverse
,
(
void
*
)
h
);
rowid_buffer
->
sort
((
qsort2_cmp
)
rowid_cmp_reverse
,
(
void
*
)
h
);
rowid_buffer
->
setup_reading
(
&
rowid
,
h
->
ref_length
,
rowid_buffer
->
setup_reading
(
&
rowid
,
h
->
ref_length
,
is_mrr_assoc
?
(
uchar
**
)
&
rowids_range_id
:
NULL
,
is_mrr_assoc
?
(
uchar
**
)
&
rowids_range_id
:
NULL
,
sizeof
(
void
*
));
sizeof
(
void
*
));
DBUG_RETURN
(
0
);
DBUG_RETURN
(
(
rowid_buffer
->
is_empty
()
&&
res
)
?
HA_ERR_END_OF_FILE
:
0
);
}
}
...
@@ -632,8 +635,9 @@ int Mrr_ordered_rndpos_reader::get_next(char **range_info)
...
@@ -632,8 +635,9 @@ int Mrr_ordered_rndpos_reader::get_next(char **range_info)
/* First, finish off the sorted keys we have */
/* First, finish off the sorted keys we have */
if
(
!
index_reader
->
eof
())
if
(
!
index_reader
->
eof
())
{
{
if
((
res
=
refill_buffer
()))
res
=
refill_buffer
();
return
res
;
/* for fatal errors */
if
(
res
&&
res
!=
HA_ERR_END_OF_FILE
)
return
res
;
}
}
if
(
rowid_buffer
->
is_empty
())
if
(
rowid_buffer
->
is_empty
())
...
@@ -821,8 +825,9 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
...
@@ -821,8 +825,9 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
goto
error
;
goto
error
;
}
}
}
}
if
(
strategy
->
refill_buffer
())
res
=
strategy
->
refill_buffer
();
if
(
res
&&
res
!=
HA_ERR_END_OF_FILE
)
goto
error
;
goto
error
;
/*
/*
...
...
sql/multi_range_read.h
View file @
d9a8dd22
...
@@ -126,8 +126,16 @@ class Buffer_manager
...
@@ -126,8 +126,16 @@ class Buffer_manager
index tuple or a table record.
index tuple or a table record.
Getting HA_ERR_END_OF_FILE from get_next() means that the source should be
Getting HA_ERR_END_OF_FILE from get_next() means that the source should be
re-filled. if eof() returns true after refill attempt, then the end of
re-filled.
Was:
if eof() returns true after refill attempt, then the end of
stream has been reached and get_next() must not be called anymore.
stream has been reached and get_next() must not be called anymore.
Now:
if refill_buffer() returns HA_ERR_END_OF_FILE that means the stream is
really exhausted.
*/
*/
class
Mrr_reader
class
Mrr_reader
...
@@ -168,7 +176,7 @@ class Mrr_simple_index_reader : public Mrr_index_reader
...
@@ -168,7 +176,7 @@ class Mrr_simple_index_reader : public Mrr_index_reader
void
*
seq_init_param
,
uint
n_ranges
,
void
*
seq_init_param
,
uint
n_ranges
,
uint
mode
,
Buffer_manager
*
buf_manager_arg
);
uint
mode
,
Buffer_manager
*
buf_manager_arg
);
int
get_next
(
char
**
range_info
);
int
get_next
(
char
**
range_info
);
int
refill_buffer
()
{
return
0
;
}
int
refill_buffer
()
{
return
HA_ERR_END_OF_FILE
;
}
bool
eof
()
{
return
test
(
res
);
}
bool
eof
()
{
return
test
(
res
);
}
uchar
*
get_rowid_ptr
()
{
return
h
->
ref
;
}
uchar
*
get_rowid_ptr
()
{
return
h
->
ref
;
}
bool
skip_record
(
char
*
range_id
,
uchar
*
rowid
)
bool
skip_record
(
char
*
range_id
,
uchar
*
rowid
)
...
...
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