diff options
author | Etienne Petrel <etienne.petrel@mongodb.com> | 2023-02-13 21:33:04 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-02-14 03:28:52 +0000 |
commit | 19453179bf75314b511368a978f41c7626cc4e6c (patch) | |
tree | 600095f90e5ed778b22c18905ed3b0c4da58d5d5 | |
parent | f5e1e55d74fcab396bb3e3e54bd0341bb51c2898 (diff) | |
download | mongo-19453179bf75314b511368a978f41c7626cc4e6c.tar.gz |
Import wiredtiger: fa1ea9f917c56947c5ca22185285d29f713e6401 from branch mongodb-master
ref: 604dd69988..fa1ea9f917
for: 7.0.0-rc0
WT-10585 Record the location of the last key to help debug key out of order
-rw-r--r-- | src/third_party/wiredtiger/import.data | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_curnext.c | 17 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_cursor.c | 3 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/cursor.h | 5 |
4 files changed, 25 insertions, 2 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 332601000e4..58447dce7ce 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -2,5 +2,5 @@ "vendor": "wiredtiger", "github": "wiredtiger/wiredtiger.git", "branch": "mongodb-master", - "commit": "604dd69988250e1c8698cf7e5ac5dbce4a8f88f7" + "commit": "fa1ea9f917c56947c5ca22185285d29f713e6401" } diff --git a/src/third_party/wiredtiger/src/btree/bt_curnext.c b/src/third_party/wiredtiger/src/btree/bt_curnext.c index fa2db5a02e1..a2460c5dffd 100644 --- a/src/third_party/wiredtiger/src/btree/bt_curnext.c +++ b/src/third_party/wiredtiger/src/btree/bt_curnext.c @@ -581,6 +581,9 @@ __cursor_key_order_check_col(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, boo if (cbt->lastrecno == WT_RECNO_OOB || (next && cmp < 0) || (!next && cmp > 0)) { cbt->lastrecno = cbt->recno; + cbt->lastref = cbt->ref; + cbt->lastslot = cbt->slot; + cbt->lastins = cbt->ins; return (0); } @@ -616,8 +619,12 @@ __cursor_key_order_check_row(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, boo if (cbt->lastkey->size != 0) WT_RET(__wt_compare(session, btree->collator, cbt->lastkey, key, &cmp)); - if (cbt->lastkey->size == 0 || (next && cmp < 0) || (!next && cmp > 0)) + if (cbt->lastkey->size == 0 || (next && cmp < 0) || (!next && cmp > 0)) { + cbt->lastref = cbt->ref; + cbt->lastslot = cbt->slot; + cbt->lastins = cbt->ins; return (__wt_buf_set(session, cbt->lastkey, cbt->iface.key.data, cbt->iface.key.size)); + } WT_ERR(__wt_scr_alloc(session, 512, &a)); WT_ERR(__wt_scr_alloc(session, 512, &b)); @@ -669,6 +676,10 @@ __wt_cursor_key_order_init(WT_CURSOR_BTREE *cbt) session = CUR2S(cbt); + cbt->lastref = cbt->ref; + cbt->lastslot = cbt->slot; + cbt->lastins = cbt->ins; + /* * Cursor searches set the position for cursor movements, set the last-key value for diagnostic * checking. @@ -699,6 +710,10 @@ __wt_cursor_key_order_reset(WT_CURSOR_BTREE *cbt) if (cbt->lastkey != NULL) cbt->lastkey->size = 0; cbt->lastrecno = WT_RECNO_OOB; + + cbt->lastref = NULL; + cbt->lastslot = UINT32_MAX; + cbt->lastins = NULL; } #endif diff --git a/src/third_party/wiredtiger/src/btree/bt_cursor.c b/src/third_party/wiredtiger/src/btree/bt_cursor.c index 3b5c1c19dfb..71a8a5f2365 100644 --- a/src/third_party/wiredtiger/src/btree/bt_cursor.c +++ b/src/third_party/wiredtiger/src/btree/bt_cursor.c @@ -2265,6 +2265,9 @@ __wt_btcur_open(WT_CURSOR_BTREE *cbt) #ifdef HAVE_DIAGNOSTIC cbt->lastkey = &cbt->_lastkey; cbt->lastrecno = WT_RECNO_OOB; + cbt->lastref = NULL; + cbt->lastslot = UINT32_MAX; + cbt->lastins = NULL; #endif } diff --git a/src/third_party/wiredtiger/src/include/cursor.h b/src/third_party/wiredtiger/src/include/cursor.h index d701d7f2a4f..0a5aa9c5821 100644 --- a/src/third_party/wiredtiger/src/include/cursor.h +++ b/src/third_party/wiredtiger/src/include/cursor.h @@ -240,6 +240,11 @@ struct __wt_cursor_btree { /* Check that cursor next/prev never returns keys out-of-order. */ WT_ITEM *lastkey, _lastkey; uint64_t lastrecno; + + /* Record where the last key is when we see it to help debugging out of order issues. */ + WT_REF *lastref; /* The page where the last key is */ + uint32_t lastslot; /* WT_COL/WT_ROW 0-based slot */ + WT_INSERT *lastins; /* The last insert list */ #endif /* AUTOMATIC FLAG VALUE GENERATION START 0 */ |