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
876ab037
Commit
876ab037
authored
Oct 18, 2018
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable instant ADD/DROP/reorder if indexed virtual columns exist
This works around a crash in purge.
parent
83afd52e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
0 deletions
+32
-0
mysql-test/suite/gcol/r/innodb_virtual_rebuild.result
mysql-test/suite/gcol/r/innodb_virtual_rebuild.result
+8
-0
mysql-test/suite/gcol/t/innodb_virtual_rebuild.test
mysql-test/suite/gcol/t/innodb_virtual_rebuild.test
+3
-0
storage/innobase/handler/handler0alter.cc
storage/innobase/handler/handler0alter.cc
+21
-0
No files found.
mysql-test/suite/gcol/r/innodb_virtual_rebuild.result
View file @
876ab037
...
...
@@ -7,22 +7,30 @@ ROW_FORMAT=REDUNDANT;
INSERT INTO t4 SET i=1;
ALTER TABLE t4 ADD INDEX(v), LOCK=NONE;
ALTER TABLE t4 ADD COLUMN k INT, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t4 DROP k, LOCK=NONE;
ERROR 42000: Can't DROP COLUMN `k`; check that it exists
ALTER TABLE t4 DROP INDEX v, LOCK=NONE;
INSERT INTO t3 SET i=1;
ALTER TABLE t3 ADD INDEX(v), LOCK=NONE;
ALTER TABLE t3 ADD COLUMN k INT, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t3 DROP k, LOCK=NONE;
ERROR 42000: Can't DROP COLUMN `k`; check that it exists
ALTER TABLE t3 DROP INDEX v, LOCK=NONE;
INSERT INTO t2 SET i=1;
ALTER TABLE t2 ADD INDEX(v), LOCK=NONE;
ALTER TABLE t2 ADD COLUMN k INT, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t2 DROP k, LOCK=NONE;
ERROR 42000: Can't DROP COLUMN `k`; check that it exists
ALTER TABLE t2 DROP INDEX v, LOCK=NONE;
INSERT INTO t1 SET i=1;
ALTER TABLE t1 ADD INDEX(v), LOCK=NONE;
ALTER TABLE t1 ADD COLUMN k INT, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t1 DROP k, LOCK=NONE;
ERROR 42000: Can't DROP COLUMN `k`; check that it exists
ALTER TABLE t1 DROP INDEX v, LOCK=NONE;
connect ddl,localhost,root,,test;
connection default;
...
...
mysql-test/suite/gcol/t/innodb_virtual_rebuild.test
View file @
876ab037
...
...
@@ -14,7 +14,10 @@ while ($n)
{
eval
INSERT
INTO
t
$n
SET
i
=
1
;
eval
ALTER
TABLE
t
$n
ADD
INDEX
(
v
),
LOCK
=
NONE
;
# MDEV-17468 FIXME: Fix this, and remove the 2 --error below.
--
error
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
eval
ALTER
TABLE
t
$n
ADD
COLUMN
k
INT
,
LOCK
=
NONE
;
--
error
ER_CANT_DROP_FIELD_OR_KEY
eval
ALTER
TABLE
t
$n
DROP
k
,
LOCK
=
NONE
;
eval
ALTER
TABLE
t
$n
DROP
INDEX
v
,
LOCK
=
NONE
;
dec
$n
;
...
...
storage/innobase/handler/handler0alter.cc
View file @
876ab037
...
...
@@ -1059,6 +1059,21 @@ innobase_fts_check_doc_id_col(
return
(
false
);
}
#if 1 // MDEV-17468: fix bugs with indexed virtual columns & remove this
static
bool
has_virtual_index
(
const
dict_table_t
&
table
)
{
const
dict_index_t
*
index
=
table
.
indexes
.
start
;
ut_ad
(
!
index
->
has_virtual
());
while
((
index
=
index
->
indexes
.
next
)
!=
NULL
)
{
if
(
index
->
has_virtual
())
{
ut_ad
(
table
.
n_v_cols
);
return
true
;
}
}
return
false
;
}
#endif
/** Check if InnoDB supports a particular alter table in-place
@param altered_table TABLE object for new version of table.
@param ha_alter_info Structure describing changes to be done
...
...
@@ -1240,6 +1255,9 @@ ha_innobase::check_if_supported_inplace_alter(
const
bool
supports_instant
=
m_prebuilt
->
table
->
supports_instant
()
&&
instant_alter_column_possible
(
ha_alter_info
,
table
)
#if 1 // MDEV-17468: fix bugs with indexed virtual columns & remove this
&&
!
has_virtual_index
(
*
m_prebuilt
->
table
)
#endif
#if 1 // MDEV-17459: adjust fts_fetch_doc_from_rec() and friends; remove this
&&
!
m_prebuilt
->
table
->
fts
&&
!
innobase_fulltext_exist
(
altered_table
)
...
...
@@ -5700,6 +5718,9 @@ prepare_inplace_alter_table_dict(
if
(
ctx
->
need_rebuild
()
&&
user_table
->
supports_instant
()
&&
instant_alter_column_possible
(
ha_alter_info
,
old_table
)
#if 1 // MDEV-17468: fix bugs with indexed virtual columns & remove this
&&
!
has_virtual_index
(
*
user_table
)
#endif
#if 1 // MDEV-17459: adjust fts_fetch_doc_from_rec() and friends; remove this
&&
!
user_table
->
fts
&&
!
innobase_fulltext_exist
(
altered_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