Compare commits
4 Commits
d2b43cb118
...
581d02e581
Author | SHA1 | Date |
---|---|---|
Vitaliy Filippov | 581d02e581 | |
Vitaliy Filippov | f03a9db4d9 | |
Vitaliy Filippov | cb9c30bc31 | |
Vitaliy Filippov | a86a380d20 |
|
@ -19,7 +19,7 @@ void blockstore_impl_t::parse_config(blockstore_config_t & config, bool init)
|
||||||
throttle_target_mbs = strtoull(config["throttle_target_mbs"].c_str(), NULL, 10);
|
throttle_target_mbs = strtoull(config["throttle_target_mbs"].c_str(), NULL, 10);
|
||||||
throttle_target_parallelism = strtoull(config["throttle_target_parallelism"].c_str(), NULL, 10);
|
throttle_target_parallelism = strtoull(config["throttle_target_parallelism"].c_str(), NULL, 10);
|
||||||
throttle_threshold_us = strtoull(config["throttle_threshold_us"].c_str(), NULL, 10);
|
throttle_threshold_us = strtoull(config["throttle_threshold_us"].c_str(), NULL, 10);
|
||||||
if (config.find("autosync_writes") != config.end())
|
if (config["autosync_writes"] != "")
|
||||||
{
|
{
|
||||||
autosync_writes = strtoull(config["autosync_writes"].c_str(), NULL, 10);
|
autosync_writes = strtoull(config["autosync_writes"].c_str(), NULL, 10);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ struct rm_pg_t
|
||||||
uint64_t obj_count = 0, obj_done = 0;
|
uint64_t obj_count = 0, obj_done = 0;
|
||||||
int state = 0;
|
int state = 0;
|
||||||
int in_flight = 0;
|
int in_flight = 0;
|
||||||
|
bool synced = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rm_inode_t
|
struct rm_inode_t
|
||||||
|
@ -48,6 +49,7 @@ struct rm_inode_t
|
||||||
.objects = objects,
|
.objects = objects,
|
||||||
.obj_count = objects.size(),
|
.obj_count = objects.size(),
|
||||||
.obj_done = 0,
|
.obj_done = 0,
|
||||||
|
.synced = parent->cli->get_immediate_commit(inode),
|
||||||
});
|
});
|
||||||
if (min_offset == 0)
|
if (min_offset == 0)
|
||||||
{
|
{
|
||||||
|
@ -151,6 +153,37 @@ struct rm_inode_t
|
||||||
}
|
}
|
||||||
cur_list->obj_pos++;
|
cur_list->obj_pos++;
|
||||||
}
|
}
|
||||||
|
if (cur_list->in_flight == 0 && cur_list->obj_pos == cur_list->objects.end() &&
|
||||||
|
!cur_list->synced)
|
||||||
|
{
|
||||||
|
osd_op_t *op = new osd_op_t();
|
||||||
|
op->op_type = OSD_OP_OUT;
|
||||||
|
op->peer_fd = parent->cli->msgr.osd_peer_fds.at(cur_list->rm_osd_num);
|
||||||
|
op->req = (osd_any_op_t){
|
||||||
|
.sync = {
|
||||||
|
.header = {
|
||||||
|
.magic = SECONDARY_OSD_OP_MAGIC,
|
||||||
|
.id = parent->cli->next_op_id(),
|
||||||
|
.opcode = OSD_OP_SYNC,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
op->callback = [this, cur_list](osd_op_t *op)
|
||||||
|
{
|
||||||
|
cur_list->in_flight--;
|
||||||
|
cur_list->synced = true;
|
||||||
|
if (op->reply.hdr.retval < 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Failed to sync OSD %lu (retval=%ld)\n",
|
||||||
|
cur_list->rm_osd_num, op->reply.hdr.retval);
|
||||||
|
error_count++;
|
||||||
|
}
|
||||||
|
delete op;
|
||||||
|
continue_delete();
|
||||||
|
};
|
||||||
|
cur_list->in_flight++;
|
||||||
|
parent->cli->msgr.outbox_push(op);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void continue_delete()
|
void continue_delete()
|
||||||
|
@ -161,7 +194,8 @@ struct rm_inode_t
|
||||||
}
|
}
|
||||||
for (int i = 0; i < lists.size(); i++)
|
for (int i = 0; i < lists.size(); i++)
|
||||||
{
|
{
|
||||||
if (!lists[i]->in_flight && lists[i]->obj_pos == lists[i]->objects.end())
|
if (!lists[i]->in_flight && lists[i]->obj_pos == lists[i]->objects.end() &&
|
||||||
|
lists[i]->synced)
|
||||||
{
|
{
|
||||||
delete lists[i];
|
delete lists[i];
|
||||||
lists.erase(lists.begin()+i, lists.begin()+i+1);
|
lists.erase(lists.begin()+i, lists.begin()+i+1);
|
||||||
|
@ -187,7 +221,7 @@ struct rm_inode_t
|
||||||
{
|
{
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
if (parent->progress && (total_done < total_count || inactive_osds.size() > 0))
|
if (parent->progress && (total_done < total_count || inactive_osds.size() > 0 || error_count > 0))
|
||||||
{
|
{
|
||||||
fprintf(
|
fprintf(
|
||||||
stderr, "Warning: Pool:%u,ID:%lu inode data may not have been fully removed.\n"
|
stderr, "Warning: Pool:%u,ID:%lu inode data may not have been fully removed.\n"
|
||||||
|
|
|
@ -22,7 +22,7 @@ static blockstore_config_t json_to_bs(const json11::Json::object & config)
|
||||||
{
|
{
|
||||||
if (kv.second.is_string())
|
if (kv.second.is_string())
|
||||||
bs[kv.first] = kv.second.string_value();
|
bs[kv.first] = kv.second.string_value();
|
||||||
else
|
else if (!kv.second.is_null())
|
||||||
bs[kv.first] = kv.second.dump();
|
bs[kv.first] = kv.second.dump();
|
||||||
}
|
}
|
||||||
return bs;
|
return bs;
|
||||||
|
@ -194,7 +194,8 @@ void osd_t::parse_config(bool init)
|
||||||
if (autosync_interval > MAX_AUTOSYNC_INTERVAL)
|
if (autosync_interval > MAX_AUTOSYNC_INTERVAL)
|
||||||
autosync_interval = DEFAULT_AUTOSYNC_INTERVAL;
|
autosync_interval = DEFAULT_AUTOSYNC_INTERVAL;
|
||||||
}
|
}
|
||||||
if (!config["autosync_writes"].is_null())
|
if (config["autosync_writes"].is_number() ||
|
||||||
|
config["autosync_writes"].string_value() != "")
|
||||||
{
|
{
|
||||||
// Allow to set it to 0
|
// Allow to set it to 0
|
||||||
autosync_writes = config["autosync_writes"].uint64_value();
|
autosync_writes = config["autosync_writes"].uint64_value();
|
||||||
|
|
|
@ -262,7 +262,8 @@ void osd_t::report_statistics()
|
||||||
for (auto st_it = inode_stats.begin(); st_it != inode_stats.end(); )
|
for (auto st_it = inode_stats.begin(); st_it != inode_stats.end(); )
|
||||||
{
|
{
|
||||||
auto & kv = *st_it;
|
auto & kv = *st_it;
|
||||||
if (!bs_inode_space[kv.first])
|
auto spc_it = bs_inode_space.find(kv.first);
|
||||||
|
if (spc_it == bs_inode_space.end() || !spc_it->second) // prevent autovivification
|
||||||
{
|
{
|
||||||
// Is it an empty inode?
|
// Is it an empty inode?
|
||||||
if (!tv_now.tv_sec)
|
if (!tv_now.tv_sec)
|
||||||
|
|
|
@ -706,6 +706,26 @@ resume_5:
|
||||||
remove_object_from_state(op_data->oid, &op_data->object_state, pg);
|
remove_object_from_state(op_data->oid, &op_data->object_state, pg);
|
||||||
deref_object_state(pg, &op_data->object_state, true);
|
deref_object_state(pg, &op_data->object_state, true);
|
||||||
}
|
}
|
||||||
|
// Mark PG and OSDs as dirty
|
||||||
|
for (auto & chunk: (op_data->object_state ? op_data->object_state->osd_set : pg.cur_loc_set))
|
||||||
|
{
|
||||||
|
this->dirty_osds.insert(chunk.osd_num);
|
||||||
|
}
|
||||||
|
for (auto cl_it = msgr.clients.find(cur_op->peer_fd); cl_it != msgr.clients.end(); )
|
||||||
|
{
|
||||||
|
cl_it->second->dirty_pgs.insert({ .pool_id = pg.pool_id, .pg_num = pg.pg_num });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dirty_pgs.insert({ .pool_id = pg.pool_id, .pg_num = pg.pg_num });
|
||||||
|
if (immediate_commit == IMMEDIATE_NONE)
|
||||||
|
{
|
||||||
|
unstable_write_count++;
|
||||||
|
if (unstable_write_count >= autosync_writes)
|
||||||
|
{
|
||||||
|
unstable_write_count = 0;
|
||||||
|
autosync();
|
||||||
|
}
|
||||||
|
}
|
||||||
pg.total_count--;
|
pg.total_count--;
|
||||||
cur_op->reply.hdr.retval = 0;
|
cur_op->reply.hdr.retval = 0;
|
||||||
continue_others:
|
continue_others:
|
||||||
|
|
Loading…
Reference in New Issue