diff options
-rw-r--r-- | src/third_party/wiredtiger/import.data | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_handle.c | 14 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/suite/test_truncate18.py | 17 |
3 files changed, 28 insertions, 5 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index f6cddd7deae..0c95a055526 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": "fbae1a2989c947f4f8d17ac433e93edf85251900" + "commit": "dd3f4cb2749cfd33551d66762a49063bb19459fd" } diff --git a/src/third_party/wiredtiger/src/btree/bt_handle.c b/src/third_party/wiredtiger/src/btree/bt_handle.c index 98e048bd07d..c1c1b7af166 100644 --- a/src/third_party/wiredtiger/src/btree/bt_handle.c +++ b/src/third_party/wiredtiger/src/btree/bt_handle.c @@ -830,7 +830,9 @@ err: /* * __btree_get_last_recno -- - * Set the last record number for a column-store. + * Set the last record number for a column-store. Note that this is used to handle appending to + * a column store after a truncate operation. It is not related to the WT_CURSOR::largest_key + * API. */ static int __btree_get_last_recno(WT_SESSION_IMPL *session) @@ -841,6 +843,16 @@ __btree_get_last_recno(WT_SESSION_IMPL *session) uint32_t flags; btree = S2BT(session); + + /* + * The last record number is used to support appending to a column store tree that has had a + * final page truncated. Since checkpoint trees are read-only they don't need the value. + */ + if (WT_READING_CHECKPOINT(session)) { + btree->last_recno = WT_RECNO_OOB; + return (0); + } + flags = WT_READ_PREV; if (!F_ISSET(session->txn, WT_TXN_HAS_SNAPSHOT)) LF_SET(WT_READ_VISIBLE_ALL); diff --git a/src/third_party/wiredtiger/test/suite/test_truncate18.py b/src/third_party/wiredtiger/test/suite/test_truncate18.py index 0e971ed389a..ec592c333d9 100644 --- a/src/third_party/wiredtiger/test/suite/test_truncate18.py +++ b/src/third_party/wiredtiger/test/suite/test_truncate18.py @@ -74,8 +74,13 @@ class test_truncate18(wttest.WiredTigerTestCase): ] format_values = [ ('integer_row', dict(key_format='i', value_format='S', extraconfig='')), + ('column', dict(key_format='r', value_format='S', extraconfig='')), ] - scenarios = make_scenarios(trunc_values, format_values) + trunc_range_values = [ + ('front', dict(truncate_front=True)), + ('back', dict(truncate_front=False)), + ] + scenarios = make_scenarios(trunc_values, format_values, trunc_range_values) # Truncate, from keynum1 to keynum2, inclusive. def truncate(self, uri, make_key, keynum1, keynum2, read_ts, commit_ts): @@ -151,8 +156,14 @@ class test_truncate18(wttest.WiredTigerTestCase): # Reopen the connection again so nothing is in memory and we can fast-truncate. self.reopen_conn() - # Truncate most of the tree, beginning at the first key, at time 20. - err = self.truncate(ds.uri, ds.key, 1, 7 * nrows // 8, 15, 20) + # Truncate most of the tree at time 20. Including either the start or end of the tree. + if self.truncate_front: + start_key = 1 + end_key = 7 * nrows // 8 + else: + start_key = nrows // 8 + end_key = nrows + err = self.truncate(ds.uri, ds.key, start_key, end_key, 15, 20) self.assertEqual(err, 0) # Make sure we did at least one fast-delete. (Unless we specifically didn't want to, |