diff --git a/engines/ep/src/vbucket.cc b/engines/ep/src/vbucket.cc index 08f2963a53..121c941038 100644 --- a/engines/ep/src/vbucket.cc +++ b/engines/ep/src/vbucket.cc @@ -186,14 +186,6 @@ VBucket::VBucket(Vbid i, const nlohmann::json& replTopology, uint64_t maxVisibleSeqno) : ht(st, std::move(valFact), config.getHtSize(), config.getHtLocks()), - checkpointManager(std::make_unique(st, - i, - chkConfig, - lastSeqno, - lastSnapStart, - lastSnapEnd, - maxVisibleSeqno, - flusherCb)), failovers(std::move(table)), opsCreate(0), opsDelete(0), @@ -216,6 +208,14 @@ VBucket::VBucket(Vbid i, id(i), state(newState), initialState(initState), + checkpointManager(std::make_unique(st, + i, + chkConfig, + lastSeqno, + lastSnapStart, + lastSnapEnd, + maxVisibleSeqno, + flusherCb)), purge_seqno(purgeSeqno), takeover_backed_up(false), persistedRange(lastSnapStart, lastSnapEnd), diff --git a/engines/ep/src/vbucket.h b/engines/ep/src/vbucket.h index 77e8c944c9..06778a8106 100644 --- a/engines/ep/src/vbucket.h +++ b/engines/ep/src/vbucket.h @@ -907,9 +907,6 @@ class VBucket : public std::enable_shared_from_this { HashTable ht; - /// Manager of this vBucket's checkpoints. unique_ptr for pimpl. - std::unique_ptr checkpointManager; - /** * Searches for a 'valid' StoredValue in the VBucket. * @@ -2471,6 +2468,15 @@ class VBucket : public std::enable_shared_from_this { vbucket_state_t initialState; +public: + /** + * Manager of this vBucket's checkpoints. unique_ptr for pimpl. + * Declared after state as Checkpoint destruction may update stats + * based on the vbucket's current state. + */ + std::unique_ptr checkpointManager; + +private: /** * The replication topology, set as part of SET_VBUCKET_STATE. * It is encoded as nlohmann::json array of (max 2) replication chains.