summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2020-06-23 19:29:14 +1000
committerLuke Chen <luke.chen@mongodb.com>2020-06-23 19:44:32 +1000
commit187fde098980d2735e4150833d8a515c4c7d1545 (patch)
treea053d56f1ecb306131bfa4aaa58eb7326f66ba31
parentbe486f8f49efcc706a53a072cb5527e1200a49cf (diff)
downloadmongo-187fde098980d2735e4150833d8a515c4c7d1545.tar.gz
Import wiredtiger: 5e6daf7d42727e3d86b2603c20852d1426dee55f from branch mongodb-4.4
ref: 5199f7f394..5e6daf7d42 for: 4.4.0-rc11 WT-6457 Restore static testing that zero-length row-store values are never written WT-6464 Fix memory leak in __rollback_row_add_update
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/reconcile/rec_row.c6
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c16
-rw-r--r--src/third_party/wiredtiger/test/suite/test_empty_value.py11
4 files changed, 20 insertions, 15 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index b8ecb80867b..6ba5f527c47 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-4.4",
- "commit": "5199f7f394d6192475b83e211575be196afa1523"
+ "commit": "5e6daf7d42727e3d86b2603c20852d1426dee55f"
}
diff --git a/src/third_party/wiredtiger/src/reconcile/rec_row.c b/src/third_party/wiredtiger/src/reconcile/rec_row.c
index dd072d57cf6..0bf79f2802a 100644
--- a/src/third_party/wiredtiger/src/reconcile/rec_row.c
+++ b/src/third_party/wiredtiger/src/reconcile/rec_row.c
@@ -770,11 +770,9 @@ __wt_rec_row_leaf(
/*
* If we reconcile an on disk key with a globally visible stop time point and there are no
- * new updates for that key, skip writing that key. Don't do this additional cleanup work if
- * a checkpoint is doing the work - we need that to be as streamlined as possible.
+ * new updates for that key, skip writing that key.
*/
- if (upd == NULL && !F_ISSET(r, WT_REC_CHECKPOINT) &&
- __wt_txn_tw_stop_visible_all(session, &tw))
+ if (upd == NULL && __wt_txn_tw_stop_visible_all(session, &tw))
upd = &upd_tombstone;
/* Build value cell. */
diff --git a/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c b/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
index 9be945bb6c3..afc3508e577 100644
--- a/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
+++ b/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
@@ -94,9 +94,10 @@ __rollback_row_add_update(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip,
{
WT_DECL_RET;
WT_PAGE_MODIFY *mod;
- WT_UPDATE *old_upd, **upd_entry;
+ WT_UPDATE *last_upd, *old_upd, **upd_entry;
size_t upd_size;
+ last_upd = NULL;
/* If we don't yet have a modify structure, we'll need one. */
WT_RET(__wt_page_modify_init(session, page));
mod = page->modify;
@@ -108,9 +109,13 @@ __rollback_row_add_update(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip,
upd_entry = &mod->mod_row_update[WT_ROW_SLOT(page, rip)];
upd_size = __wt_update_list_memsize(upd);
+ /* If there are existing updates, append them after the new updates. */
+ for (last_upd = upd; last_upd->next != NULL; last_upd = last_upd->next)
+ ;
+ last_upd->next = *upd_entry;
+
/*
- * If it's a full update list, we're trying to instantiate the row. Otherwise, it's just a
- * single update that we'd like to append to the update list.
+ * We can either put a tombstone plus an update or a single update on the update chain.
*
* Set the "old" entry to the second update in the list so that the serialization function
* succeeds in swapping the first update into place.
@@ -131,7 +136,12 @@ __rollback_row_add_update(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip,
*/
WT_ERR(__wt_update_serial(session, NULL, page, upd_entry, &upd, upd_size, true));
+ if (0) {
err:
+ if (last_upd != NULL)
+ last_upd->next = NULL;
+ }
+
return (ret);
}
diff --git a/src/third_party/wiredtiger/test/suite/test_empty_value.py b/src/third_party/wiredtiger/test/suite/test_empty_value.py
index d026b471277..b3db134a16f 100644
--- a/src/third_party/wiredtiger/test/suite/test_empty_value.py
+++ b/src/third_party/wiredtiger/test/suite/test_empty_value.py
@@ -26,10 +26,9 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
-# test_dictionary.py
+# test_empty_value.py
# Smoke test empty row-store values.
-from wtdataset import simple_key
from wiredtiger import stat
import wiredtiger, wttest
@@ -39,22 +38,20 @@ class test_row_store_empty_values(wttest.WiredTigerTestCase):
# Smoke test empty row-store values.
def test_row_store_empty_values(self):
- self.skipTest('empty row values are currently not working')
-
nentries = 25000
uri = 'file:test_empty_values' # This is a btree layer test.
# Create the object, open the cursor, insert some records with zero-length values.
- self.session.create(uri, 'value_format=u,key_format=S')
+ self.session.create(uri, 'key_format=S,value_format=u')
cursor = self.session.open_cursor(uri, None)
for i in range(1, nentries + 1):
- cursor[simple_key(cursor, i)] = ""
+ cursor[str(i)] = b''
cursor.close()
# Reopen to force the object to disk.
self.reopen_conn()
- # Confirm the values weren't stored..
+ # Confirm the values weren't stored.
cursor = self.session.open_cursor('statistics:' + uri, None, 'statistics=(tree_walk)')
self.assertEqual(cursor[stat.dsrc.btree_row_empty_values][2], nentries)