Skip to content

Commit bae10f2

Browse files
author
Shilpa Jagannath
committed
rgw/multisite: in order to sleep between mdlog polling events, we check if the mdlog_marker is not modified by comparing
mdlog_marker and max_marker. but max_marker is exposed to changes from RGWReadMDLogEntriesCR, and if there is a race coming from mdlog trimming which could render max_marker empty, then its comparison with mdlog polling can be incorrect. To fix this, we now save the previous mdlog marker and compare with the updated mdlog marker. Signed-off-by: Shilpa Jagannath <[email protected]>
1 parent 82ddbb6 commit bae10f2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/rgw/driver/rados/rgw_sync.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1446,6 +1446,7 @@ class RGWMetaSyncShardCR : public RGWCoroutine {
14461446
bool done_with_period = false;
14471447

14481448
int total_entries = 0;
1449+
string old_mdlog_marker;
14491450

14501451
RGWSyncTraceNodeRef tn;
14511452
public:
@@ -1797,6 +1798,7 @@ class RGWMetaSyncShardCR : public RGWCoroutine {
17971798
if (mdlog_marker <= max_marker || !truncated) {
17981799
/* we're at the tip, try to bring more entries */
17991800
ldpp_dout(sync_env->dpp, 20) << __func__ << ":" << __LINE__ << ": shard_id=" << shard_id << " syncing mdlog for shard_id=" << shard_id << dendl;
1801+
old_mdlog_marker = mdlog_marker;
18001802
yield call(new RGWCloneMetaLogCoroutine(sync_env, mdlog,
18011803
period, shard_id,
18021804
mdlog_marker, &mdlog_marker));
@@ -1867,7 +1869,8 @@ class RGWMetaSyncShardCR : public RGWCoroutine {
18671869
tn->log(10, SSTR(*this << ": done with period"));
18681870
break;
18691871
}
1870-
if (mdlog_marker == max_marker && can_adjust_marker) {
1872+
if (mdlog_marker == old_mdlog_marker && can_adjust_marker) {
1873+
tn->log(20, SSTR("mdlog_marker=" << mdlog_marker << " old_mdlog_marker=" << old_mdlog_marker));
18711874
tn->unset_flag(RGW_SNS_FLAG_ACTIVE);
18721875
yield wait(utime_t(cct->_conf->rgw_meta_sync_poll_interval, 0));
18731876
}

0 commit comments

Comments
 (0)