From 60ef5d8d4f09caea9fbe4547fa22e453ec6283d2 Mon Sep 17 00:00:00 2001 From: gengjichao Date: Mon, 20 Jul 2020 10:33:00 +0800 Subject: [PATCH] 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) --- src/rgw/rgw_sync.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_sync.cc b/src/rgw/rgw_sync.cc index bcf2bc230b388..6cf50171836bf 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, -- 2.39.5