Open breezewish opened 2 years ago
When we enable PageStorage
v3. We will use the namespace id
to distinguish different tables.
create table x(pk int, b int) engine = DeltaMerge(pk);
create table y(pk int, b int) engine = DeltaMerge(pk);
create table z(pk int, b int) engine = DeltaMerge(pk);
After create table x,y,z
, they got the same namespace id(TEST_NAMESPACE_ID 1000)
manage table x merge delta;
After table x
delta merged, we got 2 dtfile
in namespace id which is 1000.
Then call the table y
, it will restore the dtfile
and it won't find dtfile
which id is 2.
So that is a problem in tiflash client
. We should not use TEST_NAMESPACE_ID by default.
@breezewish You're creating tables through ch-client, which is a legacy way that works as using ClickHouse client to create a table in the ClilckHouse server. We only remain the ch-client as a debug way and have no official support on it.
As a similar problem was raised in the CI tests, we allocated different IDs for those tables created through ch-client in this PR https://github.com/pingcap/tiflash/pull/4831. But there still are some known limitations:
If you create a table through ch-client, then restart the TiFlash server, normally some data is not available after restart since the table id allocated is not the same as before
BTW, for debugging purposes, we normally use DBGInvoke mock_tidb_table(...)
to create tables for mock tests like this: https://github.com/pingcap/tiflash/blob/4ad156b924c88233bb7d9da43f2f47d249a16cdb/tests/delta-merge-test/raft/bugs/FLASH-484.test#L24-L32
@JaySon-Huang Thanks for the supply information! It is really helpful.
I also discovered that there are some legacy tests using CREATE TABLE
way, e.g. https://github.com/pingcap/tiflash/blob/4ad156b924c88233bb7d9da43f2f47d249a16cdb/tests/delta-merge-test/ddl/alter.test#L18-L22
Maybe we need to migrate these tests, or make CREATE TABLE
work without problems?
Yes, I think we can rewrite those legacy tests as fullstack-test / unit test cases https://github.com/pingcap/tiflash/pull/4831/commits/27010a6ec14f263a0f9a2c4755adedde31054bdd
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
Enable PageStorageV3, then,
2. What did you expect to see? (Required)
No errors
3. What did you see instead (Required)
With the following error log in server:
4. What is your TiFlash version? (Required)
abb313953973dd955daad63724a2cf22bb94e264
(April 22, 2022 at 11:58:04 GMT+8)