Skip to content
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

jewel: rgw: meta sync thread crash at RGWMetaSyncShardCR #16711

Merged
merged 2 commits into from
Sep 10, 2017
Merged
Show file tree
Hide file tree
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: 6 additions & 9 deletions src/rgw/rgw_data_sync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1004,8 +1004,8 @@ class RGWDataSyncShardCR : public RGWCoroutine {

set<string> spawned_keys;

RGWContinuousLeaseCR *lease_cr;
RGWCoroutinesStack *lease_stack;
boost::intrusive_ptr<RGWContinuousLeaseCR> lease_cr;
boost::intrusive_ptr<RGWCoroutinesStack> lease_stack;
string status_oid;


Expand Down Expand Up @@ -1046,7 +1046,6 @@ class RGWDataSyncShardCR : public RGWCoroutine {
delete marker_tracker;
if (lease_cr) {
lease_cr->abort();
lease_cr->put();
}
if (error_repo) {
error_repo->put();
Expand Down Expand Up @@ -1094,13 +1093,11 @@ class RGWDataSyncShardCR : public RGWCoroutine {
string lock_name = "sync_lock";
if (lease_cr) {
lease_cr->abort();
lease_cr->put();
}
RGWRados *store = sync_env->store;
lease_cr = new RGWContinuousLeaseCR(sync_env->async_rados, store, store->get_zone_params().log_pool, status_oid,
lock_name, lock_duration, this);
lease_cr->get();
lease_stack = spawn(lease_cr, false);
lease_cr.reset(new RGWContinuousLeaseCR(sync_env->async_rados, store, store->get_zone_params().log_pool, status_oid,
lock_name, lock_duration, this));
lease_stack.reset(spawn(lease_cr.get(), false));
}

int full_sync() {
Expand Down Expand Up @@ -1272,7 +1269,7 @@ class RGWDataSyncShardCR : public RGWCoroutine {
set_status() << "num_spawned() > spawn_window";
yield wait_for_child();
int ret;
while (collect(&ret, lease_stack)) {
while (collect(&ret, lease_stack.get())) {
if (ret < 0) {
ldout(sync_env->cct, 0) << "ERROR: a sync operation returned error" << dendl;
/* we have reported this error */
Expand Down
60 changes: 24 additions & 36 deletions src/rgw/rgw_sync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,8 @@ class RGWInitSyncStatusCoroutine : public RGWCoroutine {

rgw_meta_sync_info status;
vector<RGWMetadataLogInfo> shards_info;
RGWContinuousLeaseCR *lease_cr;
RGWCoroutinesStack *lease_stack;
boost::intrusive_ptr<RGWContinuousLeaseCR> lease_cr;
boost::intrusive_ptr<RGWCoroutinesStack> lease_stack;
public:
RGWInitSyncStatusCoroutine(RGWMetaSyncEnv *_sync_env,
const rgw_meta_sync_info &status)
Expand All @@ -604,7 +604,6 @@ class RGWInitSyncStatusCoroutine : public RGWCoroutine {
~RGWInitSyncStatusCoroutine() {
if (lease_cr) {
lease_cr->abort();
lease_cr->put();
}
}

Expand All @@ -616,10 +615,9 @@ class RGWInitSyncStatusCoroutine : public RGWCoroutine {
uint32_t lock_duration = cct->_conf->rgw_sync_lease_period;
string lock_name = "sync_lock";
RGWRados *store = sync_env->store;
lease_cr = new RGWContinuousLeaseCR(sync_env->async_rados, store, store->get_zone_params().log_pool, sync_env->status_oid(),
lock_name, lock_duration, this);
lease_cr->get();
lease_stack = spawn(lease_cr, false);
lease_cr.reset(new RGWContinuousLeaseCR(sync_env->async_rados, store, store->get_zone_params().log_pool, sync_env->status_oid(),
lock_name, lock_duration, this));
lease_stack.reset(spawn(lease_cr.get(), false));
}
while (!lease_cr->is_locked()) {
if (lease_cr->is_done()) {
Expand Down Expand Up @@ -652,7 +650,7 @@ class RGWInitSyncStatusCoroutine : public RGWCoroutine {
}
}

drain_all_but_stack(lease_stack); /* the lease cr still needs to run */
drain_all_but_stack(lease_stack.get()); /* the lease cr still needs to run */

yield {
set_status("updating sync status");
Expand Down Expand Up @@ -737,8 +735,8 @@ class RGWFetchAllMetaCR : public RGWCoroutine {

std::unique_ptr<RGWShardedOmapCRManager> entries_index;

RGWContinuousLeaseCR *lease_cr;
RGWCoroutinesStack *lease_stack;
boost::intrusive_ptr<RGWContinuousLeaseCR> lease_cr;
boost::intrusive_ptr<RGWCoroutinesStack> lease_stack;
bool lost_lock;
bool failed;

Expand All @@ -753,9 +751,6 @@ class RGWFetchAllMetaCR : public RGWCoroutine {
}

~RGWFetchAllMetaCR() {
if (lease_cr) {
lease_cr->put();
}
}

void append_section_from_set(set<string>& all_sections, const string& name) {
Expand Down Expand Up @@ -791,10 +786,9 @@ class RGWFetchAllMetaCR : public RGWCoroutine {
set_status(string("acquiring lock (") + sync_env->status_oid() + ")");
uint32_t lock_duration = cct->_conf->rgw_sync_lease_period;
string lock_name = "sync_lock";
lease_cr = new RGWContinuousLeaseCR(sync_env->async_rados, sync_env->store, sync_env->store->get_zone_params().log_pool, sync_env->status_oid(),
lock_name, lock_duration, this);
lease_cr->get();
lease_stack = spawn(lease_cr, false);
lease_cr.reset(new RGWContinuousLeaseCR(sync_env->async_rados, sync_env->store, sync_env->store->get_zone_params().log_pool, sync_env->status_oid(),
lock_name, lock_duration, this));
lease_stack.reset(spawn(lease_cr.get(), false));
}
while (!lease_cr->is_locked()) {
if (lease_cr->is_done()) {
Expand Down Expand Up @@ -873,7 +867,7 @@ class RGWFetchAllMetaCR : public RGWCoroutine {
}
}

drain_all_but_stack(lease_stack); /* the lease cr still needs to run */
drain_all_but_stack(lease_stack.get()); /* the lease cr still needs to run */

yield lease_cr->go_down();

Expand Down Expand Up @@ -1259,8 +1253,9 @@ class RGWMetaSyncShardCR : public RGWCoroutine {
boost::asio::coroutine incremental_cr;
boost::asio::coroutine full_cr;

RGWContinuousLeaseCR *lease_cr = nullptr;
RGWCoroutinesStack *lease_stack = nullptr;
boost::intrusive_ptr<RGWContinuousLeaseCR> lease_cr;
boost::intrusive_ptr<RGWCoroutinesStack> lease_stack;

bool lost_lock = false;

bool *reset_backoff;
Expand Down Expand Up @@ -1291,7 +1286,6 @@ class RGWMetaSyncShardCR : public RGWCoroutine {
delete marker_tracker;
if (lease_cr) {
lease_cr->abort();
lease_cr->put();
}
}

Expand Down Expand Up @@ -1383,15 +1377,11 @@ class RGWMetaSyncShardCR : public RGWCoroutine {
yield {
uint32_t lock_duration = cct->_conf->rgw_sync_lease_period;
string lock_name = "sync_lock";
if (lease_cr) {
lease_cr->put();
}
RGWRados *store = sync_env->store;
lease_cr = new RGWContinuousLeaseCR(sync_env->async_rados, store, pool,
sync_env->shard_obj_name(shard_id),
lock_name, lock_duration, this);
lease_cr->get();
lease_stack = spawn(lease_cr, false);
lease_cr.reset(new RGWContinuousLeaseCR(sync_env->async_rados, store, pool,
sync_env->shard_obj_name(shard_id),
lock_name, lock_duration, this));
lease_stack.reset(spawn(lease_cr.get(), false));
lost_lock = false;
}
while (!lease_cr->is_locked()) {
Expand Down Expand Up @@ -1484,8 +1474,7 @@ class RGWMetaSyncShardCR : public RGWCoroutine {

yield lease_cr->go_down();

lease_cr->put();
lease_cr = NULL;
lease_cr.reset();

drain_all();

Expand Down Expand Up @@ -1517,11 +1506,10 @@ class RGWMetaSyncShardCR : public RGWCoroutine {
uint32_t lock_duration = cct->_conf->rgw_sync_lease_period;
string lock_name = "sync_lock";
RGWRados *store = sync_env->store;
lease_cr = new RGWContinuousLeaseCR(sync_env->async_rados, store, pool,
sync_env->shard_obj_name(shard_id),
lock_name, lock_duration, this);
lease_cr->get();
lease_stack = spawn(lease_cr, false);
lease_cr.reset(new RGWContinuousLeaseCR(sync_env->async_rados, store, pool,
sync_env->shard_obj_name(shard_id),
lock_name, lock_duration, this));
lease_stack.reset(spawn(lease_cr.get(), false));
lost_lock = false;
}
while (!lease_cr->is_locked()) {
Expand Down