Implement "no_recovery" and "no_rebalance" flags
parent
0d2efbecc9
commit
af5155fcd9
|
@ -47,6 +47,8 @@ const etcd_tree = {
|
||||||
client_dirty_limit: 33554432,
|
client_dirty_limit: 33554432,
|
||||||
peer_connect_interval: 5, // seconds. min: 1
|
peer_connect_interval: 5, // seconds. min: 1
|
||||||
peer_connect_timeout: 5, // seconds. min: 1
|
peer_connect_timeout: 5, // seconds. min: 1
|
||||||
|
osd_idle_timeout: 5, // seconds. min: 1
|
||||||
|
osd_ping_timeout: 5, // seconds. min: 1
|
||||||
up_wait_retry_interval: 500, // ms. min: 50
|
up_wait_retry_interval: 500, // ms. min: 50
|
||||||
// osd
|
// osd
|
||||||
etcd_report_interval: 30, // min: 10
|
etcd_report_interval: 30, // min: 10
|
||||||
|
@ -57,7 +59,10 @@ const etcd_tree = {
|
||||||
client_queue_depth: 128, // unused
|
client_queue_depth: 128, // unused
|
||||||
recovery_queue_depth: 4,
|
recovery_queue_depth: 4,
|
||||||
readonly: false,
|
readonly: false,
|
||||||
|
no_recovery: false,
|
||||||
|
no_rebalance: false,
|
||||||
print_stats_interval: 3,
|
print_stats_interval: 3,
|
||||||
|
slow_log_interval: 10,
|
||||||
// blockstore - fixed in superblock
|
// blockstore - fixed in superblock
|
||||||
block_size,
|
block_size,
|
||||||
disk_alignment,
|
disk_alignment,
|
||||||
|
@ -77,6 +82,7 @@ const etcd_tree = {
|
||||||
disable_meta_fsync,
|
disable_meta_fsync,
|
||||||
disable_device_lock,
|
disable_device_lock,
|
||||||
// blockstore - configurable
|
// blockstore - configurable
|
||||||
|
max_write_iodepth,
|
||||||
flusher_count,
|
flusher_count,
|
||||||
inmemory_metadata,
|
inmemory_metadata,
|
||||||
inmemory_journal,
|
inmemory_journal,
|
||||||
|
|
|
@ -54,11 +54,12 @@ osd_t::~osd_t()
|
||||||
|
|
||||||
void osd_t::parse_config(blockstore_config_t & config)
|
void osd_t::parse_config(blockstore_config_t & config)
|
||||||
{
|
{
|
||||||
if (config.find("log_level") == config.end())
|
|
||||||
config["log_level"] = "1";
|
|
||||||
// Initial startup configuration
|
// Initial startup configuration
|
||||||
json11::Json json_config = json11::Json(config);
|
json11::Json json_config = json11::Json(config);
|
||||||
st_cli.parse_config(json_config);
|
st_cli.parse_config(json_config);
|
||||||
|
if (config.find("log_level") == config.end())
|
||||||
|
config["log_level"] = "1";
|
||||||
|
log_level = strtoull(config["log_level"].c_str(), NULL, 10);
|
||||||
etcd_report_interval = strtoull(config["etcd_report_interval"].c_str(), NULL, 10);
|
etcd_report_interval = strtoull(config["etcd_report_interval"].c_str(), NULL, 10);
|
||||||
if (etcd_report_interval <= 0)
|
if (etcd_report_interval <= 0)
|
||||||
etcd_report_interval = 30;
|
etcd_report_interval = 30;
|
||||||
|
@ -67,6 +68,8 @@ void osd_t::parse_config(blockstore_config_t & config)
|
||||||
throw std::runtime_error("osd_num is required in the configuration");
|
throw std::runtime_error("osd_num is required in the configuration");
|
||||||
c_cli.osd_num = osd_num;
|
c_cli.osd_num = osd_num;
|
||||||
run_primary = config["run_primary"] != "false" && config["run_primary"] != "0" && config["run_primary"] != "no";
|
run_primary = config["run_primary"] != "false" && config["run_primary"] != "0" && config["run_primary"] != "no";
|
||||||
|
no_rebalance = config["no_rebalance"] == "true" || config["no_rebalance"] == "1" || config["no_rebalance"] == "yes";
|
||||||
|
no_recovery = config["no_recovery"] == "true" || config["no_recovery"] == "1" || config["no_recovery"] == "yes";
|
||||||
// Cluster configuration
|
// Cluster configuration
|
||||||
bind_address = config["bind_address"];
|
bind_address = config["bind_address"];
|
||||||
if (bind_address == "")
|
if (bind_address == "")
|
||||||
|
|
|
@ -64,6 +64,8 @@ class osd_t
|
||||||
bool readonly = false;
|
bool readonly = false;
|
||||||
osd_num_t osd_num = 1; // OSD numbers start with 1
|
osd_num_t osd_num = 1; // OSD numbers start with 1
|
||||||
bool run_primary = false;
|
bool run_primary = false;
|
||||||
|
bool no_rebalance = false;
|
||||||
|
bool no_recovery = false;
|
||||||
std::string bind_address;
|
std::string bind_address;
|
||||||
int bind_port, listen_backlog;
|
int bind_port, listen_backlog;
|
||||||
// FIXME: Implement client queue depth limit
|
// FIXME: Implement client queue depth limit
|
||||||
|
|
|
@ -209,32 +209,38 @@ void osd_t::submit_flush_op(pool_id_t pool_id, pg_num_t pg_num, pg_flush_batch_t
|
||||||
|
|
||||||
bool osd_t::pick_next_recovery(osd_recovery_op_t &op)
|
bool osd_t::pick_next_recovery(osd_recovery_op_t &op)
|
||||||
{
|
{
|
||||||
for (auto pg_it = pgs.begin(); pg_it != pgs.end(); pg_it++)
|
if (!no_recovery)
|
||||||
{
|
{
|
||||||
if ((pg_it->second.state & (PG_ACTIVE | PG_HAS_DEGRADED)) == (PG_ACTIVE | PG_HAS_DEGRADED))
|
for (auto pg_it = pgs.begin(); pg_it != pgs.end(); pg_it++)
|
||||||
{
|
{
|
||||||
for (auto obj_it = pg_it->second.degraded_objects.begin(); obj_it != pg_it->second.degraded_objects.end(); obj_it++)
|
if ((pg_it->second.state & (PG_ACTIVE | PG_HAS_DEGRADED)) == (PG_ACTIVE | PG_HAS_DEGRADED))
|
||||||
{
|
{
|
||||||
if (recovery_ops.find(obj_it->first) == recovery_ops.end())
|
for (auto obj_it = pg_it->second.degraded_objects.begin(); obj_it != pg_it->second.degraded_objects.end(); obj_it++)
|
||||||
{
|
{
|
||||||
op.degraded = true;
|
if (recovery_ops.find(obj_it->first) == recovery_ops.end())
|
||||||
op.oid = obj_it->first;
|
{
|
||||||
return true;
|
op.degraded = true;
|
||||||
|
op.oid = obj_it->first;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto pg_it = pgs.begin(); pg_it != pgs.end(); pg_it++)
|
if (!no_rebalance)
|
||||||
{
|
{
|
||||||
if ((pg_it->second.state & (PG_ACTIVE | PG_HAS_MISPLACED)) == (PG_ACTIVE | PG_HAS_MISPLACED))
|
for (auto pg_it = pgs.begin(); pg_it != pgs.end(); pg_it++)
|
||||||
{
|
{
|
||||||
for (auto obj_it = pg_it->second.misplaced_objects.begin(); obj_it != pg_it->second.misplaced_objects.end(); obj_it++)
|
if ((pg_it->second.state & (PG_ACTIVE | PG_HAS_MISPLACED)) == (PG_ACTIVE | PG_HAS_MISPLACED))
|
||||||
{
|
{
|
||||||
if (recovery_ops.find(obj_it->first) == recovery_ops.end())
|
for (auto obj_it = pg_it->second.misplaced_objects.begin(); obj_it != pg_it->second.misplaced_objects.end(); obj_it++)
|
||||||
{
|
{
|
||||||
op.degraded = false;
|
if (recovery_ops.find(obj_it->first) == recovery_ops.end())
|
||||||
op.oid = obj_it->first;
|
{
|
||||||
return true;
|
op.degraded = false;
|
||||||
|
op.oid = obj_it->first;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue