0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-53599 Log collection name on invariant

This commit is contained in:
Bynn Lee 2021-02-22 15:33:34 +00:00 committed by Evergreen Agent
parent c2569f1751
commit 8b9167a79d
2 changed files with 24 additions and 2 deletions

View File

@ -1724,7 +1724,14 @@ Status WiredTigerRecordStore::updateRecord(OperationContext* opCtx,
CursorKey key = makeCursorKey(id);
setKey(c, key);
int ret = wiredTigerPrepareConflictRetry(opCtx, [&] { return c->search(c); });
invariantWTOK(ret);
invariantWTOK(ret,
str::stream() << "Namespace: " << ns() << "; Key: " << getKey(c)
<< "; Read Timestamp: "
<< opCtx->recoveryUnit()
->getPointInTimeReadTimestamp(opCtx)
.value_or(Timestamp{})
.toString());
auto& metricsCollector = ResourceConsumption::MetricsCollector::get(opCtx);
metricsCollector.incrementOneCursorSeek();

View File

@ -58,7 +58,7 @@ inline Status wtRCToStatus(int retCode, const char* prefix = nullptr) {
return wtRCToStatus_slow(retCode, prefix);
}
#define invariantWTOK(expression) \
#define MONGO_invariantWTOK_1(expression) \
do { \
int _invariantWTOK_retCode = expression; \
if (MONGO_unlikely(_invariantWTOK_retCode != 0)) { \
@ -67,6 +67,21 @@ inline Status wtRCToStatus(int retCode, const char* prefix = nullptr) {
} \
} while (false)
#define MONGO_invariantWTOK_2(expression, contextExpr) \
do { \
int _invariantWTOK_retCode = expression; \
if (MONGO_unlikely(_invariantWTOK_retCode != 0)) { \
invariantOKFailedWithMsg(#expression, \
wtRCToStatus(_invariantWTOK_retCode), \
contextExpr, \
__FILE__, \
__LINE__); \
} \
} while (false)
#define invariantWTOK(...) \
MONGO_expand(MONGO_expand(BOOST_PP_OVERLOAD(MONGO_invariantWTOK_, __VA_ARGS__))(__VA_ARGS__))
struct WiredTigerItem : public WT_ITEM {
WiredTigerItem(const void* d, size_t s) {
data = d;