From 27d3ffa2015d627751fac28d17ab3fa3661ff435 Mon Sep 17 00:00:00 2001 From: Luke Chen Date: Tue, 11 Jan 2022 16:21:55 +1100 Subject: Import wiredtiger: 02329fa1d9ba292f5545d2adc67d4c324d0a2b04 from branch mongodb-5.2 ref: 461b911f9e..02329fa1d9 for: 5.2.0-rc5 WT-8635 Extend VLCS RLE caching test to another set of cases --- src/third_party/wiredtiger/import.data | 2 +- src/third_party/wiredtiger/src/btree/bt_curnext.c | 4 ++++ src/third_party/wiredtiger/src/btree/bt_curprev.c | 4 ++++ src/third_party/wiredtiger/test/suite/test_hs26.py | 15 +++++++++++---- src/third_party/wiredtiger/test/suite/test_hs27.py | 3 --- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 4c75cc0019a..fc2b568e7d1 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.2", - "commit": "461b911f9e91e24dad5785dad6bb78eabd3a395f" + "commit": "02329fa1d9ba292f5545d2adc67d4c324d0a2b04" } diff --git a/src/third_party/wiredtiger/src/btree/bt_curnext.c b/src/third_party/wiredtiger/src/btree/bt_curnext.c index bdb3e0149a7..4c0ddf4eeb6 100644 --- a/src/third_party/wiredtiger/src/btree/bt_curnext.c +++ b/src/third_party/wiredtiger/src/btree/bt_curnext.c @@ -321,6 +321,10 @@ restart_read: * It is only safe to cache the value for other keys in the same RLE cell if it is globally * visible. Otherwise, there might be some older timestamp where the value isn't uniform * across the cell. Always set cip_saved so it's easy to tell when we change cells. + * + * Note: it's important that we're checking the on-disk value for global visibility, and not + * whatever __wt_txn_read returned, which might be something else. (If it's something else, + * we can't cache it; but in that case the on-disk value cannot be globally visible.) */ cbt->cip_saved = cip; if (rle > 1 && diff --git a/src/third_party/wiredtiger/src/btree/bt_curprev.c b/src/third_party/wiredtiger/src/btree/bt_curprev.c index dfba334b26d..b93ac62d9bc 100644 --- a/src/third_party/wiredtiger/src/btree/bt_curprev.c +++ b/src/third_party/wiredtiger/src/btree/bt_curprev.c @@ -479,6 +479,10 @@ restart_read: * It is only safe to cache the value for other keys in the same RLE cell if it is globally * visible. Otherwise, there might be some older timestamp where the value isn't uniform * across the cell. Always set cip_saved so it's easy to tell when we change cells. + * + * Note: it's important that we're checking the on-disk value for global visibility, and not + * whatever __wt_txn_read returned, which might be something else. (If it's something else, + * we can't cache it; but in that case the on-disk value cannot be globally visible.) */ cbt->cip_saved = cip; if (rle > 1 && diff --git a/src/third_party/wiredtiger/test/suite/test_hs26.py b/src/third_party/wiredtiger/test/suite/test_hs26.py index 9aab2322c43..acb3bd07790 100644 --- a/src/third_party/wiredtiger/test/suite/test_hs26.py +++ b/src/third_party/wiredtiger/test/suite/test_hs26.py @@ -69,6 +69,10 @@ class test_hs26(wttest.WiredTigerTestCase): # Other cases of overlapping the key count are still interesting so we still generate # the full product of the scenarios. + visibility_values = [ + ('not_globally_visible', dict(ts1_globally_visible=False)), + ('globally_visible', dict(ts1_globally_visible=True)), + ] nrows_values = [ ('more', dict(nrows_1=103, nrows_2=211)), ('same', dict(nrows_1=211, nrows_2=211)), @@ -85,7 +89,8 @@ class test_hs26(wttest.WiredTigerTestCase): ('17', dict(value_modulus_2=17)), ] - scenarios = make_scenarios(nrows_values, value_modulus_1_values, value_modulus_2_values) + scenarios = make_scenarios(visibility_values, + nrows_values, value_modulus_1_values, value_modulus_2_values) value_1 = 'a' * 500 value_2 = 'd' * 500 @@ -171,8 +176,12 @@ class test_hs26(wttest.WiredTigerTestCase): # Write the first set of values at timestamp_1. self.make_updates(ds.uri, ds, self.value_1, self.value_modulus_1, self.nrows_1, self.timestamp_1) + # Optionally make the first set of values globally visible (and stable). + if self.ts1_globally_visible: + self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(self.timestamp_1) + + ',stable_timestamp=' + self.timestamp_str(self.timestamp_1)) + # Create a long running read transaction in a separate session. - # (Is it necessary for it to be separate? Not sure.) session_read = self.conn.open_session() session_read.begin_transaction('read_timestamp=' + self.timestamp_str(self.timestamp_1)) @@ -186,8 +195,6 @@ class test_hs26(wttest.WiredTigerTestCase): self.check(self.session, ds.uri, self.timestamp_1, self.timestamp_1) self.check(self.session, ds.uri, self.timestamp_2, self.timestamp_2) - self.session.breakpoint() - # Now forcibly evict, so that all the pages are RLE-encoded and then read back in. # There doesn't seem to be any way to just forcibly evict an entire table, so what # I'm going to do is assume that each page can hold at least 41 values, and evict diff --git a/src/third_party/wiredtiger/test/suite/test_hs27.py b/src/third_party/wiredtiger/test/suite/test_hs27.py index e685503b8a2..47725808319 100644 --- a/src/third_party/wiredtiger/test/suite/test_hs27.py +++ b/src/third_party/wiredtiger/test/suite/test_hs27.py @@ -275,7 +275,6 @@ class test_hs27(wttest.WiredTigerTestCase): self.initialize(ds.uri, ds) # Create a long running read transaction in a separate session. - # (Is it necessary for it to be separate? Not sure.) session_read = self.conn.open_session() session_read.begin_transaction('read_timestamp=' + self.timestamp_str(2)) @@ -288,8 +287,6 @@ class test_hs27(wttest.WiredTigerTestCase): # Check that the new updates are appropriately visible. self.checkall(self.session, ds.uri, ds) - self.session.breakpoint() - # Now forcibly evict, so that all the pages are RLE-encoded and then read back in. # There doesn't seem to be any way to just forcibly evict an entire table, so what # I'm going to do is assume that what we care about is evicting the updates (the -- cgit v1.2.1