Skip to content

Commit

Permalink
MB-49767: Fix and enhance logging in EPBucket::flushVBucket_UNLOCKED
Browse files Browse the repository at this point in the history
Update the log messages in EPBucket::flushVBucket_UNLOCKED to log the
fact there from EPBucket::flushVBucket_UNLOCKED not
EPBucket::flushVBucket(). Also enhance the log messages for the high
completed/prepare seqno exceptions for when a flush tries to break their
monotonic property. By adding extra information regarding the min and
max seqno's that are meant to be flushed to disk and what the proposed
vbucket state was going to be.

Change-Id: I72231a6ffa475e6b963d816dbf63ac3a0ce4bbb5
Reviewed-on: https://review.couchbase.org/c/kv_engine/+/166622
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Paolo Cocchi <paolo.cocchi@couchbase.com>
  • Loading branch information
rdemellow committed Dec 1, 2021
1 parent 5e4b5ea commit 58958d4
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions engines/ep/src/ep_bucket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,8 @@ EPBucket::FlushResult EPBucket::flushVBucket_UNLOCKED(LockedVBucketPtr vb) {
while (!ctx) {
++stats.beginFailed;
EP_LOG_WARN(
"EPBucket::flushVBucket: () Failed to start a transaction. "
"EPBucket::flushVBucket_UNLOCKED: () Failed to start a "
"transaction. "
"Retry in 1 second.",
vb->getId());
std::this_thread::sleep_for(std::chrono::seconds(1));
Expand Down Expand Up @@ -453,7 +454,8 @@ EPBucket::FlushResult EPBucket::flushVBucket_UNLOCKED(LockedVBucketPtr vb) {
bool logged = false;
const auto callback = [this, &logged, vbid](const std::system_error& err) {
if (!logged) {
EP_LOG_WARN("EPBucket::flushVBucket: {} {}", vbid, err.what());
EP_LOG_WARN(
"EPBucket::flushVBucket_UNLOCKED: {} {}", vbid, err.what());
logged = true;
}

Expand Down Expand Up @@ -731,27 +733,37 @@ EPBucket::FlushResult EPBucket::flushVBucket_UNLOCKED(LockedVBucketPtr vb) {
if (hcs) {
if (hcs <= proposedVBState.persistedCompletedSeqno) {
throw std::logic_error(fmt::format(
"EPBucket::flushVBucket: {} Trying to set PCS to {} but "
"EPBucket::flushVBucket_UNLOCKED: {} Trying to set PCS to "
"{} but "
"the current value is {} and the PCS must be monotonic. "
"The current checkpoint type is {}",
"The current checkpoint type is {}. Flush's seqno "
"range:[{},{}], proposedVBState:'{}'.",
vbid,
*hcs,
proposedVBState.persistedCompletedSeqno,
to_string(toFlush.checkpointType)));
to_string(toFlush.checkpointType),
minSeqno,
maxSeqno,
proposedVBState));
}
proposedVBState.persistedCompletedSeqno = *hcs;
}

if (hps) {
if (hps <= proposedVBState.persistedPreparedSeqno) {
throw std::logic_error(fmt::format(
"EPBucket::flushVBucket: {} Trying to set PPS to {} but "
"EPBucket::flushVBucket_UNLOCKED: {} Trying to set PPS to "
"{} but "
"the current value is {} and the PPS must be monotonic. "
"The current checkpoint type is {}",
"The current checkpoint type is {}. Flush's seqno "
"range:[{},{}], proposedVBState:'{}'.",
vbid,
*hps,
proposedVBState.persistedPreparedSeqno,
to_string(toFlush.checkpointType)));
to_string(toFlush.checkpointType),
minSeqno,
maxSeqno,
proposedVBState));
}
proposedVBState.persistedPreparedSeqno = *hps;
}
Expand Down

0 comments on commit 58958d4

Please sign in to comment.