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
c5904702
Commit
c5904702
authored
Nov 29, 2023
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: remove partition-specific code around update_auto_increment()
parent
b94ae387
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
31 deletions
+3
-31
sql/ha_partition.cc
sql/ha_partition.cc
+2
-29
sql/ha_partition.h
sql/ha_partition.h
+1
-2
No files found.
sql/ha_partition.cc
View file @
c5904702
...
...
@@ -4186,6 +4186,7 @@ int ha_partition::external_lock(THD *thd, int lock_type)
m_part_info
->
part_expr
->
walk
(
&
Item
::
register_field_in_read_map
,
1
,
0
);
if
((
error
=
m_part_info
->
vers_set_hist_part
(
thd
)))
goto
err_handler
;
need_info_for_auto_inc
();
}
DBUG_RETURN
(
0
);
...
...
@@ -4509,33 +4510,8 @@ int ha_partition::write_row(const uchar * buf)
*/
if
(
have_auto_increment
)
{
if
(
!
table_share
->
next_number_keypart
)
if
(
unlikely
(
error
=
update_next_auto_inc_val
()))
goto
exit
;
/*
If we have failed to set the auto-increment value for this row,
it is highly likely that we will not be able to insert it into
the correct partition. We must check and fail if necessary.
*/
if
(
unlikely
(
error
=
update_auto_increment
()))
goto
exit
;
/*
Don't allow generation of auto_increment value the partitions handler.
If a partitions handler would change the value, then it might not
match the partition any longer.
This can occur if 'SET INSERT_ID = 0; INSERT (NULL)',
So allow this by adding 'MODE_NO_AUTO_VALUE_ON_ZERO' to sql_mode.
The partitions handler::next_insert_id must always be 0. Otherwise
we need to forward release_auto_increment, or reset it for all
partitions.
*/
if
(
table
->
next_number_field
->
val_int
()
==
0
)
{
table
->
auto_increment_field_not_null
=
TRUE
;
thd
->
variables
.
sql_mode
|=
MODE_NO_AUTO_VALUE_ON_ZERO
;
}
}
old_map
=
dbug_tmp_use_all_columns
(
table
,
&
table
->
read_set
);
error
=
m_part_info
->
get_partition_id
(
m_part_info
,
&
part_id
,
&
func_value
);
...
...
@@ -10897,10 +10873,7 @@ void ha_partition::get_auto_increment(ulonglong offset, ulonglong increment,
else
{
THD
*
thd
=
ha_thd
();
/*
This is initialized in the beginning of the first write_row call.
*/
DBUG_ASSERT
(
part_share
->
auto_inc_initialized
);
update_next_auto_inc_val
();
/*
Get a lock for handling the auto_increment in part_share
for avoiding two concurrent statements getting the same number.
...
...
sql/ha_partition.h
View file @
c5904702
...
...
@@ -1406,9 +1406,8 @@ class ha_partition :public handler
{
ulonglong
nr
=
(((
Field_num
*
)
field
)
->
unsigned_flag
||
field
->
val_int
()
>
0
)
?
field
->
val_int
()
:
0
;
update_next_auto_inc_val
();
lock_auto_increment
();
DBUG_ASSERT
(
part_share
->
auto_inc_initialized
||
!
can_use_for_auto_inc_init
());
/* must check when the mutex is taken */
if
(
nr
>=
part_share
->
next_auto_inc_val
)
part_share
->
next_auto_inc_val
=
nr
+
1
;
...
...
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