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

PageStorage: avoid redundantly print stale snapshot log #8608

Merged
Merged
Changes from 1 commit
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
19 changes: 12 additions & 7 deletions dbms/src/Storages/Page/V3/PageDirectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2047,6 +2047,7 @@ typename PageDirectory<Trait>::PageEntries PageDirectory<Trait>::gcInMemEntries(
{
// Cleanup released snapshots
std::lock_guard lock(snapshots_mutex);
std::unordered_set<String> tracing_id_set;
for (auto iter = snapshots.begin(); iter != snapshots.end(); /* empty */)
{
if (auto snap = iter->lock(); snap == nullptr)
Expand All @@ -2063,13 +2064,17 @@ typename PageDirectory<Trait>::PageEntries PageDirectory<Trait>::gcInMemEntries(

if (alive_time_seconds > 10 * 60) // TODO: Make `10 * 60` as a configuration
{
LOG_WARNING(
log,
"Meet a stale snapshot [thread id={}] [tracing id={}] [seq={}] [alive time(s)={}]",
snap->create_thread,
snap->tracing_id,
snap->sequence,
alive_time_seconds);
if (!tracing_id_set.contains(snap->tracing_id))
JaySon-Huang marked this conversation as resolved.
Show resolved Hide resolved
{
LOG_WARNING(
log,
"Meet a stale snapshot [thread id={}] [tracing id={}] [seq={}] [alive time(s)={}]",
snap->create_thread,
snap->tracing_id,
snap->sequence,
alive_time_seconds);
tracing_id_set.emplace(snap->tracing_id);
}
stale_snapshot_nums++;
}

Expand Down