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
cf7d4dad
Commit
cf7d4dad
authored
Nov 24, 2010
by
Sunny Bains
Browse files
Options
Browse Files
Download
Plain Diff
Merge from mysql-5.1-innodb to mysql-5.5-innodb. Test was adjusted.
parents
4a738c81
50bed382
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
11 deletions
+65
-11
mysql-test/suite/innodb/r/innodb-autoinc-18274.result
mysql-test/suite/innodb/r/innodb-autoinc-18274.result
+26
-0
mysql-test/suite/innodb/t/innodb-autoinc-18274.test
mysql-test/suite/innodb/t/innodb-autoinc-18274.test
+26
-0
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+13
-11
No files found.
mysql-test/suite/innodb/r/innodb-autoinc-18274.result
0 → 100644
View file @
cf7d4dad
drop table if exists t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
DELETE FROM t1;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
c1
2
DROP TABLE t1;
mysql-test/suite/innodb/t/innodb-autoinc-18274.test
0 → 100644
View file @
cf7d4dad
--
source
include
/
have_innodb
.
inc
# embedded server ignores 'delayed', so skip this
--
source
include
/
not_embedded
.
inc
--
disable_warnings
drop
table
if
exists
t1
;
--
enable_warnings
#
# Bug #18274 InnoDB auto_increment field reset on OPTIMIZE TABLE
SET
@@
SESSION
.
AUTO_INCREMENT_INCREMENT
=
1
,
@@
SESSION
.
AUTO_INCREMENT_OFFSET
=
1
;
CREATE
TABLE
t1
(
c1
INT
PRIMARY
KEY
AUTO_INCREMENT
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
null
);
SHOW
CREATE
TABLE
t1
;
DELETE
FROM
t1
;
OPTIMIZE
TABLE
t1
;
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
null
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
#
# restore environment to the state it was before this test execution
#
--
disable_query_log
storage/innobase/handler/ha_innodb.cc
View file @
cf7d4dad
...
@@ -7036,23 +7036,25 @@ ha_innobase::create(
...
@@ -7036,23 +7036,25 @@ ha_innobase::create(
setup at this stage and so we use thd. */
setup at this stage and so we use thd. */
/* We need to copy the AUTOINC value from the old table if
/* We need to copy the AUTOINC value from the old table if
this is an ALTER TABLE or CREATE INDEX because CREATE INDEX
this is an ALTER|OPTIMIZE TABLE or CREATE INDEX because CREATE INDEX
does a table copy too. */
does a table copy too. If query was one of :
CREATE TABLE ...AUTO_INCREMENT = x; or
ALTER TABLE...AUTO_INCREMENT = x; or
OPTIMIZE TABLE t; or
CREATE INDEX x on t(...);
Find out a table definition from the dictionary and get
the current value of the auto increment field. Set a new
value to the auto increment field if the value is greater
than the maximum value in the column. */
if
(((
create_info
->
used_fields
&
HA_CREATE_USED_AUTO
)
if
(((
create_info
->
used_fields
&
HA_CREATE_USED_AUTO
)
||
thd_sql_command
(
thd
)
==
SQLCOM_ALTER_TABLE
||
thd_sql_command
(
thd
)
==
SQLCOM_ALTER_TABLE
||
thd_sql_command
(
thd
)
==
SQLCOM_OPTIMIZE
||
thd_sql_command
(
thd
)
==
SQLCOM_CREATE_INDEX
)
||
thd_sql_command
(
thd
)
==
SQLCOM_CREATE_INDEX
)
&&
create_info
->
auto_increment_value
>
0
)
{
&&
create_info
->
auto_increment_value
>
0
)
{
/* Query was one of :
CREATE TABLE ...AUTO_INCREMENT = x; or
ALTER TABLE...AUTO_INCREMENT = x; or
CREATE INDEX x on t(...);
Find out a table definition from the dictionary and get
the current value of the auto increment field. Set a new
value to the auto increment field if the value is greater
than the maximum value in the column. */
auto_inc_value
=
create_info
->
auto_increment_value
;
auto_inc_value
=
create_info
->
auto_increment_value
;
dict_table_autoinc_lock
(
innobase_table
);
dict_table_autoinc_lock
(
innobase_table
);
...
...
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