[SERVER-73162] Mongo shell can't accomodate a relative dbpath/data directory path for jstests that restart a server process Created: 20/Jan/23  Updated: 29/Oct/23  Resolved: 26/Jan/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.3.0-rc0

Type: Bug Priority: Major - P3
Reporter: George Wangensteen Assignee: George Wangensteen
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Run a test with resmoke locally where a restart is done and specify a relative/non-absolute dbpath: 

python build/install/bin/resmoke.py run -j 8 --suites=sharding jstests/sharding/change_streams_primary_shard_unaware.js --t --dbpath datadir 

 

The test will fail with: 

[js_test:change_streams_primary_shard_unaware] ReplSetTest (Re)Starting....
[js_test:change_streams_primary_shard_unaware] Resetting db path 'datadir/job0/mongorunner/datadir/job0/mongorunner/change_streams_primary_shard_unaware-rs0-0'
[js_test:change_streams_primary_shard_unaware] Error: Caught std::exception of type boost::filesystem::filesystem_error: boost::filesystem::create_directory: No such file or directory [system:2]: "datadir/job0/mongorunner/datadir/job0/mongorunner/change_streams_primary_shard_unaware-rs0-0" :
[js_test:change_streams_primary_shard_unaware] MongoRunner.runMongod@src/mongo/shell/servers.js:987:24
[js_test:change_streams_primary_shard_unaware] ReplSetTest/this.start<@src/mongo/shell/replsettest.js:2874:32
[js_test:change_streams_primary_shard_unaware] _nodeParamToId/<@src/mongo/shell/replsettest.js:272:28
[js_test:change_streams_primary_shard_unaware] _nodeParamToSingleNode/<@src/mongo/shell/replsettest.js:291:28
[js_test:change_streams_primary_shard_unaware] ReplSetTest/this.restart@src/mongo/shell/replsettest.js:2929:28
[js_test:change_streams_primary_shard_unaware] ShardingTest/this.restartShardRS@src/mongo/shell/shardingtest.js:1024:28
[js_test:change_streams_primary_shard_unaware] @jstests/sharding/change_streams_primary_shard_unaware.js:68:4
[js_test:change_streams_primary_shard_unaware] @jstests/sharding/change_streams_primary_shard_unaware.js:180:3
[js_test:change_streams_primary_shard_unaware] failed to load: jstests/sharding/change_streams_primary_shard_unaware.js

Sprint: Service Arch 2023-01-23, Service Arch 2023-02-06
Participants:

 Description   

Some jstests will restart server processes using MongoRunner.

As part of each invocation of `MongoRunner.runMongoD` , MongoRunner will attempt to prepend the correct data path prefix to the data dir path if necessary.  The logic it uses for doing so is to check if the current dbpath is absolute using this regex, and if it is not absolute to prepend the user-provided datapath to it.

The problem is that if the user-provided datapath is relative and not absolute, this check will not see if we already prepended the user-provided datapth and will therefore do so again. This is a problem when jstests like ReplSetTest re-start processes and preserve mongoRunner options between the restarts; it results in mongorunner being unable to restart the process because the re-computed datapath contains the user-provided prefix twice. 



 Comments   
Comment by Githook User [ 26/Jan/23 ]

Author:

{'name': 'George Wangensteen', 'email': 'george.wangensteen@mongodb.com', 'username': 'gewa24'}

Message: SERVER-73162 Make resmoke absolutize dataPath and dataDir when configuring the mongo shell
Branch: master
https://github.com/mongodb/mongo/commit/31cf5012e5c5d5ef10ed400fe0e04bf83763bd6e

Generated at Thu Feb 08 06:23:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.