Skip to content

Commit

Permalink
Skip first state change of EXCHANGE Partition. (#7945)
Browse files Browse the repository at this point in the history
close #7941
  • Loading branch information
mjonss authored Aug 22, 2023
1 parent bccc345 commit b1f1dbc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
18 changes: 18 additions & 0 deletions dbms/src/TiDB/Schema/SchemaBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,24 @@ void SchemaBuilder<Getter, NameMapper>::applyCreateTable(DatabaseID database_id,
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);
/// Table_id in diff is the partition id of which will be exchanged,
/// Schema_id in diff is the non-partition table's schema id
/// Old_table_id in diff is the non-partition table's table id
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
2 changes: 0 additions & 2 deletions tests/fullstack-test2/ddl/alter_exchange_partition.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# enable this test after https://github.com/pingcap/tiflash/issues/7941 is fixed
#RETURN

>> DBGInvoke __enable_schema_sync_service('true')
mysql> drop table if exists test.e;
Expand Down

0 comments on commit b1f1dbc

Please sign in to comment.