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

Add a fail point that can hold PS snapshot for five minute. #4620

Merged
merged 7 commits into from
Apr 15, 2022
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
3 changes: 2 additions & 1 deletion dbms/src/Common/FailPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ std::unordered_map<String, std::shared_ptr<FailPointChannel>> FailPointHelper::f
M(force_set_dtfile_exist_when_acquire_id) \
M(force_no_local_region_for_mpp_task) \
M(force_remote_read_for_batch_cop) \
M(force_context_path)
M(force_context_path) \
M(force_slow_page_storage_snapshot_release)

#define APPLY_FOR_FAILPOINTS_ONCE_WITH_CHANNEL(M) \
M(pause_after_learner_read) \
Expand Down
10 changes: 10 additions & 0 deletions dbms/src/Storages/DeltaMerge/DeltaMergeStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ extern const char force_triggle_foreground_flush[];
extern const char force_set_segment_ingest_packs_fail[];
extern const char segment_merge_after_ingest_packs[];
extern const char random_exception_after_dt_write_done[];
extern const char force_slow_page_storage_snapshot_release[];
} // namespace FailPoints

namespace DM
Expand Down Expand Up @@ -1036,11 +1037,20 @@ BlockInputStreams DeltaMergeStore::readRaw(const Context & db_context,
auto segment_snap = segment->createSnapshot(*dm_context, false, CurrentMetrics::DT_SnapshotOfReadRaw);
if (unlikely(!segment_snap))
throw Exception("Failed to get segment snap", ErrorCodes::LOGICAL_ERROR);

tasks.push_back(std::make_shared<SegmentReadTask>(segment, segment_snap, RowKeyRanges{segment->getRowKeyRange()}));
}
}
}

fiu_do_on(FailPoints::force_slow_page_storage_snapshot_release, {
std::thread thread_hold_snapshots([tasks]() {
std::this_thread::sleep_for(std::chrono::seconds(5 * 60));
(void)tasks;
});
jiaqizho marked this conversation as resolved.
Show resolved Hide resolved
thread_hold_snapshots.detach();
});

auto after_segment_read = [&](const DMContextPtr & dm_context_, const SegmentPtr & segment_) {
this->checkSegmentUpdate(dm_context_, segment_, ThreadType::Read);
};
Expand Down
1 change: 1 addition & 0 deletions dbms/src/Storages/Page/V3/BlobStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@ void BlobStore::BlobStats::restore()

for (auto & [path, stats] : stats_map)
{
(void)path;
for (const auto & stat : stats)
{
stat->recalculateSpaceMap();
Expand Down