Skip to content

Commit a075036

Browse files
committed
MB-41658: Expand error message when non-dirty item found during persistence
PersistenceCallback::operator() should always find a dirty item _if_ the seqno matches however crash/warmup tests intermittently fail this check. Dump additional details to assist in diagnosing issue if it reoccurs. Change-Id: Ifa581ef552a12c652cf9756a591e19cce3c18a73 Reviewed-on: http://review.couchbase.org/c/kv_engine/+/137355 Tested-by: Build Bot <[email protected]> Reviewed-by: Ben Huddleston <[email protected]>
1 parent 8330f81 commit a075036

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

engines/ep/src/persistence_callback.cc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "item.h"
2222
#include "stats.h"
2323
#include "vbucket.h"
24+
#include <utilities/logtags.h>
2425

2526
PersistenceCallback::PersistenceCallback() {
2627
}
@@ -45,7 +46,22 @@ void PersistenceCallback::operator()(TransactionContext& txCtx,
4546
auto res = vbucket.ht.findItem(*queuedItem);
4647
auto* v = res.storedValue;
4748
if (v && (v->getBySeqno() == queuedItem->getBySeqno())) {
48-
Expects(v->isDirty());
49+
if (!v->isDirty()) {
50+
// MB-41658: Found item _should_ always be dirty, but
51+
// crash/warmup tests intermittently fail this check. Dump
52+
// additional details to assist in diagnosing issue if it
53+
// reoccurs.
54+
std::stringstream itemSS;
55+
itemSS << *queuedItem;
56+
std::stringstream svSS;
57+
svSS << *v;
58+
throw std::logic_error(fmt::format(
59+
"PersistenceCallback::operator() - Expected "
60+
"resident item matching queuedItem to be dirty!\n"
61+
"\tqueuedItem:{}\n\tv:{}",
62+
cb::UserData{itemSS.str()},
63+
cb::UserData{svSS.str()}));
64+
}
4965
v->markClean();
5066
}
5167
}
@@ -127,4 +143,4 @@ void EPTransactionContext::setCallback(const queued_item& item,
127143
void EPTransactionContext::deleteCallback(const queued_item& item,
128144
KVStore::FlushStateDeletion state) {
129145
cb(*this, item, state);
130-
}
146+
}

0 commit comments

Comments
 (0)