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
8a01a0ac
Commit
8a01a0ac
authored
Apr 13, 2015
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-7920 main.group_min_max fails in buildbot with valgrind
parent
d8a4a836
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
18 deletions
+33
-18
sql/opt_range.cc
sql/opt_range.cc
+32
-18
sql/opt_range.h
sql/opt_range.h
+1
-0
No files found.
sql/opt_range.cc
View file @
8a01a0ac
...
...
@@ -14697,6 +14697,36 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_prefix()
}
/**
Allocate a temporary buffer, populate the buffer using the group prefix key
and the min/max field key, and compare the result to the current key pointed
by index_info.
@param key - the min or max field key
@param length - length of "key"
*/
int
QUICK_GROUP_MIN_MAX_SELECT
::
cmp_min_max_key
(
const
uchar
*
key
,
uint16
length
)
{
/*
Allocate a buffer.
Note, we allocate one extra byte, because some of Field_xxx::cmp(),
e.g. Field_newdate::cmp(), use uint3korr() which actually read four bytes
and then bit-and the read value with 0xFFFFFF.
See "MDEV-7920 main.group_min_max fails ... with valgrind" for details.
*/
uchar
*
buffer
=
(
uchar
*
)
my_alloca
(
real_prefix_len
+
min_max_arg_len
+
1
);
/* Concatenate the group prefix key and the min/max field key */
memcpy
(
buffer
,
group_prefix
,
real_prefix_len
);
memcpy
(
buffer
+
real_prefix_len
,
key
,
length
);
/* Compare the key pointed by key_info to the created key */
int
cmp_res
=
key_cmp
(
index_info
->
key_part
,
buffer
,
real_prefix_len
+
min_max_arg_len
);
my_afree
(
buffer
);
return
cmp_res
;
}
/*
Find the minimal key in a group that satisfies some range conditions for the
min/max argument field.
...
...
@@ -14798,15 +14828,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min_in_range()
/* If there is an upper limit, check if the found key is in the range. */
if
(
!
(
cur_range
->
flag
&
NO_MAX_RANGE
)
)
{
/* Compose the MAX key for the range. */
uchar
*
max_key
=
(
uchar
*
)
my_alloca
(
real_prefix_len
+
min_max_arg_len
);
memcpy
(
max_key
,
group_prefix
,
real_prefix_len
);
memcpy
(
max_key
+
real_prefix_len
,
cur_range
->
max_key
,
cur_range
->
max_length
);
/* Compare the found key with max_key. */
int
cmp_res
=
key_cmp
(
index_info
->
key_part
,
max_key
,
real_prefix_len
+
min_max_arg_len
);
my_afree
(
max_key
);
int
cmp_res
=
cmp_min_max_key
(
cur_range
->
max_key
,
cur_range
->
max_length
);
/*
The key is outside of the range if:
the interval is open and the key is equal to the maximum boundry
...
...
@@ -14924,15 +14946,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range()
/* If there is a lower limit, check if the found key is in the range. */
if
(
!
(
cur_range
->
flag
&
NO_MIN_RANGE
)
)
{
/* Compose the MIN key for the range. */
uchar
*
min_key
=
(
uchar
*
)
my_alloca
(
real_prefix_len
+
min_max_arg_len
);
memcpy
(
min_key
,
group_prefix
,
real_prefix_len
);
memcpy
(
min_key
+
real_prefix_len
,
cur_range
->
min_key
,
cur_range
->
min_length
);
/* Compare the found key with min_key. */
int
cmp_res
=
key_cmp
(
index_info
->
key_part
,
min_key
,
real_prefix_len
+
min_max_arg_len
);
my_afree
(
min_key
);
int
cmp_res
=
cmp_min_max_key
(
cur_range
->
min_key
,
cur_range
->
min_length
);
/*
The key is outside of the range if:
the interval is open and the key is equal to the minimum boundry
...
...
sql/opt_range.h
View file @
8a01a0ac
...
...
@@ -927,6 +927,7 @@ private:
int
next_max
();
void
update_min_result
();
void
update_max_result
();
int
cmp_min_max_key
(
const
uchar
*
key
,
uint16
length
);
public:
QUICK_GROUP_MIN_MAX_SELECT
(
TABLE
*
table
,
JOIN
*
join
,
bool
have_min
,
bool
have_max
,
bool
have_agg_distinct
,
...
...
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