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

ddl: Fix corner case of FLASHBACK DATABASE (#8536) #8538

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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