From 627d3cecf7263c4e74df83fa517205de28f91dc6 Mon Sep 17 00:00:00 2001 From: "wt-vendoring-bot[bot]" <169275211+wt-vendoring-bot[bot]@users.noreply.github.com> Date: Wed, 17 Sep 2025 08:44:43 +1000 Subject: [PATCH] Import wiredtiger: a300655f291261468d87ed8461494be5c78ddcdb from branch mongodb-8.2 (#41375) Co-authored-by: wt-vendoring-bot GitOrigin-RevId: de69aae102b2c44e50e93773ed3f801322fca93b --- src/third_party/wiredtiger/import.data | 2 +- .../wiredtiger/src/block_cache/block_io.c | 8 +- .../wiredtiger/src/btree/bt_sync_obsolete.c | 3 + .../wiredtiger/src/reconcile/rec_visibility.c | 8 +- .../wiredtiger/test/suite/test_drop04.py | 77 +++++++++++++++++++ 5 files changed, 87 insertions(+), 11 deletions(-) create mode 100644 src/third_party/wiredtiger/test/suite/test_drop04.py diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 952189468af..0ef09ca852e 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -2,5 +2,5 @@ "vendor": "wiredtiger", "github": "wiredtiger/wiredtiger", "branch": "mongodb-8.2", - "commit": "70797c57f32d1b30410d062aeecd8fd5982b3848" + "commit": "a300655f291261468d87ed8461494be5c78ddcdb" } diff --git a/src/third_party/wiredtiger/src/block_cache/block_io.c b/src/third_party/wiredtiger/src/block_cache/block_io.c index 2a1fae9595c..7f27028f024 100644 --- a/src/third_party/wiredtiger/src/block_cache/block_io.c +++ b/src/third_party/wiredtiger/src/block_cache/block_io.c @@ -336,9 +336,7 @@ __wt_blkcache_write(WT_SESSION_IMPL *session, WT_ITEM *buf, WT_PAGE_BLOCK_META * */ if (btree->compressor == NULL || btree->compressor->compress == NULL || compressed) ip = buf; - else if (buf->size < 2 * WT_BLOCK_COMPRESS_SKIP) { - /* FIXME-WT-14609: the heuristic in the condition above was added for deltas and is likely - * to need tweaking. */ + else if (buf->size <= btree->allocsize) { ip = buf; WT_STAT_DSRC_INCR(session, compress_write_too_small); } else { @@ -379,9 +377,7 @@ __wt_blkcache_write(WT_SESSION_IMPL *session, WT_ITEM *buf, WT_PAGE_BLOCK_META * * output requires), it just means the uncompressed version is as good as it gets, and * that's what we use. */ - if (compression_failed || buf->size < 2 * WT_BLOCK_COMPRESS_SKIP) { - /* FIXME-WT-14609: the heuristic in the condition above was added for deltas and is - * likely to need tweaking. */ + if (compression_failed || buf->size / btree->allocsize <= result_len / btree->allocsize) { ip = buf; WT_STAT_DSRC_INCR(session, compress_write_fail); } else { diff --git a/src/third_party/wiredtiger/src/btree/bt_sync_obsolete.c b/src/third_party/wiredtiger/src/btree/bt_sync_obsolete.c index a926bdf5447..2bb8be4a079 100644 --- a/src/third_party/wiredtiger/src/btree/bt_sync_obsolete.c +++ b/src/third_party/wiredtiger/src/btree/bt_sync_obsolete.c @@ -504,6 +504,9 @@ __checkpoint_cleanup_walk_btree(WT_SESSION_IMPL *session, WT_ITEM *uri) if (btree->root.page == NULL) goto err; + /* Ignore tables that are empty or is currently in a bulk-load phase. */ + if (btree->original) + goto err; /* * FLCS pages cannot be discarded and must be rewritten as implicitly filling in missing chunks * of FLCS namespace is problematic. diff --git a/src/third_party/wiredtiger/src/reconcile/rec_visibility.c b/src/third_party/wiredtiger/src/reconcile/rec_visibility.c index a2025786c74..b9d31370438 100644 --- a/src/third_party/wiredtiger/src/reconcile/rec_visibility.c +++ b/src/third_party/wiredtiger/src/reconcile/rec_visibility.c @@ -447,8 +447,8 @@ __rec_validate_upd_chain(WT_SESSION_IMPL *session, WTI_RECONCILE *r, WT_UPDATE * prev_upd->prepare_state == WT_PREPARE_INPROGRESS || prev_upd->start_ts == prev_upd->durable_ts || prev_upd->durable_ts >= upd->durable_ts, "Durable timestamps cannot be out of order for prepared updates: prev_upd->start_ts=%s, " - "prev_upd->durable_ts=%s, prev_upd->flags=%" PRIu16 - ", upd->durable_ts=%s, upd->flags=%" PRIu16, + "prev_upd->durable_ts=%s, prev_upd->flags=%" PRIu8 + ", upd->durable_ts=%s, upd->flags=%" PRIu8, __wt_timestamp_to_string(prev_upd->start_ts, ts_string[0]), __wt_timestamp_to_string(prev_upd->durable_ts, ts_string[1]), prev_upd->flags, __wt_timestamp_to_string(upd->durable_ts, ts_string[2]), upd->flags); @@ -495,7 +495,7 @@ __rec_validate_upd_chain(WT_SESSION_IMPL *session, WTI_RECONCILE *r, WT_UPDATE * prev_upd->start_ts == prev_upd->durable_ts || prev_upd->durable_ts >= vpack->tw.durable_stop_ts, "Stop: Durable timestamps cannot be out of order for prepared updates: " - "prev_upd->start_ts=%s, prev_upd->durable_ts=%s, prev_upd->flags=%" PRIu16 + "prev_upd->start_ts=%s, prev_upd->durable_ts=%s, prev_upd->flags=%" PRIu8 ", vpack->tw.durable_stop_ts=%s", __wt_timestamp_to_string(prev_upd->start_ts, ts_string[0]), __wt_timestamp_to_string(prev_upd->durable_ts, ts_string[1]), prev_upd->flags, @@ -506,7 +506,7 @@ __rec_validate_upd_chain(WT_SESSION_IMPL *session, WTI_RECONCILE *r, WT_UPDATE * prev_upd->start_ts == prev_upd->durable_ts || prev_upd->durable_ts >= vpack->tw.durable_start_ts, "Start: Durable timestamps cannot be out of order for prepared updates: " - "prev_upd->start_ts=%s, prev_upd->durable_ts=%s, prev_upd->flags=%" PRIu16 + "prev_upd->start_ts=%s, prev_upd->durable_ts=%s, prev_upd->flags=%" PRIu8 ", vpack->tw.durable_start_ts=%s", __wt_timestamp_to_string(prev_upd->start_ts, ts_string[0]), __wt_timestamp_to_string(prev_upd->durable_ts, ts_string[1]), prev_upd->flags, diff --git a/src/third_party/wiredtiger/test/suite/test_drop04.py b/src/third_party/wiredtiger/test/suite/test_drop04.py new file mode 100644 index 00000000000..cbd46557bd5 --- /dev/null +++ b/src/third_party/wiredtiger/test/suite/test_drop04.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +#!/usr/bin/env python +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +from test_cc01 import test_cc_base +import wttest + +# test_drop04.py +# Test dropping a collection on empty logged table. The python test reproduces the WT-15225 bug. +class test_drop04(test_cc_base): + conn_config = 'log=(enabled=true)' + uri = 'table:test_drop04' + + def test_drop_after_bulk_load(self): + for i in range(100): + self.assertEqual(self.session.create(self.uri, 'key_format=i,value_format=S'), 0) + # Checkpoint the database and wait for the checkpoint cleanup. + self.wait_for_cc_to_run() + self.pr("Finished checkpoint {i}, performing drop...") + self.assertEqual(self.session.drop(self.uri, "force=false"), 0) + + self.pr("Done.") + +if __name__ == '__main__': + wttest.run()