Skip to content

Commit

Permalink
ddl: Fix broken TableIDMapping lead to data loss or crashes (release-…
Browse files Browse the repository at this point in the history
…7.5) (#8403)

close #8398
  • Loading branch information
JaySon-Huang authored Nov 21, 2023
1 parent 7dfc00f commit fe6621b
Show file tree
Hide file tree
Showing 13 changed files with 796 additions and 210 deletions.
2 changes: 1 addition & 1 deletion dbms/src/Debug/MockSchemaGetter.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct MockSchemaGetter

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

static TiDB::TableInfoPtr getTableInfo(DatabaseID, TableID table_id)
static TiDB::TableInfoPtr getTableInfo(DatabaseID, TableID table_id, [[maybe_unused]] bool try_mvcc = true)
{
return MockTiDB::instance().getTableInfoByID(table_id);
}
Expand Down
6 changes: 4 additions & 2 deletions dbms/src/Encryption/tests/gtest_rate_limiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ TEST(WriteLimiterTest, Rate)
// hint: the range [0.8, 1.25] is copied from rocksdb,
// if tests fail, try to enlarge this range.
// enlarge the range to [0.75, 1.30]
EXPECT_GE(actual_rate / target, 0.75);
EXPECT_LE(actual_rate / target, 1.30);
EXPECT_GE(actual_rate / target, 0.75)
<< fmt::format("actual_rate={} target={} elapsed={:.3f}s", actual_rate, target, elapsed);
EXPECT_LE(actual_rate / target, 1.30)
<< fmt::format("actual_rate={} target={} elapsed={:.3f}s", actual_rate, target, elapsed);
}
}

Expand Down
6 changes: 5 additions & 1 deletion dbms/src/Flash/Coprocessor/DAGStorageInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1339,7 +1339,11 @@ std::unordered_map<TableID, DAGStorageInterpreter::StorageWithStructureLock> DAG
if (!table_store)
{
if (schema_synced)
throw TiFlashException(fmt::format("Table {} doesn't exist.", table_id), Errors::Table::NotExists);
throw TiFlashException(
Errors::Table::NotExists,
"Table doesn't exist, keyspace={} table_id={}",
keyspace_id,
table_id);
else
return {{}, {}};
}
Expand Down
Loading

0 comments on commit fe6621b

Please sign in to comment.