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
4c2b95b6
Commit
4c2b95b6
authored
Aug 17, 2007
by
holyfoot/hf@hfmain.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk@192.168.21.1:mysql-5.1-opt
into mysql.com:/home/hf/work/27405/my51-27405
parents
37f3a92a
f952b1ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
sql/ha_partition.cc
sql/ha_partition.cc
+21
-2
No files found.
sql/ha_partition.cc
View file @
4c2b95b6
...
@@ -2676,6 +2676,7 @@ int ha_partition::write_row(uchar * buf)
...
@@ -2676,6 +2676,7 @@ int ha_partition::write_row(uchar * buf)
uint32
part_id
;
uint32
part_id
;
int
error
;
int
error
;
longlong
func_value
;
longlong
func_value
;
bool
autoincrement_lock
=
false
;
#ifdef NOT_NEEDED
#ifdef NOT_NEEDED
uchar
*
rec0
=
m_rec0
;
uchar
*
rec0
=
m_rec0
;
#endif
#endif
...
@@ -2691,7 +2692,21 @@ int ha_partition::write_row(uchar * buf)
...
@@ -2691,7 +2692,21 @@ int ha_partition::write_row(uchar * buf)
or a new row, then update the auto_increment value in the record.
or a new row, then update the auto_increment value in the record.
*/
*/
if
(
table
->
next_number_field
&&
buf
==
table
->
record
[
0
])
if
(
table
->
next_number_field
&&
buf
==
table
->
record
[
0
])
{
/*
Some engines (InnoDB for example) can change autoincrement
counter only after 'table->write_row' operation.
So if another thread gets inside the ha_partition::write_row
before it is complete, it gets same auto_increment value,
which means DUP_KEY error (bug #27405)
Here we separate the access using table_share->mutex, and
use autoincrement_lock variable to avoid unnecessary locks.
Probably not an ideal solution.
*/
autoincrement_lock
=
true
;
pthread_mutex_lock
(
&
table_share
->
mutex
);
update_auto_increment
();
update_auto_increment
();
}
my_bitmap_map
*
old_map
=
dbug_tmp_use_all_columns
(
table
,
table
->
read_set
);
my_bitmap_map
*
old_map
=
dbug_tmp_use_all_columns
(
table
,
table
->
read_set
);
#ifdef NOT_NEEDED
#ifdef NOT_NEEDED
...
@@ -2712,11 +2727,15 @@ int ha_partition::write_row(uchar * buf)
...
@@ -2712,11 +2727,15 @@ int ha_partition::write_row(uchar * buf)
if
(
unlikely
(
error
))
if
(
unlikely
(
error
))
{
{
m_part_info
->
err_value
=
func_value
;
m_part_info
->
err_value
=
func_value
;
DBUG_RETURN
(
error
)
;
goto
exit
;
}
}
m_last_part
=
part_id
;
m_last_part
=
part_id
;
DBUG_PRINT
(
"info"
,
(
"Insert in partition %d"
,
part_id
));
DBUG_PRINT
(
"info"
,
(
"Insert in partition %d"
,
part_id
));
DBUG_RETURN
(
m_file
[
part_id
]
->
write_row
(
buf
));
error
=
m_file
[
part_id
]
->
write_row
(
buf
);
exit:
if
(
autoincrement_lock
)
pthread_mutex_unlock
(
&
table_share
->
mutex
);
DBUG_RETURN
(
error
);
}
}
...
...
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