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
4467b464
Commit
4467b464
authored
Jun 20, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
d83c2643
84da8b22
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
16 deletions
+33
-16
mysql-test/r/ndb_insert.result
mysql-test/r/ndb_insert.result
+9
-7
mysql-test/t/ndb_insert.test
mysql-test/t/ndb_insert.test
+9
-6
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+15
-3
No files found.
mysql-test/r/ndb_insert.result
View file @
4467b464
...
@@ -416,10 +416,12 @@ INSERT INTO t1 VALUES
...
@@ -416,10 +416,12 @@ INSERT INTO t1 VALUES
SELECT COUNT(*) FROM t1;
SELECT COUNT(*) FROM t1;
COUNT(*)
COUNT(*)
2000
2000
INSERT INTO t1 VALUES (1,1,1);
ERROR 23000: Duplicate entry '1' for key 1
INSERT INTO t1 VALUES
INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
ERROR 23000:
Duplicate entry '10' for key 1
ERROR 23000:
Can't write; duplicate key in table 't1'
select count(*) from t1;
select count(*) from t1;
count(*)
count(*)
2000
2000
...
@@ -437,7 +439,7 @@ begin;
...
@@ -437,7 +439,7 @@ begin;
INSERT INTO t1 VALUES
INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
ERROR 23000:
Duplicate entry '10' for key 1
ERROR 23000:
Can't write; duplicate key in table 't1'
commit;
commit;
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
select * from t1 where pk1=1;
select * from t1 where pk1=1;
...
@@ -456,7 +458,7 @@ begin;
...
@@ -456,7 +458,7 @@ begin;
INSERT INTO t1 VALUES
INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
ERROR 23000:
Duplicate entry '10' for key 1
ERROR 23000:
Can't write; duplicate key in table 't1'
rollback;
rollback;
select * from t1 where pk1=1;
select * from t1 where pk1=1;
pk1 b c
pk1 b c
...
@@ -474,7 +476,7 @@ begin;
...
@@ -474,7 +476,7 @@ begin;
INSERT INTO t1 VALUES
INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
ERROR 23000:
Duplicate entry '10' for key 1
ERROR 23000:
Can't write; duplicate key in table 't1'
SELECT * FROM t1 WHERE pk1=10;
SELECT * FROM t1 WHERE pk1=10;
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
rollback;
rollback;
...
@@ -494,7 +496,7 @@ begin;
...
@@ -494,7 +496,7 @@ begin;
INSERT INTO t1 VALUES
INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
ERROR 23000:
Duplicate entry '10' for key 1
ERROR 23000:
Can't write; duplicate key in table 't1'
SELECT * FROM t1 WHERE pk1=10;
SELECT * FROM t1 WHERE pk1=10;
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
SELECT * FROM t1 WHERE pk1=10;
SELECT * FROM t1 WHERE pk1=10;
...
@@ -517,7 +519,7 @@ begin;
...
@@ -517,7 +519,7 @@ begin;
INSERT INTO t1 VALUES
INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
ERROR 23000:
Duplicate entry '10' for key 1
ERROR 23000:
Can't write; duplicate key in table 't1'
INSERT INTO t1 values (4000, 40, 44);
INSERT INTO t1 values (4000, 40, 44);
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
rollback;
rollback;
...
@@ -534,7 +536,7 @@ select count(*) from t1;
...
@@ -534,7 +536,7 @@ select count(*) from t1;
count(*)
count(*)
2000
2000
insert into t1 select * from t1 where b < 10 order by pk1;
insert into t1 select * from t1 where b < 10 order by pk1;
ERROR 23000:
Duplicate entry '9' for key 1
ERROR 23000:
Can't write; duplicate key in table 't1'
DELETE FROM t1 WHERE pk1=2;
DELETE FROM t1 WHERE pk1=2;
begin;
begin;
INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
...
...
mysql-test/t/ndb_insert.test
View file @
4467b464
...
@@ -434,6 +434,9 @@ SELECT COUNT(*) FROM t1;
...
@@ -434,6 +434,9 @@ SELECT COUNT(*) FROM t1;
# Insert duplicate rows
# Insert duplicate rows
#
#
--
error
1062
--
error
1062
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
);
--
error
1022
INSERT
INTO
t1
VALUES
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
),(
2
,
2
,
2
),(
3
,
3
,
3
),(
4
,
4
,
4
),(
5
,
5
,
5
),
(
1
,
1
,
1
),(
2
,
2
,
2
),(
3
,
3
,
3
),(
4
,
4
,
4
),(
5
,
5
,
5
),
(
6
,
6
,
6
),(
7
,
7
,
7
),(
8
,
8
,
8
),(
9
,
9
,
9
),(
10
,
10
,
10
);
(
6
,
6
,
6
),(
7
,
7
,
7
),(
8
,
8
,
8
),(
9
,
9
,
9
),(
10
,
10
,
10
);
...
@@ -457,7 +460,7 @@ rollback;
...
@@ -457,7 +460,7 @@ rollback;
#
#
begin
;
begin
;
--
error
10
6
2
--
error
10
2
2
INSERT
INTO
t1
VALUES
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
),(
2
,
2
,
2
),(
3
,
3
,
3
),(
4
,
4
,
4
),(
5
,
5
,
5
),
(
1
,
1
,
1
),(
2
,
2
,
2
),(
3
,
3
,
3
),(
4
,
4
,
4
),(
5
,
5
,
5
),
(
6
,
6
,
6
),(
7
,
7
,
7
),(
8
,
8
,
8
),(
9
,
9
,
9
),(
10
,
10
,
10
);
(
6
,
6
,
6
),(
7
,
7
,
7
),(
8
,
8
,
8
),(
9
,
9
,
9
),(
10
,
10
,
10
);
...
@@ -477,7 +480,7 @@ select count(*) from t1;
...
@@ -477,7 +480,7 @@ select count(*) from t1;
#
#
begin
;
begin
;
--
error
10
6
2
--
error
10
2
2
INSERT
INTO
t1
VALUES
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
),(
2
,
2
,
2
),(
3
,
3
,
3
),(
4
,
4
,
4
),(
5
,
5
,
5
),
(
1
,
1
,
1
),(
2
,
2
,
2
),(
3
,
3
,
3
),(
4
,
4
,
4
),(
5
,
5
,
5
),
(
6
,
6
,
6
),(
7
,
7
,
7
),(
8
,
8
,
8
),(
9
,
9
,
9
),(
10
,
10
,
10
);
(
6
,
6
,
6
),(
7
,
7
,
7
),(
8
,
8
,
8
),(
9
,
9
,
9
),(
10
,
10
,
10
);
...
@@ -496,7 +499,7 @@ select count(*) from t1;
...
@@ -496,7 +499,7 @@ select count(*) from t1;
#
#
begin
;
begin
;
--
error
10
6
2
--
error
10
2
2
INSERT
INTO
t1
VALUES
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
),(
2
,
2
,
2
),(
3
,
3
,
3
),(
4
,
4
,
4
),(
5
,
5
,
5
),
(
1
,
1
,
1
),(
2
,
2
,
2
),(
3
,
3
,
3
),(
4
,
4
,
4
),(
5
,
5
,
5
),
(
6
,
6
,
6
),(
7
,
7
,
7
),(
8
,
8
,
8
),(
9
,
9
,
9
),(
10
,
10
,
10
);
(
6
,
6
,
6
),(
7
,
7
,
7
),(
8
,
8
,
8
),(
9
,
9
,
9
),(
10
,
10
,
10
);
...
@@ -517,7 +520,7 @@ select count(*) from t1;
...
@@ -517,7 +520,7 @@ select count(*) from t1;
#
#
begin
;
begin
;
--
error
10
6
2
--
error
10
2
2
INSERT
INTO
t1
VALUES
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
),(
2
,
2
,
2
),(
3
,
3
,
3
),(
4
,
4
,
4
),(
5
,
5
,
5
),
(
1
,
1
,
1
),(
2
,
2
,
2
),(
3
,
3
,
3
),(
4
,
4
,
4
),(
5
,
5
,
5
),
(
6
,
6
,
6
),(
7
,
7
,
7
),(
8
,
8
,
8
),(
9
,
9
,
9
),(
10
,
10
,
10
);
(
6
,
6
,
6
),(
7
,
7
,
7
),(
8
,
8
,
8
),(
9
,
9
,
9
),(
10
,
10
,
10
);
...
@@ -543,7 +546,7 @@ select count(*) from t1;
...
@@ -543,7 +546,7 @@ select count(*) from t1;
#
#
begin
;
begin
;
--
error
10
6
2
--
error
10
2
2
INSERT
INTO
t1
VALUES
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
),(
2
,
2
,
2
),(
3
,
3
,
3
),(
4
,
4
,
4
),(
5
,
5
,
5
),
(
1
,
1
,
1
),(
2
,
2
,
2
),(
3
,
3
,
3
),(
4
,
4
,
4
),(
5
,
5
,
5
),
(
6
,
6
,
6
),(
7
,
7
,
7
),(
8
,
8
,
8
),(
9
,
9
,
9
),(
10
,
10
,
10
);
(
6
,
6
,
6
),(
7
,
7
,
7
),(
8
,
8
,
8
),(
9
,
9
,
9
),(
10
,
10
,
10
);
...
@@ -562,7 +565,7 @@ select count(*) from t1;
...
@@ -562,7 +565,7 @@ select count(*) from t1;
# Insert duplicate rows using "insert .. select"
# Insert duplicate rows using "insert .. select"
#
#
--
error
10
6
2
--
error
10
2
2
insert
into
t1
select
*
from
t1
where
b
<
10
order
by
pk1
;
insert
into
t1
select
*
from
t1
where
b
<
10
order
by
pk1
;
DELETE
FROM
t1
WHERE
pk1
=
2
;
DELETE
FROM
t1
WHERE
pk1
=
2
;
...
...
sql/ha_ndbcluster.cc
View file @
4467b464
...
@@ -511,8 +511,13 @@ int ha_ndbcluster::ndb_err(NdbTransaction *trans)
...
@@ -511,8 +511,13 @@ int ha_ndbcluster::ndb_err(NdbTransaction *trans)
DBUG_PRINT
(
"info"
,
(
"transformed ndbcluster error %d to mysql error %d"
,
DBUG_PRINT
(
"info"
,
(
"transformed ndbcluster error %d to mysql error %d"
,
err
.
code
,
res
));
err
.
code
,
res
));
if
(
res
==
HA_ERR_FOUND_DUPP_KEY
)
if
(
res
==
HA_ERR_FOUND_DUPP_KEY
)
{
if
(
m_rows_to_insert
==
1
)
m_dupkey
=
table
->
s
->
primary_key
;
m_dupkey
=
table
->
s
->
primary_key
;
else
// We are batching inserts, offending key is not available
m_dupkey
=
(
uint
)
-
1
;
}
DBUG_RETURN
(
res
);
DBUG_RETURN
(
res
);
}
}
...
@@ -3119,6 +3124,13 @@ double ha_ndbcluster::scan_time()
...
@@ -3119,6 +3124,13 @@ double ha_ndbcluster::scan_time()
DBUG_RETURN
(
res
);
DBUG_RETURN
(
res
);
}
}
/*
Convert MySQL table locks into locks supported by Ndb Cluster.
Note that MySQL Cluster does currently not support distributed
table locks, so to be safe one should set cluster in Single
User Mode, before relying on table locks when updating tables
from several MySQL servers
*/
THR_LOCK_DATA
**
ha_ndbcluster
::
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
ha_ndbcluster
::
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
THR_LOCK_DATA
**
to
,
...
@@ -3134,7 +3146,7 @@ THR_LOCK_DATA **ha_ndbcluster::store_lock(THD *thd,
...
@@ -3134,7 +3146,7 @@ THR_LOCK_DATA **ha_ndbcluster::store_lock(THD *thd,
/* Since NDB does not currently have table locks
/* Since NDB does not currently have table locks
this is treated as a ordinary lock */
this is treated as a ordinary lock */
if
((
lock_type
>=
TL_WRITE_
ALLOW_WRITE
&&
if
((
lock_type
>=
TL_WRITE_
CONCURRENT_INSERT
&&
lock_type
<=
TL_WRITE
)
&&
!
thd
->
in_lock_tables
)
lock_type
<=
TL_WRITE
)
&&
!
thd
->
in_lock_tables
)
lock_type
=
TL_WRITE_ALLOW_WRITE
;
lock_type
=
TL_WRITE_ALLOW_WRITE
;
...
...
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