Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip first state change of EXCHANGE Partition. (#7945) #8100

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions dbms/src/TiDB/Schema/SchemaBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,24 @@ void SchemaBuilder<Getter, NameMapper>::applyRenamePhysicalTable(
template <typename Getter, typename NameMapper>
void SchemaBuilder<Getter, NameMapper>::applyExchangeTablePartition(const SchemaDiff & diff)
{
if (diff.old_table_id == diff.table_id && diff.old_schema_id == diff.schema_id)
{
// Only internal changes in non-partitioned table, not affecting TiFlash
LOG_DEBUG(
log,
"Table is going to be exchanged, skipping for now. database_id={} table_id={}",
diff.schema_id,
diff.table_id);
return;
}
LOG_DEBUG(
log,
"Table and partition is exchanged. database_id={} table_id={}, part_db_id={}, part_table_id={} partition_id={}",
diff.old_schema_id,
diff.old_table_id,
diff.affected_opts[0].schema_id,
diff.affected_opts[0].table_id,
diff.table_id);
/// Exchange table partition is used for ddl:
/// alter table partition_table exchange partition partition_name with table non_partition_table
/// It involves three table/partition: partition_table, partition_name and non_partition_table
Expand Down
2 changes: 1 addition & 1 deletion tests/_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fi
export storage_server="127.0.0.1"

# Server port for connecting
export storage_port="9000"
export storage_port=${storage_port:-9000}

# Default database for scripts
export storage_db="system"
Expand Down