rgw/bucket-sync: flush marker_tracker when the lease is lost

Also clear objv before reading the bucket sync status.

Signed-off-by: Soumya Koduri <skoduri@redhat.com>
This commit is contained in:
Soumya Koduri 2022-11-17 21:38:41 +05:30 committed by Adam C. Emerson
parent d0725750b6
commit e1c31b2997

View File

@ -4346,6 +4346,7 @@ int RGWBucketFullSyncCR::operate(const DoutPrefixProvider *dpp)
do {
if (lease_cr && !lease_cr->is_locked()) {
drain_all();
yield call(marker_tracker.flush());
tn->log(1, "no lease or lease is lost, abort");
return set_cr_error(-ECANCELED);
}
@ -4362,6 +4363,7 @@ int RGWBucketFullSyncCR::operate(const DoutPrefixProvider *dpp)
if (retcode < 0 && retcode != -ENOENT) {
set_status("failed bucket listing, going down");
drain_all();
yield spawn(marker_tracker.flush(), true);
return set_cr_error(retcode);
}
if (list_result.entries.size() > 0) {
@ -4371,6 +4373,7 @@ int RGWBucketFullSyncCR::operate(const DoutPrefixProvider *dpp)
for (; entries_iter != list_result.entries.end(); ++entries_iter) {
if (lease_cr && !lease_cr->is_locked()) {
drain_all();
yield call(marker_tracker.flush());
tn->log(1, "no lease or lease is lost, abort");
return set_cr_error(-ECANCELED);
}
@ -4418,6 +4421,7 @@ int RGWBucketFullSyncCR::operate(const DoutPrefixProvider *dpp)
tn->unset_flag(RGW_SNS_FLAG_ACTIVE);
if (lease_cr && !lease_cr->is_locked()) {
tn->log(1, "no lease or lease is lost, abort");
yield call(marker_tracker.flush());
return set_cr_error(-ECANCELED);
}
yield call(marker_tracker.flush());
@ -4609,6 +4613,7 @@ int RGWBucketShardIncrementalSyncCR::operate(const DoutPrefixProvider *dpp)
do {
if (lease_cr && !lease_cr->is_locked()) {
drain_all();
yield call(marker_tracker.flush());
tn->log(1, "no lease or lease is lost, abort");
return set_cr_error(-ECANCELED);
}
@ -4618,6 +4623,7 @@ int RGWBucketShardIncrementalSyncCR::operate(const DoutPrefixProvider *dpp)
if (retcode < 0 && retcode != -ENOENT) {
/* wait for all operations to complete */
drain_all();
yield spawn(marker_tracker.flush(), true);
return set_cr_error(retcode);
}
list_result = std::move(extended_result.entries);
@ -4665,6 +4671,7 @@ int RGWBucketShardIncrementalSyncCR::operate(const DoutPrefixProvider *dpp)
for (; entries_iter != entries_end; ++entries_iter) {
if (lease_cr && !lease_cr->is_locked()) {
drain_all();
yield call(marker_tracker.flush());
tn->log(1, "no lease or lease is lost, abort");
return set_cr_error(-ECANCELED);
}
@ -5505,6 +5512,7 @@ int RGWSyncBucketCR::operate(const DoutPrefixProvider *dpp)
using ReadCR = RGWSimpleRadosReadCR<rgw_bucket_sync_status>;
using WriteCR = RGWSimpleRadosWriteCR<rgw_bucket_sync_status>;
objv.clear();
yield call(new ReadCR(dpp, env->async_rados, env->svc->sysobj,
status_obj, &bucket_status, false, &objv));
if (retcode == -ENOENT) {
@ -5516,6 +5524,7 @@ int RGWSyncBucketCR::operate(const DoutPrefixProvider *dpp)
if (retcode == -EEXIST) {
// raced with another create, read its status
tn->log(20, "raced with another create, read its status");
objv.clear();
yield call(new ReadCR(dpp, env->async_rados, env->svc->sysobj,
status_obj, &bucket_status, false, &objv));
}
@ -5565,6 +5574,7 @@ int RGWSyncBucketCR::operate(const DoutPrefixProvider *dpp)
}
// check if local state is "stopped"
objv.clear();
yield call(new ReadCR(dpp, env->async_rados, env->svc->sysobj,
status_obj, &bucket_status, false, &objv));
if (retcode < 0) {
@ -5613,6 +5623,7 @@ int RGWSyncBucketCR::operate(const DoutPrefixProvider *dpp)
}
// reread the status after acquiring the lock
objv.clear();
yield call(new ReadCR(dpp, env->async_rados, env->svc->sysobj,
status_obj, &bucket_status, false, &objv));
if (retcode < 0) {