Skip to content

Commit b78fc42

Browse files
committed
Bug#21465626: assert/crash on dropping/adding virtual column
Post-push fix: Rewrite conditional operators as if statements as a work-around for a linker bug. Also fix duplicate values for two Alter_inplace_info flags.
1 parent 053aef8 commit b78fc42

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

sql/handler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ class Alter_inplace_info
12131213
static const HA_ALTER_FLAGS ALTER_INDEX_COMMENT = 1ULL << 36;
12141214

12151215
// Upgrade partitioning
1216-
static const HA_ALTER_FLAGS ALTER_UPGRADE_PARTITIONING = 1ULL << 34;
1216+
static const HA_ALTER_FLAGS ALTER_UPGRADE_PARTITIONING = 1ULL << 37;
12171217

12181218
/**
12191219
Create options (like MAX_ROWS) for the new version of table.

sql/sql_table.cc

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6331,10 +6331,12 @@ static bool fill_alter_inplace_info(THD *thd,
63316331
{
63326332
case IS_EQUAL_NO:
63336333
/* New column type is incompatible with old one. */
6334-
ha_alter_info->handler_flags|=
6335-
field->is_virtual_gcol() ?
6336-
Alter_inplace_info::ALTER_VIRTUAL_COLUMN_TYPE :
6337-
Alter_inplace_info::ALTER_STORED_COLUMN_TYPE;
6334+
if (field->is_virtual_gcol())
6335+
ha_alter_info->handler_flags|=
6336+
Alter_inplace_info::ALTER_VIRTUAL_COLUMN_TYPE;
6337+
else
6338+
ha_alter_info->handler_flags|=
6339+
Alter_inplace_info::ALTER_STORED_COLUMN_TYPE;
63386340
break;
63396341
case IS_EQUAL_YES:
63406342
/*
@@ -6429,10 +6431,12 @@ static bool fill_alter_inplace_info(THD *thd,
64296431
Field is not present in new version of table and therefore was dropped.
64306432
*/
64316433
DBUG_ASSERT(alter_info->flags & Alter_info::ALTER_DROP_COLUMN);
6432-
ha_alter_info->handler_flags|=
6433-
field->is_virtual_gcol() ?
6434-
Alter_inplace_info::DROP_VIRTUAL_COLUMN :
6435-
Alter_inplace_info::DROP_STORED_COLUMN;
6434+
if (field->is_virtual_gcol())
6435+
ha_alter_info->handler_flags|=
6436+
Alter_inplace_info::DROP_VIRTUAL_COLUMN;
6437+
else
6438+
ha_alter_info->handler_flags|=
6439+
Alter_inplace_info::DROP_STORED_COLUMN;
64366440
field->flags|= FIELD_IS_DROPPED;
64376441
}
64386442
if (field->stored_in_db)
@@ -6449,10 +6453,12 @@ static bool fill_alter_inplace_info(THD *thd,
64496453
/*
64506454
Field is not present in old version of table and therefore was added.
64516455
*/
6452-
ha_alter_info->handler_flags|=
6453-
new_field->is_virtual_gcol() ?
6454-
Alter_inplace_info::ADD_VIRTUAL_COLUMN :
6455-
Alter_inplace_info::ADD_STORED_COLUMN;
6456+
if (new_field->is_virtual_gcol())
6457+
ha_alter_info->handler_flags|=
6458+
Alter_inplace_info::ADD_VIRTUAL_COLUMN;
6459+
else
6460+
ha_alter_info->handler_flags|=
6461+
Alter_inplace_info::ADD_STORED_COLUMN;
64566462
}
64576463
}
64586464
/* One of these should be set since Alter_info::ALTER_ADD_COLUMN was set. */

0 commit comments

Comments
 (0)