Skip to content

fix: some replicas never start manaul compact after zero o'clock #1556

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
15 changes: 15 additions & 0 deletions src/server/pegasus_manual_compact_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <limits.h>
#include <rocksdb/options.h>
#include <chrono>
#include <list>
#include <ostream>
#include <set>
Expand Down Expand Up @@ -301,6 +302,20 @@ void pegasus_manual_compact_service::manual_compact(const rocksdb::CompactRangeO
LOG_INFO_PREFIX("ignored compact because exceed max_concurrent_running_count({})",
_max_concurrent_running_count.load());
_manual_compact_enqueue_time_ms.store(0);

_pfc_manual_compact_enqueue_count->increment();
int loop_enqueue_time = now_timestamp() + 60 * 1000;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The execute time is 60 seconds later, the enqueue time is now, right?

_manual_compact_enqueue_time_ms.store(loop_enqueue_time);
dsn::tasking::enqueue(LPC_MANUAL_COMPACT,
&_app->_tracker,
[this, options]() {
_pfc_manual_compact_enqueue_count->decrement();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to increment before enqueue too?

manual_compact(options);
},
0,
std::chrono::seconds(60));
LOG_INFO_PREFIX("retry 60 seconds later,now task enqueue time({})ms",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another question is: when to give up retrying?
Suppose a rare case, there are 24 replicas of a table on a server, each one cost more than 1 hour to manual compact, will the queue increase infinity?

_manual_compact_enqueue_time_ms.load());
return;
}

Expand Down