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
dc43549f
Commit
dc43549f
authored
Dec 08, 2009
by
V Narayanan
Browse files
Options
Browse Files
Download
Plain Diff
merging with mysql-next-mr-svoj
parents
e8d01684
21aaf8dd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
sql/handler.h
sql/handler.h
+23
-0
sql/sql_insert.cc
sql/sql_insert.cc
+17
-0
No files found.
sql/handler.h
View file @
dc43549f
...
@@ -127,6 +127,29 @@
...
@@ -127,6 +127,29 @@
*/
*/
#define HA_BINLOG_ROW_CAPABLE (LL(1) << 34)
#define HA_BINLOG_ROW_CAPABLE (LL(1) << 34)
#define HA_BINLOG_STMT_CAPABLE (LL(1) << 35)
#define HA_BINLOG_STMT_CAPABLE (LL(1) << 35)
/*
When a multiple key conflict happens in a REPLACE command mysql
expects the conflicts to be reported in the ascending order of
key names.
For e.g.
CREATE TABLE t1 (a INT, UNIQUE (a), b INT NOT NULL, UNIQUE (b), c INT NOT
NULL, INDEX(c));
REPLACE INTO t1 VALUES (1,1,1),(2,2,2),(2,1,3);
MySQL expects the conflict with 'a' to be reported before the conflict with
'b'.
If the underlying storage engine does not report the conflicting keys in
ascending order, it causes unexpected errors when the REPLACE command is
executed.
This flag helps the underlying SE to inform the server that the keys are not
ordered.
*/
#define HA_DUPLICATE_KEY_NOT_IN_ORDER (LL(1) << 36)
/*
/*
Set of all binlog flags. Currently only contain the capabilities
Set of all binlog flags. Currently only contain the capabilities
...
...
sql/sql_insert.cc
View file @
dc43549f
...
@@ -1322,6 +1322,23 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
...
@@ -1322,6 +1322,23 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
static
int
last_uniq_key
(
TABLE
*
table
,
uint
keynr
)
static
int
last_uniq_key
(
TABLE
*
table
,
uint
keynr
)
{
{
/*
When an underlying storage engine informs that the unique key
conflicts are not reported in the ascending order by setting
the HA_DUPLICATE_KEY_NOT_IN_ORDER flag, we cannot rely on this
information to determine the last key conflict.
The information about the last key conflict will be used to
do a replace of the new row on the conflicting row, rather
than doing a delete (of old row) + insert (of new row).
Hence check for this flag and disable replacing the last row
by returning 0 always. Returning 0 will result in doing
a delete + insert always.
*/
if
(
table
->
file
->
ha_table_flags
()
&
HA_DUPLICATE_KEY_NOT_IN_ORDER
)
return
0
;
while
(
++
keynr
<
table
->
s
->
keys
)
while
(
++
keynr
<
table
->
s
->
keys
)
if
(
table
->
key_info
[
keynr
].
flags
&
HA_NOSAME
)
if
(
table
->
key_info
[
keynr
].
flags
&
HA_NOSAME
)
return
0
;
return
0
;
...
...
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