@@ -36,8 +36,8 @@ PassiveDurabilityMonitor::PassiveDurabilityMonitor(VBucket& vb)
3636 : vb(vb), state(std::make_unique<State>(*this )) {
3737 // By design, instances of Container::Position can never be invalid
3838 auto s = state.wlock ();
39- s->highPreparedSeqno = Position ( s->trackedWrites .end () );
40- s->highCompletedSeqno = Position ( s->trackedWrites .end () );
39+ s->highPreparedSeqno . it = s->trackedWrites .end ();
40+ s->highCompletedSeqno . it = s->trackedWrites .end ();
4141}
4242
4343PassiveDurabilityMonitor::PassiveDurabilityMonitor (VBucket& vb,
@@ -419,14 +419,21 @@ int64_t PassiveDurabilityMonitor::getHighestTrackedSeqno() const {
419419}
420420
421421void PassiveDurabilityMonitor::toOStream (std::ostream& os) const {
422- os << " PassiveDurabilityMonitor[" << this << " ]"
423- << " high_prepared_seqno:" << getHighPreparedSeqno ()
424- << " trackedWrites:\n " ;
425- state.withRLock ([&os](auto & s) {
426- for (const auto & w : s.trackedWrites ) {
427- os << " " << w << " \n " ;
428- }
429- });
422+ os << " PassiveDurabilityMonitor[" << this << " ] " << *state.rlock ();
423+ }
424+
425+ PassiveDurabilityMonitor::State::State (const PassiveDurabilityMonitor& pdm)
426+ : pdm(pdm) {
427+ const auto prefix =
428+ " PassiveDM(" + pdm.vb .getId ().to_string () + " )::State::" ;
429+
430+ const auto hpsPrefix = prefix + " highPreparedSeqno" ;
431+ highPreparedSeqno.lastWriteSeqno .setLabel (hpsPrefix + " .lastWriteSeqno" );
432+ highPreparedSeqno.lastAckSeqno .setLabel (hpsPrefix + " .lastAckSeqno" );
433+
434+ const auto hcsPrefix = prefix + " highCompletedSeqno" ;
435+ highCompletedSeqno.lastWriteSeqno .setLabel (hcsPrefix + " .lastWriteSeqno" );
436+ highCompletedSeqno.lastAckSeqno .setLabel (hcsPrefix + " .lastAckSeqno" );
430437}
431438
432439DurabilityMonitor::Container::iterator
@@ -616,3 +623,17 @@ template <class exception>
616623 throw exception (" PassiveDurabilityMonitor::" + thrower + " " +
617624 vb.getId ().to_string () + " " + error);
618625}
626+
627+ std::ostream& operator <<(std::ostream& os,
628+ const PassiveDurabilityMonitor::State& state) {
629+ os << " State[" << &state << " ] highPreparedSeqno:"
630+ << to_string (state.highPreparedSeqno , state.trackedWrites .end ())
631+ << " highCompletedSeqno:"
632+ << to_string (state.highCompletedSeqno , state.trackedWrites .end ())
633+ << " \n trackedWrites:[\n " ;
634+ for (const auto & w : state.trackedWrites ) {
635+ os << " " << w << " \n " ;
636+ }
637+ os << " ]\n " ;
638+ return os;
639+ }
0 commit comments