[SERVER-70354] File Path on WiredTiger Error with Trailing Slash on dbPath Created: 07/Oct/22  Updated: 29/Oct/23  Resolved: 16/Oct/23

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

Type: Improvement Priority: Minor - P4
Reporter: Ronan Merrick Assignee: David Dominguez Sal
Resolution: Fixed Votes: 0
Labels: auto-reverted, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Related
related to SERVER-36430 mongod.exe seems sensitive to trailin... Closed
Assigned Teams:
Storage Execution
Backwards Compatibility: Fully Compatible
Sprint: Execution EMEA Team 2023-10-16, Execution EMEA Team 2023-10-30
Participants:
Linked BF Score: 35

 Description   

If a database file does not exist, accidentally deleted say, we show an error similar to the following:

2022-10-07T15:50:41.841+0100 E  STORAGE  [conn11] WiredTiger error (2) [1665154241:841014][22344:0x70000ca25000], file:test/collection-19-1350638838509104517.wt, WT_SESSION.open_cursor: __posix_open_file, 667: /Users/ronan.merrick/test/data/rs1/db//test/collection-19-1350638838509104517.wt: handle-open: open: No such file or directory Raw: [1665154241:841014][22344:0x70000ca25000], file:test/collection-19-1350638838509104517.wt, WT_SESSION.open_cursor: __posix_open_file, 667: /Users/ronan.merrick/test/data/rs1/db//test/collection-19-1350638838509104517.wt: handle-open: open: No such file or directory

In this case my dbPath was /Users/ronan.merrick/test/data/rs1/db/ and I was using directoryPerDB. The error message says the the file /Users/ronan.merrick/test/data/rs1/db//test/collection-19-1350638838509104517.wt could not be found.

Note the double-slash between the dbPath and the db folder for the file:

/Users/ronan.merrick/test/data/rs1/db//test/collection-19-1350638838509104517.wt 

If there is no trailing slash in dbPath the double slash isn't present in the file path in the log message

2022-10-07T16:20:10.863+0100 E  STORAGE  [conn9] WiredTiger error (2) [1665156010:863900][25320:0x70000c54f000], file:collection-23--6489519673391634808.wt, WT_SESSION.open_cursor: __posix_open_file, 667: /Users/ronan.merrick/test/data/rs1/db/collection-23--6489519673391634808.wt: handle-open: open: No such file or directory Raw: [1665156010:863900][25320:0x70000c54f000], file:collection-23--6489519673391634808.wt, WT_SESSION.open_cursor: __posix_open_file, 667: /Users/ronan.merrick/test/data/rs1/db/collection-23--6489519673391634808.wt: handle-open: open: No such file or directory

I think it would be better if we removed the double-slash if there is a trailing slash on dbPath. It can be misleading and can make you think there is an issue with an incorrect path

I came across this on a case with v4.2, but it appears to be the same in v6.0:

{"t":{"$date":"2022-10-07T16:34:39.058+01:00"},"s":"E",  "c":"WT",       "id":22435,   "ctx":"conn9","msg":"WiredTiger error message","attr":{"error":2,"message":{"ts_sec":1665156879,"ts_usec":58281,"thread":"26578:0x700004568000","session_name":"WT_SESSION.open_cursor","category":"WT_VERB_DEFAULT","category_id":9,"verbose_level":"ERROR","verbose_level_id":-3,"msg":"int __posix_fs_size(WT_FILE_SYSTEM *, WT_SESSION *, const char *, wt_off_t *):296:/Users/ronan.merrick/test/data/rs1/db//collection-38--834835323716624355.wt: file-size: stat","error_str":"No such file or directory","error_code":2}}}



 Comments   
Comment by Githook User [ 16/Oct/23 ]

Author:

{'name': 'David Dominguez-Sal', 'email': 'david.dominguez@mongodb.com', 'username': ''}

Message: SERVER-70354 Normalize dbpath parameter to remove the trailing path separators
Branch: master
https://github.com/mongodb/mongo/commit/0382228a3284fb9bbb61aa332d622456d7a2e676

Comment by David Dominguez Sal [ 16/Oct/23 ]

Normalized parameters. Newer version of the code does not depend on filesystem header, which is not fully supported in MacOS

Comment by David Dominguez Sal [ 13/Oct/23 ]

Fixing unsupported C++17 in MacOS

https://jira.mongodb.org/browse/BF-30391

Comment by Githook User [ 11/Oct/23 ]

Author:

{'name': 'auto-revert-processor', 'email': 'dev-prod-dag@mongodb.com', 'username': ''}

Message: Revert "SERVER-70354 Normalize dbpath parameter to remove the trailing path separators"

This reverts commit fc174d081bdd6a5178cc888e6f0309d23504b4df.
Branch: master
https://github.com/mongodb/mongo/commit/261faf976baa36c4c16dd086ca148e0b32fba406

Comment by Githook User [ 11/Oct/23 ]

Author:

{'name': 'David Dominguez-Sal', 'email': 'david.dominguez@mongodb.com', 'username': ''}

Message: SERVER-70354 Normalize dbpath parameter to remove the trailing path separators
Branch: master
https://github.com/mongodb/mongo/commit/fc174d081bdd6a5178cc888e6f0309d23504b4df

Comment by Iryna Zhuravlova [ 17/Oct/22 ]

Reassigning this from SDP, the linked issue was on Storage Execution. Feel free to pass it on to the team who can work on it. 

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