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
eb06bee5
Commit
eb06bee5
authored
Nov 29, 2007
by
gni@dev3-221.dev.cn.tlan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG#30417 Cluster misbehaves on auto-inc w/o PK.
parent
3f3be4f3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
15 deletions
+97
-15
mysql-test/suite/ndb/r/ndb_autoinc.result
mysql-test/suite/ndb/r/ndb_autoinc.result
+38
-0
mysql-test/suite/ndb/t/ndb_autoinc.test
mysql-test/suite/ndb/t/ndb_autoinc.test
+43
-0
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+16
-15
No files found.
mysql-test/suite/ndb/r/ndb_autoinc.result
0 → 100644
View file @
eb06bee5
DROP TABLE IF EXISTS t1,t2,t3;
USE test;
CREATE TABLE t1 (
id INT AUTO_INCREMENT,
PRIMARY KEY(id)
) ENGINE=NDBCLUSTER;
CREATE TABLE t2 (
id INT AUTO_INCREMENT,
KEY(id)
) ENGINE=NDBCLUSTER;
ERROR HY000: Can't create table 'test.t2' (errno: 4335)
SHOW TABLES;
Tables_in_test
t1
CREATE TABLE t3 (
id INT AUTO_INCREMENT,
KEY(id)
) ENGINE=MYISAM;
ALTER TABLE t3
ENGINE NDBCLUSTER;
ERROR HY000: Can't create table 'test.#sql-7b9e_3' (errno: 4335)
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`id` int(11) NOT NULL AUTO_INCREMENT,
KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t3
ADD PRIMARY KEY (id);
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t3;
End of 5.1 tests
mysql-test/suite/ndb/t/ndb_autoinc.test
0 → 100644
View file @
eb06bee5
--
source
include
/
have_ndb
.
inc
--
source
include
/
not_embedded
.
inc
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
,
t2
,
t3
;
--
enable_warnings
USE
test
;
CREATE
TABLE
t1
(
id
INT
AUTO_INCREMENT
,
PRIMARY
KEY
(
id
)
)
ENGINE
=
NDBCLUSTER
;
# Test For bug#30417
--
error
1005
CREATE
TABLE
t2
(
id
INT
AUTO_INCREMENT
,
KEY
(
id
)
)
ENGINE
=
NDBCLUSTER
;
SHOW
TABLES
;
CREATE
TABLE
t3
(
id
INT
AUTO_INCREMENT
,
KEY
(
id
)
)
ENGINE
=
MYISAM
;
--
error
1005
ALTER
TABLE
t3
ENGINE
NDBCLUSTER
;
SHOW
CREATE
TABLE
t3
;
ALTER
TABLE
t3
ADD
PRIMARY
KEY
(
id
);
SHOW
CREATE
TABLE
t3
;
DROP
TABLE
t1
,
t3
;
--
echo
End
of
5.1
tests
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
View file @
eb06bee5
...
...
@@ -2340,6 +2340,22 @@ NdbDictionaryImpl::createTable(NdbTableImpl &t)
{
DBUG_ENTER
(
"NdbDictionaryImpl::createTable"
);
bool
autoIncrement
=
false
;
Uint64
initialValue
=
0
;
for
(
Uint32
i
=
0
;
i
<
t
.
m_columns
.
size
();
i
++
)
{
const
NdbColumnImpl
*
c
=
t
.
m_columns
[
i
];
assert
(
c
!=
NULL
);
if
(
c
->
m_autoIncrement
)
{
if
(
autoIncrement
)
{
m_error
.
code
=
4335
;
DBUG_RETURN
(
-
1
);
}
autoIncrement
=
true
;
initialValue
=
c
->
m_autoIncrementInitialValue
;
}
}
// if the new name has not been set, use the copied name
if
(
t
.
m_newExternalName
.
empty
())
{
...
...
@@ -2377,21 +2393,6 @@ NdbDictionaryImpl::createTable(NdbTableImpl &t)
// auto-increment - use "t" because initial value is not in DICT
{
bool
autoIncrement
=
false
;
Uint64
initialValue
=
0
;
for
(
Uint32
i
=
0
;
i
<
t
.
m_columns
.
size
();
i
++
)
{
const
NdbColumnImpl
*
c
=
t
.
m_columns
[
i
];
assert
(
c
!=
NULL
);
if
(
c
->
m_autoIncrement
)
{
if
(
autoIncrement
)
{
m_error
.
code
=
4335
;
delete
t2
;
DBUG_RETURN
(
-
1
);
}
autoIncrement
=
true
;
initialValue
=
c
->
m_autoIncrementInitialValue
;
}
}
if
(
autoIncrement
)
{
// XXX unlikely race condition - t.m_id may no longer be same table
// the tuple id range is not used on input
...
...
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