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
26f299ce
Commit
26f299ce
authored
Jan 10, 2020
by
Nikita Malyavin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove lambda. fix comments & docs. fix DBUG_ASSERTs
parent
6e41e833
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
28 deletions
+42
-28
sql/handler.cc
sql/handler.cc
+24
-22
sql/key.cc
sql/key.cc
+12
-0
sql/table.cc
sql/table.cc
+6
-0
sql/table.h
sql/table.h
+0
-6
No files found.
sql/handler.cc
View file @
26f299ce
...
...
@@ -6986,6 +6986,7 @@ int handler::ha_check_overlaps(const uchar *old_data, const uchar* new_data)
+
table_share
->
reclength
);
auto
*
record_buffer
=
check_overlaps_buffer
+
table_share
->
max_unique_length
;
auto
*
handler
=
this
;
// handler->inited can be NONE on INSERT
if
(
handler
->
inited
!=
NONE
)
{
create_lookup_handler
();
...
...
@@ -7023,23 +7024,6 @@ int handler::ha_check_overlaps(const uchar *old_data, const uchar* new_data)
if
(
error
)
return
error
;
auto
old_row_found
=
[
is_update
,
old_data
,
record_buffer
,
this
,
handler
](){
if
(
!
is_update
)
return
false
;
/* In case of update it could appear that the nearest neighbour is
* a record we are updating. It means, that there are no overlaps
* from this side.
*
* An assumption is made that during update we always have the last
* fetched row in old_data. Therefore, comparing ref's is enough
* */
DBUG_ASSERT
(
handler
!=
this
&&
inited
!=
NONE
);
DBUG_ASSERT
(
ref_length
==
handler
->
ref_length
);
handler
->
position
(
record_buffer
);
return
memcmp
(
ref
,
handler
->
ref
,
ref_length
)
==
0
;
};
error
=
handler
->
ha_start_keyread
(
key_nr
);
DBUG_ASSERT
(
!
error
);
...
...
@@ -7049,8 +7033,8 @@ int handler::ha_check_overlaps(const uchar *old_data, const uchar* new_data)
key_copy
(
check_overlaps_buffer
,
new_data
,
&
key_info
,
0
);
/* Copy period_end to period_start.
*
the value in period_end field is not significant, but anyway let's leave
*
it defined to avoid uninitialized memory access
the value in period_end field is not significant, but anyway let's leave
it defined to avoid uninitialized memory access
*/
memcpy
(
check_overlaps_buffer
+
key_base_length
,
check_overlaps_buffer
+
key_base_length
+
period_field_length
,
...
...
@@ -7062,8 +7046,23 @@ int handler::ha_check_overlaps(const uchar *old_data, const uchar* new_data)
key_part_map
((
1
<<
key_parts
)
-
1
),
HA_READ_BEFORE_KEY
);
if
(
!
error
&&
old_row_found
())
if
(
!
error
&&
is_update
)
{
/* In case of update it could happen that the nearest neighbour is
a record we are updating. It means, that there are no overlaps
from this side.
An assumption is made that during update we always have the last
fetched row in old_data. Therefore, comparing ref's is enough
*/
DBUG_ASSERT
(
handler
!=
this
);
DBUG_ASSERT
(
inited
!=
NONE
);
DBUG_ASSERT
(
ref_length
==
handler
->
ref_length
);
handler
->
position
(
record_buffer
);
if
(
memcmp
(
ref
,
handler
->
ref
,
ref_length
)
==
0
)
error
=
handler
->
ha_index_prev
(
record_buffer
);
}
if
(
!
error
&&
table
->
check_period_overlaps
(
key_info
,
key_info
,
new_data
,
record_buffer
)
==
0
)
...
...
@@ -7085,7 +7084,10 @@ int handler::ha_check_overlaps(const uchar *old_data, const uchar* new_data)
// Restore keyread of this handler, if it was enabled
if
(
old_this_keyread
<
MAX_KEY
)
DBUG_ASSERT
(
this
->
ha_start_keyread
(
old_this_keyread
)
==
0
);
{
error
=
this
->
ha_start_keyread
(
old_this_keyread
);
DBUG_ASSERT
(
error
==
0
);
}
return
error
;
}
...
...
sql/key.cc
View file @
26f299ce
...
...
@@ -899,6 +899,12 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts,
}
/**
Compare base parts (not including the period) of keys with period
@return -1, lhs less than rhs
0, lhs equals rhs
1, lhs more than rhs
*/
int
key_period_compare_bases
(
const
KEY
&
lhs_key
,
const
KEY
&
rhs_key
,
const
uchar
*
lhs
,
const
uchar
*
rhs
)
{
...
...
@@ -914,6 +920,12 @@ int key_period_compare_bases(const KEY &lhs_key, const KEY &rhs_key,
return
cmp_res
;
}
/**
Compare periods of two keys
@return -1, lhs preceeds rhs
0, lhs overlaps rhs
1, lhs succeeds rhs
*/
int
key_period_compare_periods
(
const
KEY
&
lhs_key
,
const
KEY
&
rhs_key
,
const
uchar
*
lhs
,
const
uchar
*
rhs
)
{
...
...
sql/table.cc
View file @
26f299ce
...
...
@@ -8617,6 +8617,12 @@ void TABLE::evaluate_update_default_function()
DBUG_VOID_RETURN
;
}
/**
Compare two keys with periods
@return -1, lhs precedes rhs
0, lhs overlaps rhs
1, lhs succeeds rhs
*/
int
TABLE
::
check_period_overlaps
(
const
KEY
&
lhs_key
,
const
KEY
&
rhs_key
,
const
uchar
*
lhs
,
const
uchar
*
rhs
)
{
...
...
sql/table.h
View file @
26f299ce
...
...
@@ -1635,12 +1635,6 @@ struct TABLE
int
insert_portion_of_time
(
THD
*
thd
,
const
vers_select_conds_t
&
period_conds
,
ha_rows
*
rows_inserted
);
bool
vers_check_update
(
List
<
Item
>
&
items
);
/*
@return -1, lhs precedes rhs
0, lhs overlaps rhs
1, lhs succeeds rhs
*/
static
int
check_period_overlaps
(
const
KEY
&
lhs_key
,
const
KEY
&
rhs_key
,
const
uchar
*
lhs
,
const
uchar
*
rhs
);
int
delete_row
();
...
...
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