forked from vitalif/vitastor
Add no_scrub flag
parent
3c924397e7
commit
0c78dd7178
|
@ -39,7 +39,6 @@ public:
|
|||
ring_loop_t *ringloop = NULL;
|
||||
epoll_manager_t *epmgr = NULL;
|
||||
cluster_client_t *cli = NULL;
|
||||
bool no_recovery = false, no_rebalance = false, readonly = false;
|
||||
|
||||
int waiting = 0;
|
||||
cli_result_t etcd_err;
|
||||
|
|
|
@ -201,6 +201,7 @@ resume_2:
|
|||
bool readonly = json_is_true(parent->cli->config["readonly"]);
|
||||
bool no_recovery = json_is_true(parent->cli->config["no_recovery"]);
|
||||
bool no_rebalance = json_is_true(parent->cli->config["no_rebalance"]);
|
||||
bool no_scrub = json_is_true(parent->cli->config["no_scrub"]);
|
||||
if (parent->json_output)
|
||||
{
|
||||
// JSON output
|
||||
|
@ -219,6 +220,7 @@ resume_2:
|
|||
{ "readonly", readonly },
|
||||
{ "no_recovery", no_recovery },
|
||||
{ "no_rebalance", no_rebalance },
|
||||
{ "no_scrub", no_scrub },
|
||||
{ "pool_count", pool_count },
|
||||
{ "active_pool_count", pools_active },
|
||||
{ "pg_states", pgs_by_state },
|
||||
|
|
10
src/osd.cpp
10
src/osd.cpp
|
@ -169,6 +169,8 @@ void osd_t::parse_config(bool init)
|
|||
no_rebalance = json_is_true(config["no_rebalance"]);
|
||||
auto old_no_recovery = no_recovery;
|
||||
no_recovery = json_is_true(config["no_recovery"]);
|
||||
auto old_no_scrub = no_scrub;
|
||||
no_scrub = json_is_true(config["no_scrub"]);
|
||||
auto old_autosync_interval = autosync_interval;
|
||||
if (!config["autosync_interval"].is_null())
|
||||
{
|
||||
|
@ -219,6 +221,14 @@ void osd_t::parse_config(bool init)
|
|||
scrub_list_limit = config["scrub_list_limit"].uint64_value();
|
||||
if (!scrub_list_limit)
|
||||
scrub_list_limit = 1000;
|
||||
if (old_no_scrub && !no_scrub)
|
||||
{
|
||||
// Wakeup scrubbing
|
||||
for (auto & pgp: pgs)
|
||||
{
|
||||
schedule_scrub(pgp.second);
|
||||
}
|
||||
}
|
||||
if ((old_no_rebalance && !no_rebalance || old_no_recovery && !no_recovery) &&
|
||||
!(peering_state & (OSD_RECOVERING | OSD_FLUSHING_PGS)))
|
||||
{
|
||||
|
|
|
@ -99,6 +99,7 @@ class osd_t
|
|||
bool run_primary = false;
|
||||
bool no_rebalance = false;
|
||||
bool no_recovery = false;
|
||||
bool no_scrub = false;
|
||||
std::string bind_address;
|
||||
int bind_port, listen_backlog = 128;
|
||||
// FIXME: Implement client queue depth limit
|
||||
|
|
|
@ -285,6 +285,27 @@ bool osd_t::continue_scrub()
|
|||
{
|
||||
return true;
|
||||
}
|
||||
if (no_scrub)
|
||||
{
|
||||
// Return false = no more scrub work to do
|
||||
scrub_cur_list = {};
|
||||
scrub_last_pg = {};
|
||||
scrub_nearest_ts = 0;
|
||||
if (scrub_timer_id >= 0)
|
||||
{
|
||||
tfd->clear_timer(scrub_timer_id);
|
||||
scrub_timer_id = -1;
|
||||
}
|
||||
for (auto pg_it = pgs.begin(); pg_it != pgs.end(); pg_it++)
|
||||
{
|
||||
if (pg_it->second.state & PG_SCRUBBING)
|
||||
{
|
||||
pg_it->second.state = pg_it->second.state & ~PG_SCRUBBING;
|
||||
report_pg_state(pg_it->second);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
while (scrub_ops.size() < scrub_queue_depth)
|
||||
{
|
||||
object_id oid;
|
||||
|
@ -299,7 +320,7 @@ bool osd_t::continue_scrub()
|
|||
|
||||
void osd_t::schedule_scrub(pg_t & pg)
|
||||
{
|
||||
if (pg.next_scrub && (!scrub_nearest_ts || scrub_nearest_ts > pg.next_scrub))
|
||||
if (!no_scrub && pg.next_scrub && (!scrub_nearest_ts || scrub_nearest_ts > pg.next_scrub))
|
||||
{
|
||||
scrub_nearest_ts = pg.next_scrub;
|
||||
timespec tv_now;
|
||||
|
|
Loading…
Reference in New Issue