summaryrefslogtreecommitdiff
path: root/src/third_party
diff options
context:
space:
mode:
authorChenhao Qu <chenhao.qu@mongodb.com>2020-11-30 02:53:12 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-11-30 03:14:30 +0000
commit90f767adbb1901d007ee4dd8714f53402d893669 (patch)
treef656e9b7000c984f2613eba9a8e7202522bc10a2 /src/third_party
parentcca3644a4618b223dd716ef2b98ec856d229a295 (diff)
downloadmongo-90f767adbb1901d007ee4dd8714f53402d893669.tar.gz
Import wiredtiger: 03e6f10ef2c6bc8acd7ee747d3aeda9db9efca1a from branch mongodb-5.0
ref: f08adbc5b4..03e6f10ef2 for: 4.9.0 WT-6896 Initial implementation of hs cursor remove
Diffstat (limited to 'src/third_party')
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_hs.c57
2 files changed, 56 insertions, 3 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index c2bd5ba7947..cffddf09cb3 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-5.0",
- "commit": "f08adbc5b4ced8ea39decd4da4efd40cdce768ec"
+ "commit": "03e6f10ef2c6bc8acd7ee747d3aeda9db9efca1a"
}
diff --git a/src/third_party/wiredtiger/src/cursor/cur_hs.c b/src/third_party/wiredtiger/src/cursor/cur_hs.c
index 923b9941d0e..fa89e6bd0f9 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_hs.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_hs.c
@@ -645,16 +645,69 @@ __curhs_insert(WT_CURSOR *cursor)
hs_tombstone = NULL;
}
+retry:
/* Search the page and insert the updates. */
WT_WITH_PAGE_INDEX(session, ret = __wt_hs_row_search(cbt, &file_cursor->key, true));
WT_ERR(ret);
- WT_ERR(__wt_hs_modify(cbt, hs_upd));
+ ret = __wt_hs_modify(cbt, hs_upd);
+ if (ret == WT_RESTART)
+ goto retry;
+ WT_ERR(ret);
if (0) {
err:
__wt_free(session, hs_tombstone);
__wt_free(session, hs_upd);
}
+
+ API_END_RET(session, ret);
+}
+
+/*
+ * __curhs_remove --
+ * WT_CURSOR->remove method for the hs cursor type.
+ */
+static int
+__curhs_remove(WT_CURSOR *cursor)
+{
+ WT_CURSOR *file_cursor;
+ WT_CURSOR_BTREE *cbt;
+ WT_CURSOR_HS *hs_cursor;
+ WT_DECL_RET;
+ WT_SESSION_IMPL *session;
+ WT_UPDATE *hs_tombstone;
+
+ hs_cursor = (WT_CURSOR_HS *)cursor;
+ file_cursor = hs_cursor->file_cursor;
+ cbt = (WT_CURSOR_BTREE *)file_cursor;
+ hs_tombstone = NULL;
+
+ CURSOR_API_CALL_PREPARE_ALLOWED(cursor, session, insert, CUR2BT(file_cursor));
+
+ /* Remove must be called with cursor positioned. */
+ WT_ASSERT(session, F_ISSET(file_cursor, WT_CURSTD_KEY_INT));
+
+ /*
+ * Since we're using internal functions to modify the row structure, we need to manually set the
+ * comparison to an exact match.
+ */
+ cbt->compare = 0;
+ /* Add a tombstone with WT_TXN_NONE transaction id and WT_TS_NONE timestamps. */
+ WT_ERR(__wt_upd_alloc_tombstone(session, &hs_tombstone, NULL));
+ hs_tombstone->txnid = WT_TXN_NONE;
+ hs_tombstone->start_ts = hs_tombstone->durable_ts = WT_TS_NONE;
+ while ((ret = __wt_hs_modify(cbt, hs_tombstone)) == WT_RESTART) {
+ WT_WITH_PAGE_INDEX(session, ret = __wt_hs_row_search(cbt, &file_cursor->key, false));
+ WT_ERR(ret);
+ }
+
+ WT_ERR(ret);
+
+ if (0) {
+err:
+ __wt_free(session, hs_tombstone);
+ }
+
API_END_RET(session, ret);
}
@@ -679,7 +732,7 @@ __wt_curhs_open(WT_SESSION_IMPL *session, WT_CURSOR *owner, WT_CURSOR **cursorp)
__curhs_insert, /* insert */
__wt_cursor_modify_value_format_notsup, /* modify */
__wt_cursor_notsup, /* update */
- __wt_cursor_notsup, /* remove */
+ __curhs_remove, /* remove */
__wt_cursor_notsup, /* reserve */
__wt_cursor_reconfigure_notsup, /* reconfigure */
__wt_cursor_notsup, /* cache */