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
c8bc16ac
Commit
c8bc16ac
authored
Oct 12, 2009
by
sunny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branches/5.1: Reset the statement level autoinc counter on ROLLBACK. Fix
the test results too.
rb://164
parent
6bd8f661
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
handler/ha_innodb.cc
handler/ha_innodb.cc
+2
-0
mysql-test/innodb-autoinc.result
mysql-test/innodb-autoinc.result
+10
-3
mysql-test/innodb-autoinc.test
mysql-test/innodb-autoinc.test
+3
-1
No files found.
handler/ha_innodb.cc
View file @
c8bc16ac
...
@@ -2123,6 +2123,8 @@ innobase_rollback(
...
@@ -2123,6 +2123,8 @@ innobase_rollback(
innobase_release_stat_resources
(
trx
);
innobase_release_stat_resources
(
trx
);
trx
->
n_autoinc_rows
=
0
;
/* Reset the number AUTO-INC rows required */
/* If we had reserved the auto-inc lock for some table (if
/* If we had reserved the auto-inc lock for some table (if
we come here to roll back the latest SQL statement) we
we come here to roll back the latest SQL statement) we
release it now before a possibly lengthy rollback */
release it now before a possibly lengthy rollback */
...
...
mysql-test/innodb-autoinc.result
View file @
c8bc16ac
...
@@ -867,6 +867,7 @@ INSERT INTO t2 SELECT NULL FROM t1;
...
@@ -867,6 +867,7 @@ INSERT INTO t2 SELECT NULL FROM t1;
Got one of the listed errors
Got one of the listed errors
DROP TABLE t1;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t2;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
...
@@ -874,20 +875,26 @@ ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
...
@@ -874,20 +875,26 @@ ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
SELECT * FROM t1;
SELECT * FROM t1;
d1
d1
1
1
3
2
SELECT * FROM t1;
SELECT * FROM t1;
d1
d1
1
1
3
2
INSERT INTO t1 VALUES(null);
INSERT INTO t1 VALUES(null);
ALTER TABLE t1 AUTO_INCREMENT = 3;
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`d1`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(null);
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
SELECT * FROM t1;
d1
d1
1
1
2
3
3
4
4
5
DROP TABLE t1;
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "%auto_inc%";
...
...
mysql-test/innodb-autoinc.test
View file @
c8bc16ac
...
@@ -482,6 +482,7 @@ DROP TABLE t2;
...
@@ -482,6 +482,7 @@ DROP TABLE t2;
# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
# the index (PRIMARY)
# the index (PRIMARY)
# This test requires a restart of the server
# This test requires a restart of the server
SET
@@
SESSION
.
AUTO_INCREMENT_INCREMENT
=
1
,
@@
SESSION
.
AUTO_INCREMENT_OFFSET
=
1
;
CREATE
TABLE
t1
(
c1
INT
PRIMARY
KEY
AUTO_INCREMENT
)
ENGINE
=
InnoDB
;
CREATE
TABLE
t1
(
c1
INT
PRIMARY
KEY
AUTO_INCREMENT
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
null
);
INSERT
INTO
t1
VALUES
(
null
);
INSERT
INTO
t1
VALUES
(
null
);
INSERT
INTO
t1
VALUES
(
null
);
...
@@ -496,9 +497,10 @@ SELECT * FROM t1;
...
@@ -496,9 +497,10 @@ SELECT * FROM t1;
# longer results in the two data dictionaries being out of sync. If they
# longer results in the two data dictionaries being out of sync. If they
# revert their changes then this check for ER_AUTOINC_READ_FAILED will need
# revert their changes then this check for ER_AUTOINC_READ_FAILED will need
# to be enabled.
# to be enabled.
#
-- error ER_AUTOINC_READ_FAILED,1467
#-- error ER_AUTOINC_READ_FAILED,1467
INSERT
INTO
t1
VALUES
(
null
);
INSERT
INTO
t1
VALUES
(
null
);
ALTER
TABLE
t1
AUTO_INCREMENT
=
3
;
ALTER
TABLE
t1
AUTO_INCREMENT
=
3
;
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
null
);
INSERT
INTO
t1
VALUES
(
null
);
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
...
...
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