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
84196617
Commit
84196617
authored
Aug 31, 2004
by
mskold@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug#5312 Ndb Cluster returns wrong error code for duplicate key at insert
parent
b0bac7d1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
5 deletions
+17
-5
mysql-test/r/ndb_replace.result
mysql-test/r/ndb_replace.result
+1
-1
mysql-test/t/ndb_replace.test
mysql-test/t/ndb_replace.test
+1
-1
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+14
-3
sql/ha_ndbcluster.h
sql/ha_ndbcluster.h
+1
-0
No files found.
mysql-test/r/ndb_replace.result
View file @
84196617
...
@@ -11,7 +11,7 @@ insert into t1 (gesuchnr, benutzer_id) value (3,2);
...
@@ -11,7 +11,7 @@ insert into t1 (gesuchnr, benutzer_id) value (3,2);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
insert into t1 (gesuchnr,benutzer_id) values (1,1);
insert into t1 (gesuchnr,benutzer_id) values (1,1);
ERROR 23000:
Can't write; duplicate key in table 't1'
ERROR 23000:
Duplicate entry '1-1' for key 1
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
select * from t1 order by gesuchnr;
select * from t1 order by gesuchnr;
gesuchnr benutzer_id
gesuchnr benutzer_id
...
...
mysql-test/t/ndb_replace.test
View file @
84196617
...
@@ -20,7 +20,7 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1);
...
@@ -20,7 +20,7 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1);
insert
into
t1
(
gesuchnr
,
benutzer_id
)
value
(
3
,
2
);
insert
into
t1
(
gesuchnr
,
benutzer_id
)
value
(
3
,
2
);
replace
into
t1
(
gesuchnr
,
benutzer_id
)
values
(
1
,
1
);
replace
into
t1
(
gesuchnr
,
benutzer_id
)
values
(
1
,
1
);
replace
into
t1
(
gesuchnr
,
benutzer_id
)
values
(
1
,
1
);
replace
into
t1
(
gesuchnr
,
benutzer_id
)
values
(
1
,
1
);
--
error
10
2
2
--
error
10
6
2
insert
into
t1
(
gesuchnr
,
benutzer_id
)
values
(
1
,
1
);
insert
into
t1
(
gesuchnr
,
benutzer_id
)
values
(
1
,
1
);
replace
into
t1
(
gesuchnr
,
benutzer_id
)
values
(
1
,
1
);
replace
into
t1
(
gesuchnr
,
benutzer_id
)
values
(
1
,
1
);
select
*
from
t1
order
by
gesuchnr
;
select
*
from
t1
order
by
gesuchnr
;
...
...
sql/ha_ndbcluster.cc
View file @
84196617
...
@@ -144,6 +144,7 @@ static int ndb_to_mysql_error(const NdbError *err)
...
@@ -144,6 +144,7 @@ static int ndb_to_mysql_error(const NdbError *err)
int
ha_ndbcluster
::
ndb_err
(
NdbConnection
*
trans
)
int
ha_ndbcluster
::
ndb_err
(
NdbConnection
*
trans
)
{
{
int
res
;
const
NdbError
err
=
trans
->
getNdbError
();
const
NdbError
err
=
trans
->
getNdbError
();
if
(
!
err
.
code
)
if
(
!
err
.
code
)
return
0
;
// Don't log things to DBUG log if no error
return
0
;
// Don't log things to DBUG log if no error
...
@@ -161,7 +162,13 @@ int ha_ndbcluster::ndb_err(NdbConnection *trans)
...
@@ -161,7 +162,13 @@ int ha_ndbcluster::ndb_err(NdbConnection *trans)
default:
default:
break
;
break
;
}
}
DBUG_RETURN
(
ndb_to_mysql_error
(
&
err
));
res
=
ndb_to_mysql_error
(
&
err
);
DBUG_PRINT
(
"info"
,
(
"transformed ndbcluster error %d to mysql error %d"
,
err
.
code
,
res
));
if
(
res
==
HA_ERR_FOUND_DUPP_KEY
)
dupkey
=
table
->
primary_key
;
DBUG_RETURN
(
res
);
}
}
...
@@ -2167,7 +2174,10 @@ void ha_ndbcluster::info(uint flag)
...
@@ -2167,7 +2174,10 @@ void ha_ndbcluster::info(uint flag)
if
(
flag
&
HA_STATUS_VARIABLE
)
if
(
flag
&
HA_STATUS_VARIABLE
)
DBUG_PRINT
(
"info"
,
(
"HA_STATUS_VARIABLE"
));
DBUG_PRINT
(
"info"
,
(
"HA_STATUS_VARIABLE"
));
if
(
flag
&
HA_STATUS_ERRKEY
)
if
(
flag
&
HA_STATUS_ERRKEY
)
{
DBUG_PRINT
(
"info"
,
(
"HA_STATUS_ERRKEY"
));
DBUG_PRINT
(
"info"
,
(
"HA_STATUS_ERRKEY"
));
errkey
=
dupkey
;
}
if
(
flag
&
HA_STATUS_AUTO
)
if
(
flag
&
HA_STATUS_AUTO
)
DBUG_PRINT
(
"info"
,
(
"HA_STATUS_AUTO"
));
DBUG_PRINT
(
"info"
,
(
"HA_STATUS_AUTO"
));
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
...
@@ -2621,7 +2631,7 @@ int ndbcluster_commit(THD *thd, void *ndb_transaction)
...
@@ -2621,7 +2631,7 @@ int ndbcluster_commit(THD *thd, void *ndb_transaction)
const
NdbOperation
*
error_op
=
trans
->
getNdbErrorOperation
();
const
NdbOperation
*
error_op
=
trans
->
getNdbErrorOperation
();
ERR_PRINT
(
err
);
ERR_PRINT
(
err
);
res
=
ndb_to_mysql_error
(
&
err
);
res
=
ndb_to_mysql_error
(
&
err
);
if
(
res
!=
-
1
)
if
(
res
!=
-
1
)
ndbcluster_print_error
(
res
,
error_op
);
ndbcluster_print_error
(
res
,
error_op
);
}
}
ndb
->
closeTransaction
(
trans
);
ndb
->
closeTransaction
(
trans
);
...
@@ -3126,7 +3136,8 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
...
@@ -3126,7 +3136,8 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
ops_pending
(
0
),
ops_pending
(
0
),
skip_auto_increment
(
true
),
skip_auto_increment
(
true
),
blobs_buffer
(
0
),
blobs_buffer
(
0
),
blobs_buffer_size
(
0
)
blobs_buffer_size
(
0
),
dupkey
((
uint
)
-
1
)
{
{
int
i
;
int
i
;
...
...
sql/ha_ndbcluster.h
View file @
84196617
...
@@ -237,6 +237,7 @@ class ha_ndbcluster: public handler
...
@@ -237,6 +237,7 @@ class ha_ndbcluster: public handler
// memory for blobs in one tuple
// memory for blobs in one tuple
char
*
blobs_buffer
;
char
*
blobs_buffer
;
uint32
blobs_buffer_size
;
uint32
blobs_buffer_size
;
uint
dupkey
;
};
};
bool
ndbcluster_init
(
void
);
bool
ndbcluster_init
(
void
);
...
...
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