From: gengjichao Date: Mon, 20 Jul 2020 02:33:00 +0000 (+0800) Subject: rgw: read incremental metalog from master cluster based on truncate variable X-Git-Tag: v17.2.7~388^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=60ef5d8d4f09caea9fbe4547fa22e453ec6283d2;p=ceph.git rgw: read incremental metalog from master cluster based on truncate variable when the log entry in the meta.log object of the secondary cluster is empty, the value of max_marker is also empty,which can't meet the requirement that mdlog_marker <= max_marker,resulting in that the secondary cluster can't fetch new log entry from the master cluster and infinite loop,finally, the secondary cluster's metadata can't catch up the master cluster. when the truncate is false, it means that the secondary cluster's meta.log is empyt,we can read more from master cluster. Fixes: https://tracker.ceph.com/issues/46563 Signed-off-by: gengjichao (cherry picked from commit 2ed1c3e28a326e1422b0b6af47dd0af300ae85a2) (cherry picked from commit 3b61154d39d6c4a1f29c6464e588589155982fcd) --- diff --git a/src/rgw/rgw_sync.cc b/src/rgw/rgw_sync.cc index bcf2bc230b38..6cf50171836b 100644 --- a/src/rgw/rgw_sync.cc +++ b/src/rgw/rgw_sync.cc @@ -1762,13 +1762,13 @@ public: break; } #define INCREMENTAL_MAX_ENTRIES 100 - ldpp_dout(sync_env->dpp, 20) << __func__ << ":" << __LINE__ << ": shard_id=" << shard_id << " mdlog_marker=" << mdlog_marker << " sync_marker.marker=" << sync_marker.marker << " period_marker=" << period_marker << dendl; + ldpp_dout(sync_env->dpp, 20) << __func__ << ":" << __LINE__ << ": shard_id=" << shard_id << " mdlog_marker=" << mdlog_marker << " sync_marker.marker=" << sync_marker.marker << " period_marker=" << period_marker << " truncated=" << truncated << dendl; if (!period_marker.empty() && period_marker <= mdlog_marker) { tn->log(10, SSTR("finished syncing current period: mdlog_marker=" << mdlog_marker << " sync_marker=" << sync_marker.marker << " period_marker=" << period_marker)); done_with_period = true; break; } - if (mdlog_marker <= max_marker) { + if (mdlog_marker <= max_marker || !truncated) { /* we're at the tip, try to bring more entries */ ldpp_dout(sync_env->dpp, 20) << __func__ << ":" << __LINE__ << ": shard_id=" << shard_id << " syncing mdlog for shard_id=" << shard_id << dendl; yield call(new RGWCloneMetaLogCoroutine(sync_env, mdlog,