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
cc8772f3
Commit
cc8772f3
authored
Jun 26, 2018
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
MDEV-15953 Alter InnoDB Partitioned Table ignores pre-existing DATA DIRECTORY attribute
parents
28e1f145
ff8b3c8d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
123 additions
and
0 deletions
+123
-0
mysql-test/suite/parts/r/alter_data_directory_innodb.result
mysql-test/suite/parts/r/alter_data_directory_innodb.result
+65
-0
mysql-test/suite/parts/t/alter_data_directory_innodb.test
mysql-test/suite/parts/t/alter_data_directory_innodb.test
+46
-0
storage/innobase/handler/handler0alter.cc
storage/innobase/handler/handler0alter.cc
+6
-0
storage/xtradb/handler/handler0alter.cc
storage/xtradb/handler/handler0alter.cc
+6
-0
No files found.
mysql-test/suite/parts/r/alter_data_directory_innodb.result
0 → 100644
View file @
cc8772f3
#
# MDEV-15953 Alter InnoDB Partitioned Table Moves Files (which were originally not in the datadir) to the datadir
#
CREATE TABLE t (
a INT NOT NULL
) ENGINE=INNODB
PARTITION BY HASH (a) (
PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here/' ENGINE = INNODB,
PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here/' ENGINE = INNODB
);
INSERT INTO t VALUES (1);
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (a)
(PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB,
PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) */
ALTER TABLE t ADD PRIMARY KEY pk(a), ALGORITHM=INPLACE;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (a)
(PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB,
PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) */
ALTER TABLE t DROP PRIMARY KEY, ALGORITHM=COPY;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (a)
(PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB,
PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) */
SET @TMP = @@GLOBAL.INNODB_FILE_PER_TABLE;
SET GLOBAL INNODB_FILE_PER_TABLE=OFF;
ALTER TABLE t ADD PRIMARY KEY pk(a), ALGORITHM=INPLACE;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (a)
(PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB,
PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) */
SET GLOBAL INNODB_FILE_PER_TABLE=@TMP;
ALTER TABLE t REORGANIZE PARTITION p1,p2 INTO (
PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB,
PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB
);
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (a)
(PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB,
PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) */
DROP TABLE t;
mysql-test/suite/parts/t/alter_data_directory_innodb.test
0 → 100644
View file @
cc8772f3
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_partition
.
inc
--
echo
#
--
echo
# MDEV-15953 Alter InnoDB Partitioned Table Moves Files (which were originally not in the datadir) to the datadir
--
echo
#
mkdir
$MYSQLTEST_VARDIR
/
tmp
/
partitions_here
;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
eval
CREATE
TABLE
t
(
a
INT
NOT
NULL
)
ENGINE
=
INNODB
PARTITION
BY
HASH
(
a
)
(
PARTITION
p1
DATA
DIRECTORY
=
'$MYSQLTEST_VARDIR/tmp/partitions_here/'
ENGINE
=
INNODB
,
PARTITION
p2
DATA
DIRECTORY
=
'$MYSQLTEST_VARDIR/tmp/partitions_here/'
ENGINE
=
INNODB
);
INSERT
INTO
t
VALUES
(
1
);
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
SHOW
CREATE
TABLE
t
;
ALTER
TABLE
t
ADD
PRIMARY
KEY
pk
(
a
),
ALGORITHM
=
INPLACE
;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
SHOW
CREATE
TABLE
t
;
ALTER
TABLE
t
DROP
PRIMARY
KEY
,
ALGORITHM
=
COPY
;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
SHOW
CREATE
TABLE
t
;
SET
@
TMP
=
@@
GLOBAL
.
INNODB_FILE_PER_TABLE
;
SET
GLOBAL
INNODB_FILE_PER_TABLE
=
OFF
;
ALTER
TABLE
t
ADD
PRIMARY
KEY
pk
(
a
),
ALGORITHM
=
INPLACE
;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
SHOW
CREATE
TABLE
t
;
SET
GLOBAL
INNODB_FILE_PER_TABLE
=@
TMP
;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
eval
ALTER
TABLE
t
REORGANIZE
PARTITION
p1
,
p2
INTO
(
PARTITION
p1
DATA
DIRECTORY
=
'$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/'
ENGINE
=
INNODB
,
PARTITION
p2
DATA
DIRECTORY
=
'$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/'
ENGINE
=
INNODB
);
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
SHOW
CREATE
TABLE
t
;
DROP
TABLE
t
;
rmdir
$MYSQLTEST_VARDIR
/
tmp
/
partitions_here
/
test
;
rmdir
$MYSQLTEST_VARDIR
/
tmp
/
partitions_here
;
storage/innobase/handler/handler0alter.cc
View file @
cc8772f3
...
...
@@ -3572,6 +3572,12 @@ ha_innobase::prepare_inplace_alter_table(
goto
err_exit_no_heap
;
}
/* Preserve this flag, because it currenlty can't be changed during
ALTER TABLE*/
if
(
flags2
&
DICT_TF2_USE_TABLESPACE
)
{
flags
|=
prebuilt
->
table
->
flags
&
1U
<<
DICT_TF_POS_DATA_DIR
;
}
max_col_len
=
DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG
(
flags
);
/* Check each index's column length to make sure they do not
...
...
storage/xtradb/handler/handler0alter.cc
View file @
cc8772f3
...
...
@@ -3586,6 +3586,12 @@ ha_innobase::prepare_inplace_alter_table(
goto
err_exit_no_heap
;
}
/* Preserve this flag, because it currenlty can't be changed during
ALTER TABLE*/
if
(
flags2
&
DICT_TF2_USE_TABLESPACE
)
{
flags
|=
prebuilt
->
table
->
flags
&
1U
<<
DICT_TF_POS_DATA_DIR
;
}
max_col_len
=
DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG
(
flags
);
/* Check each index's column length to make sure they do not
...
...
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