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

Merged
merged 6 commits into from
Aug 22, 2023
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 @@ -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