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
2121ab1e
Commit
2121ab1e
authored
Sep 20, 2010
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DS-MRR improvements: remove write_size/read_size, have the same size
for writing and reading
parent
189555f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
22 deletions
+19
-22
sql/multi_range_read.cc
sql/multi_range_read.cc
+12
-12
sql/multi_range_read.h
sql/multi_range_read.h
+7
-10
No files found.
sql/multi_range_read.cc
View file @
2121ab1e
...
...
@@ -291,22 +291,22 @@ void SimpleBuffer::setup_writing(uchar **data1, size_t len1,
uchar
**
data2
,
size_t
len2
)
{
write_ptr1
=
data1
;
write_
size1
=
len1
;
size1
=
len1
;
write_ptr2
=
data2
;
write_
size2
=
len2
;
size2
=
len2
;
}
void
SimpleBuffer
::
write
()
{
if
(
is_reverse
()
&&
write_ptr2
)
write
(
*
write_ptr2
,
write_
size2
);
write
(
*
write_ptr2
,
size2
);
write
(
*
write_ptr1
,
write_
size1
);
write
(
*
write_ptr1
,
size1
);
if
(
!
is_reverse
()
&&
write_ptr2
)
write
(
*
write_ptr2
,
write_
size2
);
write
(
*
write_ptr2
,
size2
);
}
...
...
@@ -326,7 +326,7 @@ void SimpleBuffer::write(const uchar *data, size_t bytes)
bool
SimpleBuffer
::
can_write
()
{
return
have_space_for
(
write_size1
+
(
write_ptr2
?
write_size2
:
0
));
return
have_space_for
(
size1
+
(
write_ptr2
?
size2
:
0
));
}
...
...
@@ -349,20 +349,20 @@ void SimpleBuffer::setup_reading(uchar **data1, size_t len1,
uchar
**
data2
,
size_t
len2
)
{
read_ptr1
=
data1
;
read_size1
=
len1
;
DBUG_ASSERT
(
len1
==
size1
)
;
read_ptr2
=
data2
;
read_size2
=
len2
;
DBUG_ASSERT
(
len2
==
size2
)
;
}
bool
SimpleBuffer
::
read
()
{
if
(
!
have_data
(
read_size1
+
(
read_ptr2
?
read_
size2
:
0
)))
if
(
!
have_data
(
size1
+
(
read_ptr2
?
size2
:
0
)))
return
TRUE
;
*
read_ptr1
=
read
(
read_
size1
);
*
read_ptr1
=
read
(
size1
);
if
(
read_ptr2
)
*
read_ptr2
=
read
(
read_
size2
);
*
read_ptr2
=
read
(
size2
);
return
FALSE
;
}
...
...
@@ -731,7 +731,7 @@ int DsMrr_impl::dsmrr_fill_rowid_buffer()
void
SimpleBuffer
::
sort
(
qsort2_cmp
cmp_func
,
void
*
cmp_func_arg
)
{
uint
elem_size
=
write_size1
+
(
write_ptr2
?
write_
size2
:
0
);
uint
elem_size
=
size1
+
(
write_ptr2
?
size2
:
0
);
uint
n_elements
=
used_size
()
/
elem_size
;
my_qsort2
(
used_area
(),
n_elements
,
elem_size
,
cmp_func
,
cmp_func_arg
);
}
...
...
sql/multi_range_read.h
View file @
2121ab1e
...
...
@@ -106,25 +106,22 @@ class SimpleBuffer
/*
Data to be written. write() call will assume that (*write_ptr1) points to
write_
size1 bytes of data to be written.
If write_ptr2
!=NULL then the buffer stores pairs, and (*write_ptr2) points
to write_
size2 bytes of data that form the second component.
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
write_
size1
;
size_t
size1
;
uchar
**
write_ptr2
;
size_t
write_
size2
;
size_t
size2
;
/*
read() will do reading by storing pointer to read data into *read_ptr1 (if
the buffer stores atomic elements), or into {*read_ptr1, *read_ptr2} (if
the buffer stores pairs).
*/
//TODO if write_size1 == read_size1 why have two variables??
uchar
**
read_ptr1
;
size_t
read_size1
;
uchar
**
read_ptr2
;
size_t
read_size2
;
public:
/* Write-mode functions */
...
...
@@ -243,11 +240,11 @@ class SimpleBuffer
have written the second component first).
*/
uchar
*
res
;
if
((
res
=
get_next
(
buf
->
read_
size1
)))
if
((
res
=
get_next
(
buf
->
size1
)))
{
*
(
buf
->
read_ptr1
)
=
res
;
if
(
buf
->
read_ptr2
)
*
buf
->
read_ptr2
=
get_next
(
buf
->
read_
size2
);
*
buf
->
read_ptr2
=
get_next
(
buf
->
size2
);
return
FALSE
;
}
return
TRUE
;
/* EOF */
...
...
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