Import wiredtiger: d2835691d9be240b7bb295a132b28d058a0de5fb (#41897)

GitOrigin-RevId: f79b970f08f60c41491003cd55a3dd459a279c39
This commit is contained in:
Andrew Bui 2025-09-26 18:18:46 -07:00 committed by MongoDB Bot
parent ec71896691
commit fcd5541703
5 changed files with 341 additions and 296 deletions

View File

@ -1,8 +1,9 @@
/** /**
* Test that the query engine is capable of running queries when the catalog's in memory cache of objects is destroyed during a yield. * Test that the query engine is capable of running queries when the catalog's in memory cache of
* This testcase serves as a regression test for SERVER-105873 which was a problem with the query optimizer stashing a raw pointer * objects is destroyed during a yield. This testcase serves as a regression test for SERVER-105873
* to a storage-owned object which is destroyed during a yield and concurrent collMod operation. The comments inline represent the * which was a problem with the query optimizer stashing a raw pointer to a storage-owned object
* state of the code before SERVER-105873 was fixed. * which is destroyed during a yield and concurrent collMod operation. The comments inline represent
* the state of the code before SERVER-105873 was fixed.
*/ */
import {configureFailPoint} from "jstests/libs/fail_point_util.js"; import {configureFailPoint} from "jstests/libs/fail_point_util.js";
@ -27,21 +28,23 @@ function testPartialIndex(conn) {
insertDocs(coll); insertDocs(coll);
// Ensure first branch of $or has multiple indexed plans and must run the multiplanner. This ensures // Ensure first branch of $or has multiple indexed plans and must run the multiplanner. This
// we yield the collection acquisition. // ensures we yield the collection acquisition.
assert.commandWorked(coll.createIndex({a: 1}, {partialFilterExpression: {b: 1}, name: "a_partial"})); assert.commandWorked(
coll.createIndex({a: 1}, {partialFilterExpression: {b: 1}, name: "a_partial"}));
assert.commandWorked(coll.createIndex({b: 1})); assert.commandWorked(coll.createIndex({b: 1}));
// Ensure we yield the collection acquisition. // Ensure we yield the collection acquisition.
assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryExecYieldIterations: 1})); assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryExecYieldIterations: 1}));
// Configure the fail point to pause after the query planner has taken pointers to the catalog owned objects. // Configure the fail point to pause after the query planner has taken pointers to the catalog
let pauseAfterFillingOutIndexEntries = configureFailPoint(conn, "pauseAfterFillingOutIndexEntries"); // owned objects.
let pauseAfterFillingOutIndexEntries =
configureFailPoint(conn, "pauseAfterFillingOutIndexEntries");
const awaitQuery = startParallelShell(function() { const awaitQuery = startParallelShell(function() {
const coll = db[jsTestName()]; const coll = db[jsTestName()];
const res = coll const res = coll.find({
.find({
$or: [ $or: [
{a: 1, b: 1}, {a: 1, b: 1},
// Ensure one branch does not have an indexed plan. This forces the // Ensure one branch does not have an indexed plan. This forces the
@ -53,27 +56,33 @@ function testPartialIndex(conn) {
assert.eq(1001, res.length); assert.eq(1001, res.length);
}, db.getMongo().port); }, db.getMongo().port);
// At this point, the parallel shell's query is paused after filling out index entries in 'QueryPlannerParams' and no // At this point, the parallel shell's query is paused after filling out index entries in
// subplanning or multiplanning has began. // 'QueryPlannerParams' and no subplanning or multiplanning has began.
pauseAfterFillingOutIndexEntries.wait(); pauseAfterFillingOutIndexEntries.wait();
// Perform a collMod which forces the catalog to destroy its in-memory cache of the 'a_partial' index. // Perform a collMod which forces the catalog to destroy its in-memory cache of the 'a_partial'
assert.commandWorked(db.runCommand({collMod: collName, index: {name: "a_partial", hidden: true}})); // index.
assert.commandWorked(db.runCommand({collMod: collName, index: {name: "a_partial", hidden: false}})); assert.commandWorked(
db.runCommand({collMod: collName, index: {name: "a_partial", hidden: true}}));
assert.commandWorked(
db.runCommand({collMod: collName, index: {name: "a_partial", hidden: false}}));
// Begin subplanning and multiplanning of the first branch. This results in a yield which releases the one and only reference // Begin subplanning and multiplanning of the first branch. This results in a yield which
// to the initial copy of the 'a_partial' IndexCatalogEntryImpl which owns the partial filter MatchExpression. On restore, // releases the one and only reference to the initial copy of the 'a_partial'
// the catalog constructs a new copy of the 'a_partial' IndexCatalogEntryImpl. However, before SERVER-105873, the query engine // IndexCatalogEntryImpl which owns the partial filter MatchExpression. On restore, the catalog
// was saving a raw pointer to the partial filter expression owned by the first copy of the IndexCatalogEntryImpl, which at // constructs a new copy of the 'a_partial' IndexCatalogEntryImpl. However, before
// this point is now destroyed. When the subplanner tries to plans the second branch, it is only able to create a collscan plan, // SERVER-105873, the query engine was saving a raw pointer to the partial filter expression
// which results in falling back to `choosePlanWholeQuery()`, which tries to dereference the destroyed partial index pointer when // owned by the first copy of the IndexCatalogEntryImpl, which at this point is now destroyed.
// determining index eligibility. // When the subplanner tries to plans the second branch, it is only able to create a collscan
// plan, which results in falling back to `choosePlanWholeQuery()`, which tries to dereference
// the destroyed partial index pointer when determining index eligibility.
pauseAfterFillingOutIndexEntries.off(); pauseAfterFillingOutIndexEntries.off();
awaitQuery(); awaitQuery();
} }
// Test stale pointer to wildcard projection. // Test stale pointer to wildcard projection.
// The repro is nearly identical to that of 'testPartialIndex()', so we've omitted the inline comments. // The repro is nearly identical to that of 'testPartialIndex()', so we've omitted the inline
// comments.
function testWildcardIndex(conn) { function testWildcardIndex(conn) {
let db = conn.getDB("test"); let db = conn.getDB("test");
const collName = jsTestName(); const collName = jsTestName();
@ -84,11 +93,11 @@ function testWildcardIndex(conn) {
assert.commandWorked(coll.createIndex({"a.$**": 1}, {name: "a_wildcard"})); assert.commandWorked(coll.createIndex({"a.$**": 1}, {name: "a_wildcard"}));
assert.commandWorked(coll.createIndex({b: 1})); assert.commandWorked(coll.createIndex({b: 1}));
assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryExecYieldIterations: 1})); assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryExecYieldIterations: 1}));
let pauseAfterFillingOutIndexEntries = configureFailPoint(conn, "pauseAfterFillingOutIndexEntries"); let pauseAfterFillingOutIndexEntries =
configureFailPoint(conn, "pauseAfterFillingOutIndexEntries");
const awaitQuery = startParallelShell(function() { const awaitQuery = startParallelShell(function() {
const coll = db[jsTestName()]; const coll = db[jsTestName()];
const res = coll const res = coll.find({
.find({
$or: [{"a.foo": 1, b: 1}, {c: null}], $or: [{"a.foo": 1, b: 1}, {c: null}],
}) })
.toArray(); .toArray();
@ -96,14 +105,17 @@ function testWildcardIndex(conn) {
}, db.getMongo().port); }, db.getMongo().port);
pauseAfterFillingOutIndexEntries.wait(); pauseAfterFillingOutIndexEntries.wait();
assert.commandWorked(db.runCommand({collMod: collName, index: {name: "a_wildcard", hidden: true}})); assert.commandWorked(
assert.commandWorked(db.runCommand({collMod: collName, index: {name: "a_wildcard", hidden: false}})); db.runCommand({collMod: collName, index: {name: "a_wildcard", hidden: true}}));
assert.commandWorked(
db.runCommand({collMod: collName, index: {name: "a_wildcard", hidden: false}}));
pauseAfterFillingOutIndexEntries.off(); pauseAfterFillingOutIndexEntries.off();
awaitQuery(); awaitQuery();
} }
// Test stale pointer to collator. // Test stale pointer to collator.
// The repro is nearly identical to that of 'testPartialIndex()', so we've omitted the inline comments. // The repro is nearly identical to that of 'testPartialIndex()', so we've omitted the inline
// comments.
function testCollation(conn) { function testCollation(conn) {
let db = conn.getDB("test"); let db = conn.getDB("test");
const collName = jsTestName(); const collName = jsTestName();
@ -118,11 +130,11 @@ function testCollation(conn) {
assert.commandWorked(coll.createIndex({a: 1}, {name: "a_collation", collation: collation})); assert.commandWorked(coll.createIndex({a: 1}, {name: "a_collation", collation: collation}));
assert.commandWorked(coll.createIndex({b: 1}, {collation: collation})); assert.commandWorked(coll.createIndex({b: 1}, {collation: collation}));
assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryExecYieldIterations: 1})); assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryExecYieldIterations: 1}));
let pauseAfterFillingOutIndexEntries = configureFailPoint(conn, "pauseAfterFillingOutIndexEntries"); let pauseAfterFillingOutIndexEntries =
configureFailPoint(conn, "pauseAfterFillingOutIndexEntries");
const awaitQuery = startParallelShell(function() { const awaitQuery = startParallelShell(function() {
const coll = db[jsTestName()]; const coll = db[jsTestName()];
const res = coll const res = coll.find({
.find({
// Ensure predicate has string operands so collator is consulted. // Ensure predicate has string operands so collator is consulted.
$or: [{a: "abc", b: "def"}, {c: null}], $or: [{a: "abc", b: "def"}, {c: null}],
}) })
@ -132,8 +144,10 @@ function testCollation(conn) {
}, db.getMongo().port); }, db.getMongo().port);
pauseAfterFillingOutIndexEntries.wait(); pauseAfterFillingOutIndexEntries.wait();
assert.commandWorked(db.runCommand({collMod: collName, index: {name: "a_collation", hidden: true}})); assert.commandWorked(
assert.commandWorked(db.runCommand({collMod: collName, index: {name: "a_collation", hidden: false}})); db.runCommand({collMod: collName, index: {name: "a_collation", hidden: true}}));
assert.commandWorked(
db.runCommand({collMod: collName, index: {name: "a_collation", hidden: false}}));
pauseAfterFillingOutIndexEntries.off(); pauseAfterFillingOutIndexEntries.off();
awaitQuery(); awaitQuery();
} }

View File

@ -1,253 +1,248 @@
# DO NOT EDIT: automatically built by dist/s_bazel. # DO NOT EDIT: automatically built by dist/s_bazel.
# This file is only used by external projects building WiredTiger via Bazel. # This file is only used by external projects building WiredTiger via Bazel.
WT_FILELIST = [ WT_FILELIST = ['src/block/block_addr.c',
"src/block/block_addr.c", 'src/block/block_ckpt.c',
"src/block/block_ckpt.c", 'src/block/block_ckpt_scan.c',
"src/block/block_ckpt_scan.c", 'src/block/block_compact.c',
"src/block/block_compact.c", 'src/block/block_ext.c',
"src/block/block_ext.c", 'src/block/block_open.c',
"src/block/block_open.c", 'src/block/block_read.c',
"src/block/block_read.c", 'src/block/block_session.c',
"src/block/block_session.c", 'src/block/block_slvg.c',
"src/block/block_slvg.c", 'src/block/block_vrfy.c',
"src/block/block_vrfy.c", 'src/block/block_write.c',
"src/block/block_write.c", 'src/block_cache/block_cache.c',
"src/block_cache/block_cache.c", 'src/block_cache/block_chunkcache.c',
"src/block_cache/block_chunkcache.c", 'src/block_cache/block_io.c',
"src/block_cache/block_io.c", 'src/block_cache/block_map.c',
"src/block_cache/block_map.c", 'src/block_cache/block_mgr.c',
"src/block_cache/block_mgr.c", 'src/block_cache/block_tier.c',
"src/block_cache/block_tier.c", 'src/bloom/bloom.c',
"src/bloom/bloom.c", 'src/btree/bt_compact.c',
"src/btree/bt_compact.c", 'src/btree/bt_curnext.c',
"src/btree/bt_curnext.c", 'src/btree/bt_curprev.c',
"src/btree/bt_curprev.c", 'src/btree/bt_cursor.c',
"src/btree/bt_cursor.c", 'src/btree/bt_debug.c',
"src/btree/bt_debug.c", 'src/btree/bt_delete.c',
"src/btree/bt_delete.c", 'src/btree/bt_discard.c',
"src/btree/bt_discard.c", 'src/btree/bt_handle.c',
"src/btree/bt_handle.c", 'src/btree/bt_import.c',
"src/btree/bt_import.c", 'src/btree/bt_misc.c',
"src/btree/bt_misc.c", 'src/btree/bt_ovfl.c',
"src/btree/bt_ovfl.c", 'src/btree/bt_page.c',
"src/btree/bt_page.c", 'src/btree/bt_prefetch.c',
"src/btree/bt_prefetch.c", 'src/btree/bt_random.c',
"src/btree/bt_random.c", 'src/btree/bt_read.c',
"src/btree/bt_read.c", 'src/btree/bt_ret.c',
"src/btree/bt_ret.c", 'src/btree/bt_slvg.c',
"src/btree/bt_slvg.c", 'src/btree/bt_split.c',
"src/btree/bt_split.c", 'src/btree/bt_stat.c',
"src/btree/bt_stat.c", 'src/btree/bt_sync.c',
"src/btree/bt_sync.c", 'src/btree/bt_sync_obsolete.c',
"src/btree/bt_sync_obsolete.c", 'src/btree/bt_upgrade.c',
"src/btree/bt_upgrade.c", 'src/btree/bt_vrfy.c',
"src/btree/bt_vrfy.c", 'src/btree/bt_vrfy_dsk.c',
"src/btree/bt_vrfy_dsk.c", 'src/btree/bt_walk.c',
"src/btree/bt_walk.c", 'src/btree/col_modify.c',
"src/btree/col_modify.c", 'src/btree/col_srch.c',
"src/btree/col_srch.c", 'src/btree/row_key.c',
"src/btree/row_key.c", 'src/btree/row_modify.c',
"src/btree/row_modify.c", 'src/btree/row_srch.c',
"src/btree/row_srch.c", 'src/call_log/call_log.c',
"src/call_log/call_log.c", 'src/checksum/software/checksum.c',
"src/checksum/software/checksum.c", 'src/conf/conf_bind.c',
"src/conf/conf_bind.c", 'src/conf/conf_compile.c',
"src/conf/conf_compile.c", 'src/conf/conf_get.c',
"src/conf/conf_get.c", 'src/config/config.c',
"src/config/config.c", 'src/config/config_api.c',
"src/config/config_api.c", 'src/config/config_check.c',
"src/config/config_check.c", 'src/config/config_collapse.c',
"src/config/config_collapse.c", 'src/config/config_def.c',
"src/config/config_def.c", 'src/config/config_ext.c',
"src/config/config_ext.c", 'src/config/test_config.c',
"src/config/test_config.c", 'src/conn/api_calc_modify.c',
"src/conn/api_calc_modify.c", 'src/conn/api_strerror.c',
"src/conn/api_strerror.c", 'src/conn/api_version.c',
"src/conn/api_version.c", 'src/conn/conn_api.c',
"src/conn/conn_api.c", 'src/conn/conn_cache.c',
"src/conn/conn_cache.c", 'src/conn/conn_cache_pool.c',
"src/conn/conn_cache_pool.c", 'src/conn/conn_capacity.c',
"src/conn/conn_capacity.c", 'src/conn/conn_chunkcache.c',
"src/conn/conn_chunkcache.c", 'src/conn/conn_ckpt.c',
"src/conn/conn_ckpt.c", 'src/conn/conn_compact.c',
"src/conn/conn_compact.c", 'src/conn/conn_dhandle.c',
"src/conn/conn_dhandle.c", 'src/conn/conn_handle.c',
"src/conn/conn_handle.c", 'src/conn/conn_log.c',
"src/conn/conn_log.c", 'src/conn/conn_open.c',
"src/conn/conn_open.c", 'src/conn/conn_prefetch.c',
"src/conn/conn_prefetch.c", 'src/conn/conn_reconfig.c',
"src/conn/conn_reconfig.c", 'src/conn/conn_stat.c',
"src/conn/conn_stat.c", 'src/conn/conn_sweep.c',
"src/conn/conn_sweep.c", 'src/conn/conn_tiered.c',
"src/conn/conn_tiered.c", 'src/cursor/cur_backup.c',
"src/cursor/cur_backup.c", 'src/cursor/cur_backup_incr.c',
"src/cursor/cur_backup_incr.c", 'src/cursor/cur_bulk.c',
"src/cursor/cur_bulk.c", 'src/cursor/cur_config.c',
"src/cursor/cur_config.c", 'src/cursor/cur_ds.c',
"src/cursor/cur_ds.c", 'src/cursor/cur_dump.c',
"src/cursor/cur_dump.c", 'src/cursor/cur_file.c',
"src/cursor/cur_file.c", 'src/cursor/cur_hs.c',
"src/cursor/cur_hs.c", 'src/cursor/cur_index.c',
"src/cursor/cur_index.c", 'src/cursor/cur_join.c',
"src/cursor/cur_join.c", 'src/cursor/cur_json.c',
"src/cursor/cur_json.c", 'src/cursor/cur_log.c',
"src/cursor/cur_log.c", 'src/cursor/cur_metadata.c',
"src/cursor/cur_metadata.c", 'src/cursor/cur_stat.c',
"src/cursor/cur_stat.c", 'src/cursor/cur_std.c',
"src/cursor/cur_std.c", 'src/cursor/cur_table.c',
"src/cursor/cur_table.c", 'src/cursor/cur_version.c',
"src/cursor/cur_version.c", 'src/evict/evict_file.c',
"src/evict/evict_file.c", 'src/evict/evict_lru.c',
"src/evict/evict_lru.c", 'src/evict/evict_page.c',
"src/evict/evict_page.c", 'src/evict/evict_stat.c',
"src/evict/evict_stat.c", 'src/history/hs_conn.c',
"src/history/hs_conn.c", 'src/history/hs_cursor.c',
"src/history/hs_cursor.c", 'src/history/hs_rec.c',
"src/history/hs_rec.c", 'src/history/hs_verify.c',
"src/history/hs_verify.c", 'src/log/log.c',
"src/log/log.c", 'src/log/log_auto.c',
"src/log/log_auto.c", 'src/log/log_slot.c',
"src/log/log_slot.c", 'src/log/log_sys.c',
"src/log/log_sys.c", 'src/lsm/lsm_cursor.c',
"src/lsm/lsm_cursor.c", 'src/lsm/lsm_cursor_bulk.c',
"src/lsm/lsm_cursor_bulk.c", 'src/lsm/lsm_manager.c',
"src/lsm/lsm_manager.c", 'src/lsm/lsm_merge.c',
"src/lsm/lsm_merge.c", 'src/lsm/lsm_meta.c',
"src/lsm/lsm_meta.c", 'src/lsm/lsm_stat.c',
"src/lsm/lsm_stat.c", 'src/lsm/lsm_tree.c',
"src/lsm/lsm_tree.c", 'src/lsm/lsm_work_unit.c',
"src/lsm/lsm_work_unit.c", 'src/lsm/lsm_worker.c',
"src/lsm/lsm_worker.c", 'src/meta/meta_apply.c',
"src/meta/meta_apply.c", 'src/meta/meta_ckpt.c',
"src/meta/meta_ckpt.c", 'src/meta/meta_ext.c',
"src/meta/meta_ext.c", 'src/meta/meta_table.c',
"src/meta/meta_table.c", 'src/meta/meta_track.c',
"src/meta/meta_track.c", 'src/meta/meta_turtle.c',
"src/meta/meta_turtle.c", 'src/optrack/optrack.c',
"src/optrack/optrack.c", 'src/os_common/filename.c',
"src/os_common/filename.c", 'src/os_common/os_abort.c',
"src/os_common/os_abort.c", 'src/os_common/os_alloc.c',
"src/os_common/os_alloc.c", 'src/os_common/os_errno.c',
"src/os_common/os_errno.c", 'src/os_common/os_fhandle.c',
"src/os_common/os_fhandle.c", 'src/os_common/os_fs_inmemory.c',
"src/os_common/os_fs_inmemory.c", 'src/os_common/os_fstream.c',
"src/os_common/os_fstream.c", 'src/os_common/os_fstream_stdio.c',
"src/os_common/os_fstream_stdio.c", 'src/os_common/os_getopt.c',
"src/os_common/os_getopt.c", 'src/os_common/os_strtouq.c',
"src/os_common/os_strtouq.c", 'src/packing/pack_api.c',
"src/packing/pack_api.c", 'src/packing/pack_impl.c',
"src/packing/pack_impl.c", 'src/packing/pack_stream.c',
"src/packing/pack_stream.c", 'src/reconcile/rec_child.c',
"src/reconcile/rec_child.c", 'src/reconcile/rec_col.c',
"src/reconcile/rec_col.c", 'src/reconcile/rec_dictionary.c',
"src/reconcile/rec_dictionary.c", 'src/reconcile/rec_row.c',
"src/reconcile/rec_row.c", 'src/reconcile/rec_track.c',
"src/reconcile/rec_track.c", 'src/reconcile/rec_visibility.c',
"src/reconcile/rec_visibility.c", 'src/reconcile/rec_write.c',
"src/reconcile/rec_write.c", 'src/schema/schema_alter.c',
"src/schema/schema_alter.c", 'src/schema/schema_create.c',
"src/schema/schema_create.c", 'src/schema/schema_drop.c',
"src/schema/schema_drop.c", 'src/schema/schema_list.c',
"src/schema/schema_list.c", 'src/schema/schema_open.c',
"src/schema/schema_open.c", 'src/schema/schema_plan.c',
"src/schema/schema_plan.c", 'src/schema/schema_project.c',
"src/schema/schema_project.c", 'src/schema/schema_rename.c',
"src/schema/schema_rename.c", 'src/schema/schema_stat.c',
"src/schema/schema_stat.c", 'src/schema/schema_truncate.c',
"src/schema/schema_truncate.c", 'src/schema/schema_util.c',
"src/schema/schema_util.c", 'src/schema/schema_worker.c',
"src/schema/schema_worker.c", 'src/session/session_api.c',
"src/session/session_api.c", 'src/session/session_compact.c',
"src/session/session_compact.c", 'src/session/session_dhandle.c',
"src/session/session_dhandle.c", 'src/session/session_helper.c',
"src/session/session_helper.c", 'src/session/session_prefetch.c',
"src/session/session_prefetch.c", 'src/rollback_to_stable/rts_api.c',
"src/rollback_to_stable/rts_api.c", 'src/rollback_to_stable/rts_btree.c',
"src/rollback_to_stable/rts_btree.c", 'src/rollback_to_stable/rts_btree_walk.c',
"src/rollback_to_stable/rts_btree_walk.c", 'src/rollback_to_stable/rts.c',
"src/rollback_to_stable/rts.c", 'src/rollback_to_stable/rts_history.c',
"src/rollback_to_stable/rts_history.c", 'src/rollback_to_stable/rts_visibility.c',
"src/rollback_to_stable/rts_visibility.c", 'src/support/cond_auto.c',
"src/support/cond_auto.c", 'src/support/crypto.c',
"src/support/crypto.c", 'src/support/err.c',
"src/support/err.c", 'src/support/generation.c',
"src/support/generation.c", 'src/support/global.c',
"src/support/global.c", 'src/support/hash_city.c',
"src/support/hash_city.c", 'src/support/hash_fnv.c',
"src/support/hash_fnv.c", 'src/support/hazard.c',
"src/support/hazard.c", 'src/support/hex.c',
"src/support/hex.c", 'src/support/lock_ext.c',
"src/support/lock_ext.c", 'src/support/modify.c',
"src/support/modify.c", 'src/support/mtx_rw.c',
"src/support/mtx_rw.c", 'src/support/pow.c',
"src/support/pow.c", 'src/support/rand.c',
"src/support/rand.c", 'src/support/scratch.c',
"src/support/scratch.c", 'src/support/stat.c',
"src/support/stat.c", 'src/support/thread_group.c',
"src/support/thread_group.c", 'src/support/timestamp.c',
"src/support/timestamp.c", 'src/support/update_vector.c',
"src/support/update_vector.c", 'src/tiered/tiered_config.c',
"src/tiered/tiered_config.c", 'src/tiered/tiered_handle.c',
"src/tiered/tiered_handle.c", 'src/tiered/tiered_work.c',
"src/tiered/tiered_work.c", 'src/txn/txn.c',
"src/txn/txn.c", 'src/txn/txn_ckpt.c',
"src/txn/txn_ckpt.c", 'src/txn/txn_log.c',
"src/txn/txn_log.c", 'src/txn/txn_recover.c',
"src/txn/txn_recover.c", 'src/txn/txn_timestamp.c']
"src/txn/txn_timestamp.c",
]
WT_FILELIST_ARM64_HOST = ["src/checksum/arm64/crc32-arm64.c"] WT_FILELIST_ARM64_HOST = ['src/checksum/arm64/crc32-arm64.c']
WT_FILELIST_LOONGARCH64_HOST = ["src/checksum/loongarch64/crc32-loongarch64.c"] WT_FILELIST_LOONGARCH64_HOST = ['src/checksum/loongarch64/crc32-loongarch64.c']
WT_FILELIST_POWERPC_HOST = ["src/checksum/power8/crc32_wrapper.c", "src/checksum/power8/vec_crc32.c"] WT_FILELIST_POWERPC_HOST = ['src/checksum/power8/crc32_wrapper.c', 'src/checksum/power8/vec_crc32.c']
WT_FILELIST_RISCV64_HOST = ["src/checksum/riscv64/crc32-riscv64.c"] WT_FILELIST_RISCV64_HOST = ['src/checksum/riscv64/crc32-riscv64.c']
WT_FILELIST_X86_HOST = ["src/checksum/x86/crc32-x86-alt.c", "src/checksum/x86/crc32-x86.c"] WT_FILELIST_X86_HOST = ['src/checksum/x86/crc32-x86-alt.c', 'src/checksum/x86/crc32-x86.c']
WT_FILELIST_ZSERIES_HOST = ["src/checksum/zseries/crc32-s390x.c", "src/checksum/zseries/crc32le-vx.sx"] WT_FILELIST_ZSERIES_HOST = ['src/checksum/zseries/crc32-s390x.c', 'src/checksum/zseries/crc32le-vx.sx']
WT_FILELIST_POSIX_HOST = [ WT_FILELIST_POSIX_HOST = ['src/os_posix/os_dir.c',
"src/os_posix/os_dir.c", 'src/os_posix/os_dlopen.c',
"src/os_posix/os_dlopen.c", 'src/os_posix/os_fallocate.c',
"src/os_posix/os_fallocate.c", 'src/os_posix/os_fs.c',
"src/os_posix/os_fs.c", 'src/os_posix/os_getenv.c',
"src/os_posix/os_getenv.c", 'src/os_posix/os_map.c',
"src/os_posix/os_map.c", 'src/os_posix/os_mtx_cond.c',
"src/os_posix/os_mtx_cond.c", 'src/os_posix/os_once.c',
"src/os_posix/os_once.c", 'src/os_posix/os_pagesize.c',
"src/os_posix/os_pagesize.c", 'src/os_posix/os_path.c',
"src/os_posix/os_path.c", 'src/os_posix/os_priv.c',
"src/os_posix/os_priv.c", 'src/os_posix/os_setvbuf.c',
"src/os_posix/os_setvbuf.c", 'src/os_posix/os_sleep.c',
"src/os_posix/os_sleep.c", 'src/os_posix/os_snprintf.c',
"src/os_posix/os_snprintf.c", 'src/os_posix/os_thread.c',
"src/os_posix/os_thread.c", 'src/os_posix/os_time.c',
"src/os_posix/os_time.c", 'src/os_posix/os_yield.c']
"src/os_posix/os_yield.c",
]
WT_FILELIST_WINDOWS_HOST = [ WT_FILELIST_WINDOWS_HOST = ['src/os_win/os_dir.c',
"src/os_win/os_dir.c", 'src/os_win/os_dlopen.c',
"src/os_win/os_dlopen.c", 'src/os_win/os_fs.c',
"src/os_win/os_fs.c", 'src/os_win/os_getenv.c',
"src/os_win/os_getenv.c", 'src/os_win/os_map.c',
"src/os_win/os_map.c", 'src/os_win/os_mtx_cond.c',
"src/os_win/os_mtx_cond.c", 'src/os_win/os_once.c',
"src/os_win/os_once.c", 'src/os_win/os_pagesize.c',
"src/os_win/os_pagesize.c", 'src/os_win/os_path.c',
"src/os_win/os_path.c", 'src/os_win/os_priv.c',
"src/os_win/os_priv.c", 'src/os_win/os_setvbuf.c',
"src/os_win/os_setvbuf.c", 'src/os_win/os_sleep.c',
"src/os_win/os_sleep.c", 'src/os_win/os_snprintf.c',
"src/os_win/os_snprintf.c", 'src/os_win/os_thread.c',
"src/os_win/os_thread.c", 'src/os_win/os_time.c',
"src/os_win/os_time.c", 'src/os_win/os_utf8.c',
"src/os_win/os_utf8.c", 'src/os_win/os_winerr.c',
"src/os_win/os_winerr.c", 'src/os_win/os_yield.c']
"src/os_win/os_yield.c",
]

View File

@ -169,6 +169,7 @@ run --bg "style.py" &
run --bg "comment_style.py" & run --bg "comment_style.py" &
run --bg "type_to_str.py" & run --bg "type_to_str.py" &
run --bg "s_include_guards" & run --bg "s_include_guards" &
run --bg "s_bazel.py" &
# Wait for completion. # Wait for completion.
if [[ -n "$ISTTY" ]]; then if [[ -n "$ISTTY" ]]; then

35
src/third_party/wiredtiger/dist/s_bazel.py vendored Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env python3
# This script generates a bazel-compatible list of files `filelist.bzl` from `filelist`.
import pprint
filelist_bzl = "filelist.bzl"
platform2files = {}
with open("filelist") as f:
for a in [l.split() for l in f if l != "\n" and not l.startswith("#")]:
file, platform = a[0], f"WT_FILELIST_{a[1]}" if len(a) > 1 else "WT_FILELIST"
platform2files.setdefault(platform, [])
platform2files[platform].append(file)
res = """
# DO NOT EDIT: automatically built by dist/s_bazel.
# This file is only used by external projects building WiredTiger via Bazel.
"""
for platform, files in platform2files.items():
res += f"\n{platform} = " + pprint.pformat(files) + "\n"
try:
with open(filelist_bzl) as f:
if res == f.read():
exit()
except OSError:
pass
with open(filelist_bzl, "w") as f:
f.write(res)
print(f"Updated dist/{filelist_bzl}")

View File

@ -2,5 +2,5 @@
"vendor": "wiredtiger", "vendor": "wiredtiger",
"github": "wiredtiger/wiredtiger", "github": "wiredtiger/wiredtiger",
"branch": "mongodb-8.0", "branch": "mongodb-8.0",
"commit": "77f0b15e94321da5ba2d109321222c56c9d954ad" "commit": "d2835691d9be240b7bb295a132b28d058a0de5fb"
} }