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

Table can not be created after ALTER TABLE ... EXCHANGE PARTITION #8372

Closed
JaySon-Huang opened this issue Nov 14, 2023 · 1 comment
Closed
Labels
affects-5.3 affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. component/storage severity/critical type/bug The issue is confirmed as a bug.

Comments

@JaySon-Huang
Copy link
Contributor

JaySon-Huang commented Nov 14, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

# create non-partition table and execute exchagne partition immediately
mysql> create table test.e(id INT NOT NULL,fname VARCHAR(30),lname VARCHAR(30)) PARTITION BY RANGE (id) ( PARTITION p0 VALUES LESS THAN (50),PARTITION p1 VALUES LESS THAN (100),PARTITION p2 VALUES LESS THAN (150), PARTITION p3 VALUES LESS THAN (MAXVALUE));
mysql> insert into test.e values (1, 'a', 'b'),(108, 'a', 'b');
# sync the partition table to tiflash
>> DBGInvoke __refresh_schemas()

mysql> create table test.e2(id int not null,fname varchar(30),lname varchar(30));
mysql> insert into test.e2 values (2, 'a', 'b');
mysql> set @@tidb_enable_exchange_partition=1; alter table test.e exchange partition p0 with table test.e2

2. What did you expect to see? (Required)

TiFlash running normally

3. What did you see instead (Required)

[2023/11/14 23:56:55.896 +08:00] [ERROR] [SchemaSyncService.cpp:63] ["Sync schemas failed by DB::Exception: miss old table id in Flash 450 \n stack : \n  0x559d03425fae\tStackTrace::StackTrace() [tiflash+58630062]\n                \tdbms/src/Common/StackTrace.cpp:23\n  0x559d03417422\tDB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, int) [tiflash+58569762]\n                \tdbms/src/Common/Exception.h:46\n  0x559d0bed1e17\tDB::SchemaBuilder<DB::SchemaGetter, DB::SchemaNameMapper>::applyRenameLogicalTable(std::__1::shared_ptr<TiDB::DBInfo> const&, std::__1::shared_ptr<TiDB::TableInfo> const&, std::__1::shared_ptr<DB::IManageableStorage> const&) [tiflash+204037655]\n                \tdbms/src/TiDB/Schema/SchemaBuilder.cpp:702\n  0x559d0bece80c\tDB::SchemaBuilder<DB::SchemaGetter, DB::SchemaNameMapper>::syncAllSchema() [tiflash+204023820]\n                \tdbms/src/TiDB/Schema/SchemaBuilder.cpp:1336\n  0x559d0bd4df6e\tDB::TiDBSchemaSyncer<false, false>::loadAllSchema(DB::SchemaGetter&, long, DB::Context&) [tiflash+202448750]\n                \tdbms/src/TiDB/Schema/TiDBSchemaSyncer.h:261\n  0x559d0bd4b205\tDB::TiDBSchemaSyncer<false, false>::syncSchemas(DB::Context&) [tiflash+202437125]\n                \tdbms/src/TiDB/Schema/TiDBSchemaSyncer.h:131\n  0x559d0bf1c95a\tDB::SchemaSyncService::syncSchemas() [tiflash+204343642]\n                \tdbms/src/TiDB/Schema/SchemaSyncService.cpp:85\n  0x559d0bf2099a\tDB::SchemaSyncService::SchemaSyncService(DB::Context&)::$_0::operator()() const [tiflash+204360090]\n                \tdbms/src/TiDB/Schema/SchemaSyncService.cpp:52\n  0x559d0bf208c5\tdecltype(std::declval<DB::SchemaSyncService::SchemaSyncService(DB::Context&)::$_0&>()()) std::__1::__invoke[abi:v15001]<DB::SchemaSyncService::SchemaSyncService(DB::Context&)::$_0&>(DB::SchemaSyncService::SchemaSyncService(DB::Context&)::$_0&) [tiflash+204359877]\n                \t/DATA/disk1/ra_common/tiflash-env-15/sysroot/bin/../include/c++/v1/__functional/invoke.h:394\n  0x559d0bf20885\tbool std::__1::__invoke_void_return_wrapper<bool, false>::__call<DB::SchemaSyncService::SchemaSyncService(DB::Context&)::$_0&>(DB::SchemaSyncService::SchemaSyncService(DB::Context&)::$_0&) [tiflash+204359813]\n                \t/DATA/disk1/ra_common/tiflash-env-15/sysroot/bin/../include/c++/v1/__functional/invoke.h:470\n  0x559d0bf2085d\tstd::__1::__function::__alloc_func<DB::SchemaSyncService::SchemaSyncService(DB::Context&)::$_0, std::__1::allocator<DB::SchemaSyncService::SchemaSyncService(DB::Context&)::$_0>, bool ()>::operator()[abi:v15001]() [tiflash+204359773]\n                \t/DATA/disk1/ra_common/tiflash-env-15/sysroot/bin/../include/c++/v1/__functional/function.h:185\n  0x559d0bf1fc59\tstd::__1::__function::__func<DB::SchemaSyncService::SchemaSyncService(DB::Context&)::$_0, std::__1::allocator<DB::SchemaSyncService::SchemaSyncService(DB::Context&)::$_0>, bool ()>::operator()() [tiflash+204356697]\n                \t/DATA/disk1/ra_common/tiflash-env-15/sysroot/bin/../include/c++/v1/__functional/function.h:359\n  0x559d0ac82e72\tstd::__1::__function::__value_func<bool ()>::operator()[abi:v15001]() const [tiflash+184839794]\n                \t/DATA/disk1/ra_common/tiflash-env-15/sysroot/bin/../include/c++/v1/__functional/function.h:512\n  0x559d0ac82e35\tstd::__1::function<bool ()>::operator()() const [tiflash+184839733]\n                \t/DATA/disk1/ra_common/tiflash-env-15/sysroot/bin/../include/c++/v1/__functional/function.h:1187\n  0x559d0b7e2d55\tDB::BackgroundProcessingPool::threadFunction(unsigned long) [tiflash+196767061]\n                \tdbms/src/Storages/BackgroundProcessingPool.cpp:226\n  0x559d0b7e3bfc\tDB::BackgroundProcessingPool::BackgroundProcessingPool(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>)::
$_1::operator()() const [tiflash+196770812]\n                \tdbms/src/Storages/BackgroundProcessingPool.cpp:95\n  0x559d0b7e3bb5\tdecltype(std::declval<DB::BackgroundProcessingPool::BackgroundProcessing
Pool(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>)::$_1>()()) std::__1::__invoke[abi:v15001]<DB::BackgroundProcessingPool::BackgroundProcessingPool(int, std::_
_1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>)::$_1>(DB::BackgroundProcessingPool::BackgroundProcessingPool(int, std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char>>)::$_1&&) [tiflash+196770741]\n                \t/DATA/disk1/ra_common/tiflash-env-15/sysroot/bin/../include/c++/v1/__functional/invoke.h:394\n  0x559d0b7e3b8d\tvoid std::__1::__
thread_execute[abi:v15001]<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, DB::BackgroundProcessingPool::BackgroundProcessingPool(int, std::__1::basic
_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>)::$_1>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, DB::Backg
roundProcessingPool::BackgroundProcessingPool(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>)::$_1>&, std::__1::__tuple_indices<>) [tiflash+196770701]\n
       \t/DATA/disk1/ra_common/tiflash-env-15/sysroot/bin/../include/c++/v1/thread:284\n  0x559d0b7e39b2\tvoid* std::__1::__thread_proxy[abi:v15001]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread
_struct, std::__1::default_delete<std::__1::__thread_struct>>, DB::BackgroundProcessingPool::BackgroundProcessingPool(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<cha
r>>)::$_1>>(void*) [tiflash+196770226]\n                \t/DATA/disk1/ra_common/tiflash-env-15/sysroot/bin/../include/c++/v1/thread:295\n  0x7f0c3cd19802\tstart_thread [libc.so.6+653314]\n  0x7f0c3ccb9450
\tclone3 [libc.so.6+259152]"] [source=SchemaSyncService] [thread_id=96]

4. What is your TiFlash version? (Required)

v6.5.3

@JaySon-Huang
Copy link
Contributor Author

JaySon-Huang commented Nov 15, 2023

The release-7.5 branch can pass related test cases. The issue is resolved by refactoring the DDL framework #7630 in the master branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.3 affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. component/storage severity/critical type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

1 participant