forked from vitalif/vitastor
Do not flush or recover in readonly mode
parent
dd02bc1c44
commit
d11e8dcb5e
2
osd.cpp
2
osd.cpp
|
@ -106,6 +106,8 @@ void osd_t::parse_config(blockstore_config_t & config)
|
|||
recovery_queue_depth = strtoull(config["recovery_queue_depth"].c_str(), NULL, 10);
|
||||
if (recovery_queue_depth < 1 || recovery_queue_depth > MAX_RECOVERY_QUEUE)
|
||||
recovery_queue_depth = DEFAULT_RECOVERY_QUEUE;
|
||||
if (config["readonly"] == "true" || config["readonly"] == "1" || config["readonly"] == "yes")
|
||||
readonly = true;
|
||||
}
|
||||
|
||||
void osd_t::bind_socket()
|
||||
|
|
1
osd.h
1
osd.h
|
@ -189,6 +189,7 @@ class osd_t
|
|||
|
||||
// config
|
||||
|
||||
bool readonly = false;
|
||||
std::string consul_address;
|
||||
osd_num_t osd_num = 1; // OSD numbers start with 1
|
||||
bool run_primary = false;
|
||||
|
|
|
@ -204,7 +204,7 @@ void osd_t::handle_peers()
|
|||
peering_state = peering_state & ~OSD_PEERING_PGS;
|
||||
}
|
||||
}
|
||||
if (peering_state & OSD_FLUSHING_PGS)
|
||||
if ((peering_state & OSD_FLUSHING_PGS) && !readonly)
|
||||
{
|
||||
bool still = false;
|
||||
for (auto & p: pgs)
|
||||
|
@ -223,7 +223,7 @@ void osd_t::handle_peers()
|
|||
peering_state = peering_state & ~OSD_FLUSHING_PGS | OSD_RECOVERING;
|
||||
}
|
||||
}
|
||||
if (peering_state & OSD_RECOVERING)
|
||||
if ((peering_state & OSD_RECOVERING) && !readonly)
|
||||
{
|
||||
if (!continue_recovery())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue