Skip to content

Commit 0428ccd

Browse files
BenHuddlestondaverigby
authored andcommitted
MB-41942: Change PCS/PPS GSL asserts to exceptions
Change PCS and PPS GSL assertions in EPBucket::flushVBucket to normal exceptions so that we can log some extra information about the issue (the checkpoint type that we are currently processing). This will help us narrow down the code paths that may be taken in this function when we are attempting to update the value. Change-Id: I58ab0b8c61554aa151c91022d6d740f9d5d2902c Reviewed-on: http://review.couchbase.org/c/kv_engine/+/141052 Reviewed-by: Dave Rigby <[email protected]> Tested-by: Build Bot <[email protected]>
1 parent 5cd2cdf commit 0428ccd

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

engines/ep/src/ep_bucket.cc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,12 +692,28 @@ EPBucket::FlushResult EPBucket::flushVBucket(Vbid vbid) {
692692
}
693693

694694
if (hcs) {
695-
Expects(hcs > proposedVBState.persistedCompletedSeqno);
695+
if (hcs <= proposedVBState.persistedCompletedSeqno) {
696+
throw std::logic_error(
697+
"EPBucket::flushVBucket: " + vbid.to_string() +
698+
" Trying to set PCS to " + std::to_string(*hcs) +
699+
" but the current value is " +
700+
std::to_string(proposedVBState.persistedCompletedSeqno) +
701+
" and the PCS must be monotonic. The current checkpoint " +
702+
"type is " + to_string(toFlush.checkpointType));
703+
}
696704
proposedVBState.persistedCompletedSeqno = *hcs;
697705
}
698706

699707
if (hps) {
700-
Expects(hps > proposedVBState.persistedPreparedSeqno);
708+
if (hps <= proposedVBState.persistedPreparedSeqno) {
709+
throw std::logic_error(
710+
"EPBucket::flushVBucket: " + vbid.to_string() +
711+
" Trying to set PPS to " + std::to_string(*hps) +
712+
" but the current value is " +
713+
std::to_string(proposedVBState.persistedPreparedSeqno) +
714+
" and the PPS must be monotonic. The current checkpoint " +
715+
"type is " + to_string(toFlush.checkpointType));
716+
}
701717
proposedVBState.persistedPreparedSeqno = *hps;
702718
}
703719

0 commit comments

Comments
 (0)