Skip to content

Commit

Permalink
ddl: Fix corner case of FLASHBACK DATABASE (#8536) (#8538)
Browse files Browse the repository at this point in the history
close #8506
  • Loading branch information
ti-chi-bot authored Dec 18, 2023
1 parent 701ec11 commit ac988a9
Show file tree
Hide file tree
Showing 10 changed files with 157 additions and 176 deletions.
1 change: 1 addition & 0 deletions dbms/src/Common/FailPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ namespace DB
M(pause_when_altering_dt_store) \
M(pause_after_copr_streams_acquired) \
M(pause_query_init) \
M(pause_before_prehandle_snapshot) \
M(pause_before_wn_establish_task) \
M(pause_passive_flush_before_persist_region)

Expand Down
5 changes: 0 additions & 5 deletions dbms/src/Debug/MockSchemaGetter.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ struct MockSchemaGetter
return {getTableInfo(db_id, table_id), false};
}

static std::tuple<TiDB::DBInfoPtr, TiDB::TableInfoPtr> getDatabaseAndTableInfo(DatabaseID db_id, TableID table_id)
{
return std::make_tuple(getDatabase(db_id), getTableInfo(db_id, table_id));
}

static std::vector<TiDB::DBInfoPtr> listDBs()
{
std::vector<TiDB::DBInfoPtr> res;
Expand Down
13 changes: 9 additions & 4 deletions dbms/src/Storages/KVStore/MultiRaft/PrehandleSnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace FailPoints
extern const char force_set_sst_to_dtfile_block_size[];
extern const char force_set_parallel_prehandle_threshold[];
extern const char force_raise_prehandle_exception[];
extern const char pause_before_prehandle_snapshot[];
} // namespace FailPoints

namespace ErrorCodes
Expand Down Expand Up @@ -191,28 +192,32 @@ PrehandleResult KVStore::preHandleSnapshotToFiles(
{
new_region->beforePrehandleSnapshot(new_region->id(), deadline_index);
ongoing_prehandle_task_count.fetch_add(1);
PrehandleResult result;

FAIL_POINT_PAUSE(FailPoints::pause_before_prehandle_snapshot);

try
{
SCOPE_EXIT({
auto ongoing = ongoing_prehandle_task_count.fetch_sub(1) - 1;
new_region->afterPrehandleSnapshot(ongoing);
});
result = preHandleSSTsToDTFiles( //
PrehandleResult result = preHandleSSTsToDTFiles( //
new_region,
snaps,
index,
term,
DM::FileConvertJobType::ApplySnapshot,
tmt);
return result;
}
catch (DB::Exception & e)
{
e.addMessage(
fmt::format("(while preHandleSnapshot region_id={}, index={}, term={})", new_region->id(), index, term));
e.rethrow();
}
return result;

return PrehandleResult{};
}

// If size is 0, do not parallel prehandle for this snapshot, which is legacy.
Expand Down Expand Up @@ -786,4 +791,4 @@ void Region::afterPrehandleSnapshot(int64_t ongoing)
}
}

} // namespace DB
} // namespace DB
Loading

0 comments on commit ac988a9

Please sign in to comment.