summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <andrew.morton@mongodb.com>2023-05-16 22:21:26 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-17 00:50:01 +0000
commitfa0e0ce777f0c3a438449a6bd1fb1b96fa5d8531 (patch)
tree459a82960061e9beadbf949d59a20c0025a642da
parent376eae9eefe9f752d8d9b5189528f1353c019e54 (diff)
downloadmongo-fa0e0ce777f0c3a438449a6bd1fb1b96fa5d8531.tar.gz
Import wiredtiger: 8dc1c0b0f1381773a0d13d5751ec724f23f77709 from branch mongodb-master
ref: 04dcc36204..8dc1c0b0f1 for: 7.1.0-rc0 WT-11049 Always check prefix skipped search results in diagnostic builds
-rwxr-xr-xsrc/third_party/wiredtiger/dist/s_void1
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/include/btree_cmp_inline.h22
3 files changed, 21 insertions, 4 deletions
diff --git a/src/third_party/wiredtiger/dist/s_void b/src/third_party/wiredtiger/dist/s_void
index 9dd52648142..98dd0500be2 100755
--- a/src/third_party/wiredtiger/dist/s_void
+++ b/src/third_party/wiredtiger/dist/s_void
@@ -74,6 +74,7 @@ func_ok()
-e '/int __wt_epoch$/d' \
-e '/int __wt_errno$/d' \
-e '/int __wt_get_vm_pagesize$/d' \
+ -e '/int __wt_lex_compare_skip$/d' \
-e '/int __wt_lsm_manager_pop_entry$/d' \
-e '/int __wt_once$/d' \
-e '/int __wt_posix_directory_list_free$/d' \
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 76fb2781f75..d6619336b55 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": "04dcc362042b8cc35fdd8de8343be3a15d4fa47c"
+ "commit": "8dc1c0b0f1381773a0d13d5751ec724f23f77709"
}
diff --git a/src/third_party/wiredtiger/src/include/btree_cmp_inline.h b/src/third_party/wiredtiger/src/include/btree_cmp_inline.h
index d71315e0964..672627883b0 100644
--- a/src/third_party/wiredtiger/src/include/btree_cmp_inline.h
+++ b/src/third_party/wiredtiger/src/include/btree_cmp_inline.h
@@ -176,6 +176,7 @@ __wt_lex_compare_skip(const WT_ITEM *user_item, const WT_ITEM *tree_item, size_t
{
size_t len, usz, tsz;
const uint8_t *userp, *treep;
+ int ret_val;
usz = user_item->size;
tsz = tree_item->size;
@@ -231,15 +232,30 @@ __wt_lex_compare_skip(const WT_ITEM *user_item, const WT_ITEM *tree_item, size_t
len += remain;
}
#endif
+ ret_val = 0;
/*
* Use the non-vectorized version for the remaining bytes and for the small key sizes.
*/
for (; len > 0; --len, ++userp, ++treep, ++*matchp)
- if (*userp != *treep)
- return (*userp < *treep ? -1 : 1);
+ if (*userp != *treep) {
+ ret_val = *userp < *treep ? -1 : 1;
+ break;
+ }
/* Contents are equal up to the smallest length. */
- return ((usz == tsz) ? 0 : (usz < tsz) ? -1 : 1);
+ if (ret_val == 0)
+ ret_val = ((usz == tsz) ? 0 : (usz < tsz) ? -1 : 1);
+ /* In diagnostic mode ensure that short comparisons work as expected */
+#ifdef HAVE_DIAGNOSTIC
+ {
+ int full_cmp_ret;
+ full_cmp_ret = __wt_lex_compare(user_item, tree_item);
+ WT_ASSERT_ALWAYS(NULL, full_cmp_ret == ret_val,
+ "Comparison that skipped prefix returned different result than a full comparison");
+ }
+#endif
+
+ return (ret_val);
}
/*