summaryrefslogtreecommitdiff
path: root/src/third_party
diff options
context:
space:
mode:
authorWill Korteland <will.korteland@mongodb.com>2022-10-05 22:11:17 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-10-05 22:46:35 +0000
commitf05bb67dc90d958378eceac0ed51dff27009c0da (patch)
tree221f46f3a283b3844b74f030e56911540121fb92 /src/third_party
parentd6d173a9b100fadd83d0ef6d05263f419bc05258 (diff)
downloadmongo-f05bb67dc90d958378eceac0ed51dff27009c0da.tar.gz
Import wiredtiger: 50dfedb57cd146ce65cb96d51713a57c6bb33605 from branch mongodb-master
ref: 0b175608ea..50dfedb57c for: 6.2.0-rc0 WT-9935 Add assert to ensure we are not returning overflow removed value to the reader (#8317)
Diffstat (limited to 'src/third_party')
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_ret.c22
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_version.c8
-rw-r--r--src/third_party/wiredtiger/src/include/extern.h8
-rw-r--r--src/third_party/wiredtiger/src/include/txn_inline.h17
-rw-r--r--src/third_party/wiredtiger/src/support/modify.c18
6 files changed, 66 insertions, 9 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 19c4dcbb7d3..ad44398b714 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": "0b175608ea39175c9bbbbefecba7b5800cff80e9"
+ "commit": "50dfedb57cd146ce65cb96d51713a57c6bb33605"
}
diff --git a/src/third_party/wiredtiger/src/btree/bt_ret.c b/src/third_party/wiredtiger/src/btree/bt_ret.c
index f8f7d45cea7..68ffafead5a 100644
--- a/src/third_party/wiredtiger/src/btree/bt_ret.c
+++ b/src/third_party/wiredtiger/src/btree/bt_ret.c
@@ -191,12 +191,18 @@ __wt_read_cell_time_window(WT_CURSOR_BTREE *cbt, WT_TIME_WINDOW *tw)
* Change a buffer to reference an internal original-page return value.
*/
int
-__wt_value_return_buf(WT_CURSOR_BTREE *cbt, WT_REF *ref, WT_ITEM *buf, WT_TIME_WINDOW *tw)
+__wt_value_return_buf(WT_CURSOR_BTREE *cbt, WT_REF *ref, WT_ITEM *buf, WT_TIME_WINDOW *tw
+#ifdef HAVE_DIAGNOSTIC
+ ,
+ bool *is_ovfl_rm
+#endif
+)
{
WT_BTREE *btree;
WT_CELL *cell;
WT_CELL_UNPACK_KV unpack;
WT_CURSOR *cursor;
+ WT_DECL_RET;
WT_PAGE *page;
WT_ROW *rip;
WT_SESSION_IMPL *session;
@@ -227,7 +233,12 @@ __wt_value_return_buf(WT_CURSOR_BTREE *cbt, WT_REF *ref, WT_ITEM *buf, WT_TIME_W
__wt_row_leaf_value_cell(session, page, rip, &unpack);
if (tw != NULL)
WT_TIME_WINDOW_COPY(tw, &unpack.tw);
- return (__wt_page_cell_data_ref(session, page, &unpack, buf));
+ ret = __wt_page_cell_data_ref(session, page, &unpack, buf);
+#ifdef HAVE_DIAGNOSTIC
+ if (ret == 0 && unpack.cell != NULL && is_ovfl_rm != NULL)
+ *is_ovfl_rm = __wt_cell_type_raw(unpack.cell) == WT_CELL_VALUE_OVFL_RM;
+#endif
+ return (ret);
case WT_PAGE_COL_VAR:
/* Take the value from the original page cell. */
@@ -235,7 +246,12 @@ __wt_value_return_buf(WT_CURSOR_BTREE *cbt, WT_REF *ref, WT_ITEM *buf, WT_TIME_W
__wt_cell_unpack_kv(session, page->dsk, cell, &unpack);
if (tw != NULL)
WT_TIME_WINDOW_COPY(tw, &unpack.tw);
- return (__wt_page_cell_data_ref(session, page, &unpack, buf));
+ ret = __wt_page_cell_data_ref(session, page, &unpack, buf);
+#ifdef HAVE_DIAGNOSTIC
+ if (ret == 0 && unpack.cell != NULL && is_ovfl_rm != NULL)
+ *is_ovfl_rm = __wt_cell_type_raw(unpack.cell) == WT_CELL_VALUE_OVFL_RM;
+#endif
+ return (ret);
case WT_PAGE_COL_FIX:
/* Take the value from the original page. */
diff --git a/src/third_party/wiredtiger/src/cursor/cur_version.c b/src/third_party/wiredtiger/src/cursor/cur_version.c
index 6bb323ffe74..ecb65bb424d 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_version.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_version.c
@@ -308,7 +308,13 @@ __curversion_next_int(WT_CURSOR *cursor)
}
/* Get the ondisk value. */
- WT_ERR(__wt_value_return_buf(cbt, cbt->ref, &cbt->upd_value->buf, &cbt->upd_value->tw));
+ ret = __wt_value_return_buf(cbt, cbt->ref, &cbt->upd_value->buf, &cbt->upd_value->tw
+#ifdef HAVE_DIAGNOSTIC
+ ,
+ NULL
+#endif
+ );
+ WT_ERR(ret);
if (!WT_TIME_WINDOW_HAS_STOP(&cbt->upd_value->tw)) {
durable_stop_ts = version_cursor->upd_durable_stop_ts;
diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h
index 06b470ad408..c691744de7d 100644
--- a/src/third_party/wiredtiger/src/include/extern.h
+++ b/src/third_party/wiredtiger/src/include/extern.h
@@ -1648,8 +1648,12 @@ extern int __wt_update_vector_push(WT_UPDATE_VECTOR *updates, WT_UPDATE *upd)
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_upgrade(WT_SESSION_IMPL *session, const char *cfg[])
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
-extern int __wt_value_return_buf(WT_CURSOR_BTREE *cbt, WT_REF *ref, WT_ITEM *buf,
- WT_TIME_WINDOW *tw) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
+extern int __wt_value_return_buf(WT_CURSOR_BTREE *cbt, WT_REF *ref, WT_ITEM *buf, WT_TIME_WINDOW *tw
+#ifdef HAVE_DIAGNOSTIC
+ ,
+ bool *is_ovfl_rm
+#endif
+ ) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_verbose_config(WT_SESSION_IMPL *session, const char *cfg[], bool reconfig)
WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_verbose_dump_cache(WT_SESSION_IMPL *session)
diff --git a/src/third_party/wiredtiger/src/include/txn_inline.h b/src/third_party/wiredtiger/src/include/txn_inline.h
index 7c94909e721..44514ce410f 100644
--- a/src/third_party/wiredtiger/src/include/txn_inline.h
+++ b/src/third_party/wiredtiger/src/include/txn_inline.h
@@ -1045,12 +1045,19 @@ static inline int
__wt_txn_read(
WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_ITEM *key, uint64_t recno, WT_UPDATE *upd)
{
+ WT_DECL_RET;
WT_TIME_WINDOW tw;
WT_UPDATE *prepare_upd, *restored_upd;
bool have_stop_tw, retry;
+#ifdef HAVE_DIAGNOSTIC
+ bool is_ovfl_rm;
+#endif
prepare_upd = restored_upd = NULL;
retry = true;
+#ifdef HAVE_DIAGNOSTIC
+ is_ovfl_rm = false;
+#endif
retry:
WT_RET(__wt_txn_read_upd_list_internal(session, cbt, upd, &prepare_upd, &restored_upd));
@@ -1082,7 +1089,13 @@ retry:
have_stop_tw = WT_TIME_WINDOW_HAS_STOP(&cbt->upd_value->tw);
/* Check the ondisk value. */
- WT_RET(__wt_value_return_buf(cbt, cbt->ref, &cbt->upd_value->buf, &tw));
+ ret = __wt_value_return_buf(cbt, cbt->ref, &cbt->upd_value->buf, &tw
+#ifdef HAVE_DIAGNOSTIC
+ ,
+ &is_ovfl_rm
+#endif
+ );
+ WT_RET(ret);
/*
* If the stop time point is set, that means that there is a tombstone at that time. If it
@@ -1125,6 +1138,8 @@ retry:
cbt->upd_value->tw.start_txn = tw.start_txn;
cbt->upd_value->tw.prepare = tw.prepare;
cbt->upd_value->type = WT_UPDATE_STANDARD;
+ /* We should not return removed overflow value. */
+ WT_ASSERT(session, !is_ovfl_rm);
return (0);
}
}
diff --git a/src/third_party/wiredtiger/src/support/modify.c b/src/third_party/wiredtiger/src/support/modify.c
index b6556eae2f3..8c36a73a1aa 100644
--- a/src/third_party/wiredtiger/src/support/modify.c
+++ b/src/third_party/wiredtiger/src/support/modify.c
@@ -449,10 +449,16 @@ __wt_modify_reconstruct_from_upd_list(
WT_DECL_RET;
WT_TIME_WINDOW tw;
WT_UPDATE_VECTOR modifies;
+#ifdef HAVE_DIAGNOSTIC
+ bool is_ovfl_rm;
+#endif
WT_ASSERT(session, upd->type == WT_UPDATE_MODIFY);
cursor = &cbt->iface;
+#ifdef HAVE_DIAGNOSTIC
+ is_ovfl_rm = false;
+#endif
/* While we have a pointer to our original modify, grab this information. */
upd_value->tw.durable_start_ts = upd->durable_ts;
@@ -484,7 +490,17 @@ __wt_modify_reconstruct_from_upd_list(
*/
WT_ASSERT(session, cbt->slot != UINT32_MAX);
- WT_ERR(__wt_value_return_buf(cbt, cbt->ref, &upd_value->buf, &tw));
+ ret = __wt_value_return_buf(cbt, cbt->ref, &upd_value->buf, &tw
+#ifdef HAVE_DIAGNOSTIC
+ ,
+ &is_ovfl_rm
+#endif
+ );
+ WT_ERR(ret);
+
+ /* The base value cannot be a removed overflow value. */
+ WT_ASSERT(session, !is_ovfl_rm);
+
/*
* Applying modifies on top of a tombstone is invalid. So if we're using the onpage value,
* the stop time point should be unset.