Skip to content

Commit fe6621b

Browse files
authored
ddl: Fix broken TableIDMapping lead to data loss or crashes (release-7.5) (#8403)
close #8398
1 parent 7dfc00f commit fe6621b

File tree

13 files changed

+796
-210
lines changed

13 files changed

+796
-210
lines changed

dbms/src/Debug/MockSchemaGetter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct MockSchemaGetter
3434

3535
static bool checkSchemaDiffExists(Int64 version) { return MockTiDB::instance().checkSchemaDiffExists(version); }
3636

37-
static TiDB::TableInfoPtr getTableInfo(DatabaseID, TableID table_id)
37+
static TiDB::TableInfoPtr getTableInfo(DatabaseID, TableID table_id, [[maybe_unused]] bool try_mvcc = true)
3838
{
3939
return MockTiDB::instance().getTableInfoByID(table_id);
4040
}

dbms/src/Encryption/tests/gtest_rate_limiter.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ TEST(WriteLimiterTest, Rate)
7171
// hint: the range [0.8, 1.25] is copied from rocksdb,
7272
// if tests fail, try to enlarge this range.
7373
// enlarge the range to [0.75, 1.30]
74-
EXPECT_GE(actual_rate / target, 0.75);
75-
EXPECT_LE(actual_rate / target, 1.30);
74+
EXPECT_GE(actual_rate / target, 0.75)
75+
<< fmt::format("actual_rate={} target={} elapsed={:.3f}s", actual_rate, target, elapsed);
76+
EXPECT_LE(actual_rate / target, 1.30)
77+
<< fmt::format("actual_rate={} target={} elapsed={:.3f}s", actual_rate, target, elapsed);
7678
}
7779
}
7880

dbms/src/Flash/Coprocessor/DAGStorageInterpreter.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,11 @@ std::unordered_map<TableID, DAGStorageInterpreter::StorageWithStructureLock> DAG
13391339
if (!table_store)
13401340
{
13411341
if (schema_synced)
1342-
throw TiFlashException(fmt::format("Table {} doesn't exist.", table_id), Errors::Table::NotExists);
1342+
throw TiFlashException(
1343+
Errors::Table::NotExists,
1344+
"Table doesn't exist, keyspace={} table_id={}",
1345+
keyspace_id,
1346+
table_id);
13431347
else
13441348
return {{}, {}};
13451349
}

0 commit comments

Comments
 (0)