From 9a65b01b0d86c48af4e8b40c6142ae501dc11141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Valenduc?= Date: Thu, 17 Apr 2025 17:49:59 +0200 Subject: [PATCH] fixes for boost 1.85 --- src/mongo/client/sdam/sdam_json_test_runner.cpp | 2 +- .../sdam/server_selection_json_test_runner.cpp | 2 +- src/mongo/db/initialize_server_global_state.cpp | 2 +- src/mongo/db/startup_warnings_mongod.cpp | 3 ++- .../db/storage/storage_engine_lock_file_posix.cpp | 4 ++-- src/mongo/db/storage/storage_engine_metadata.cpp | 4 ++-- .../db/storage/wiredtiger/wiredtiger_kv_engine.cpp | 3 ++- src/mongo/shell/shell_utils_launcher.cpp | 12 ++++++------ src/mongo/shell/shell_utils_launcher.h | 2 +- src/mongo/unittest/golden_test.cpp | 2 +- src/mongo/unittest/golden_test.h | 2 +- src/mongo/unittest/golden_test_base.cpp | 4 ++-- src/mongo/unittest/golden_test_test.cpp | 2 +- src/mongo/util/options_parser/options_parser.cpp | 2 +- 14 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/mongo/client/sdam/sdam_json_test_runner.cpp b/src/mongo/client/sdam/sdam_json_test_runner.cpp index b10f7a25971..e29907a089f 100644 --- a/src/mongo/client/sdam/sdam_json_test_runner.cpp +++ b/src/mongo/client/sdam/sdam_json_test_runner.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/mongo/client/sdam/server_selection_json_test_runner.cpp b/src/mongo/client/sdam/server_selection_json_test_runner.cpp index 5b916ff7ce7..d20909fce74 100644 --- a/src/mongo/client/sdam/server_selection_json_test_runner.cpp +++ b/src/mongo/client/sdam/server_selection_json_test_runner.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/mongo/db/initialize_server_global_state.cpp b/src/mongo/db/initialize_server_global_state.cpp index 2e03433fabb..64481d9e227 100644 --- a/src/mongo/db/initialize_server_global_state.cpp +++ b/src/mongo/db/initialize_server_global_state.cpp @@ -332,7 +332,7 @@ bool checkAndMoveLogFile(const std::string& absoluteLogpath) { << "\" should name a file, not a directory."); } - if (!serverGlobalParams.logAppend && boost::filesystem::is_regular(absoluteLogpath)) { + if (!serverGlobalParams.logAppend && boost::filesystem::is_regular_file(absoluteLogpath)) { std::string renameTarget = absoluteLogpath + "." + terseCurrentTimeForFilename(); boost::system::error_code ec; boost::filesystem::rename(absoluteLogpath, renameTarget, ec); diff --git a/src/mongo/db/startup_warnings_mongod.cpp b/src/mongo/db/startup_warnings_mongod.cpp index a7fcc3e632b..6bf12381704 100644 --- a/src/mongo/db/startup_warnings_mongod.cpp +++ b/src/mongo/db/startup_warnings_mongod.cpp @@ -28,7 +28,8 @@ */ #include "mongo/db/startup_warnings_mongod.h" - +#include +#include #include #include #include diff --git a/src/mongo/db/storage/storage_engine_lock_file_posix.cpp b/src/mongo/db/storage/storage_engine_lock_file_posix.cpp index 5116a72bc0e..39182f0e6a0 100644 --- a/src/mongo/db/storage/storage_engine_lock_file_posix.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file_posix.cpp @@ -72,7 +72,7 @@ void flushMyDirectory(const boost::filesystem::path& file) { // if called without a fully qualified path it asserts; that makes mongoperf fail. // so make a warning. need a better solution longer term. // massert(40389, str::stream() << "Couldn't find parent dir for file: " << file.string(),); - if (!file.has_branch_path()) { + if (!file.has_parent_path()) { LOGV2(22274, "flushMyDirectory couldn't find parent dir for file", "file"_attr = file.generic_string()); @@ -80,7 +80,7 @@ void flushMyDirectory(const boost::filesystem::path& file) { } - boost::filesystem::path dir = file.branch_path(); // parent_path in new boosts + boost::filesystem::path dir = file.parent_path(); // parent_path in new boosts LOGV2_DEBUG(22275, 1, "flushing directory {dir_string}", "dir_string"_attr = dir.string()); diff --git a/src/mongo/db/storage/storage_engine_metadata.cpp b/src/mongo/db/storage/storage_engine_metadata.cpp index 690e34d2630..6ecfb48de5b 100644 --- a/src/mongo/db/storage/storage_engine_metadata.cpp +++ b/src/mongo/db/storage/storage_engine_metadata.cpp @@ -232,7 +232,7 @@ void flushMyDirectory(const boost::filesystem::path& file) { // if called without a fully qualified path it asserts; that makes mongoperf fail. // so make a warning. need a better solution longer term. // massert(13652, str::stream() << "Couldn't find parent dir for file: " << file.string(),); - if (!file.has_branch_path()) { + if (!file.has_parent_path()) { LOGV2(22283, "flushMyDirectory couldn't find parent dir for file", "file"_attr = file.generic_string()); @@ -240,7 +240,7 @@ void flushMyDirectory(const boost::filesystem::path& file) { } - boost::filesystem::path dir = file.branch_path(); // parent_path in new boosts + boost::filesystem::path dir = file.parent_path(); // parent_path in new boosts LOGV2_DEBUG(22284, 1, "flushing directory {dir_string}", "dir_string"_attr = dir.string()); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index ff6c81e38db..632a142ef28 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -69,6 +69,7 @@ #include #include #include +#include #include #include #include @@ -182,7 +183,7 @@ std::string extractIdentFromPath(const boost::filesystem::path& dbpath, // Remove the file extension and convert to generic form (i.e. replace "\" with "/" // on windows, no-op on unix). - return boost::filesystem::change_extension(identWithExtension, "").generic_string(); + return boost::filesystem::path(identWithExtension).replace_extension("").generic_string(); } bool WiredTigerFileVersion::shouldDowngrade(bool hasRecoveryTimestamp) { diff --git a/src/mongo/shell/shell_utils_launcher.cpp b/src/mongo/shell/shell_utils_launcher.cpp index ae5175a2a6d..b89fa59ac0d 100644 --- a/src/mongo/shell/shell_utils_launcher.cpp +++ b/src/mongo/shell/shell_utils_launcher.cpp @@ -331,26 +331,26 @@ void copyDir(const boost::filesystem::path& from, const boost::filesystem::path& boost::filesystem::directory_iterator i(from); while (i != end) { boost::filesystem::path p = *i; - if (p.leaf() == "metrics.interim" || p.leaf() == "metrics.interim.temp") { + if (p.filename() == "metrics.interim" || p.filename() == "metrics.interim.temp") { // Ignore any errors for metrics.interim* files as these may disappear during copy boost::system::error_code ec; - boost::filesystem::copy_file(p, to / p.leaf(), ec); + boost::filesystem::copy_file(p, to / p.filename(), ec); if (ec) { LOGV2_INFO(22814, "Skipping copying of file from '{from}' to " "'{to}' due to: {error}", "Skipping copying of file due to error" "from"_attr = p.generic_string(), - "to"_attr = (to / p.leaf()).generic_string(), + "to"_attr = (to / p.filename()).generic_string(), "error"_attr = ec.message()); } - } else if (p.leaf() != "mongod.lock" && p.leaf() != "WiredTiger.lock") { + } else if (p.filename() != "mongod.lock" && p.filename() != "WiredTiger.lock") { if (boost::filesystem::is_directory(p)) { - boost::filesystem::path newDir = to / p.leaf(); + boost::filesystem::path newDir = to / p.filename(); boost::filesystem::create_directory(newDir); copyDir(p, newDir); } else { - boost::filesystem::copy_file(p, to / p.leaf()); + boost::filesystem::copy_file(p, to / p.filename()); } } ++i; diff --git a/src/mongo/shell/shell_utils_launcher.h b/src/mongo/shell/shell_utils_launcher.h index 65337f061b3..fc15c8c0d85 100644 --- a/src/mongo/shell/shell_utils_launcher.h +++ b/src/mongo/shell/shell_utils_launcher.h @@ -29,7 +29,7 @@ #pragma once -#include +#include #include #include #include diff --git a/src/mongo/unittest/golden_test.cpp b/src/mongo/unittest/golden_test.cpp index e01961b6060..be8f70148cf 100644 --- a/src/mongo/unittest/golden_test.cpp +++ b/src/mongo/unittest/golden_test.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include "mongo/base/init.h" // IWYU pragma: keep diff --git a/src/mongo/unittest/golden_test.h b/src/mongo/unittest/golden_test.h index 4c83503a9d3..75390265c75 100644 --- a/src/mongo/unittest/golden_test.h +++ b/src/mongo/unittest/golden_test.h @@ -30,7 +30,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/src/mongo/unittest/golden_test_base.cpp b/src/mongo/unittest/golden_test_base.cpp index 1d6c4331c32..a000658b099 100644 --- a/src/mongo/unittest/golden_test_base.cpp +++ b/src/mongo/unittest/golden_test_base.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -116,7 +116,7 @@ GoldenTestEnvironment::GoldenTestEnvironment() : _goldenDataRoot(".") { fs::path outputRoot; if (opts.outputRootPattern) { fs::path pattern(*opts.outputRootPattern); - outputRoot = pattern.parent_path() / fs::unique_path(pattern.leaf()); + outputRoot = pattern.parent_path() / fs::unique_path(pattern.filename()); } else { outputRoot = fs::temp_directory_path() / fs::unique_path("out-%%%%-%%%%-%%%%-%%%%"); } diff --git a/src/mongo/unittest/golden_test_test.cpp b/src/mongo/unittest/golden_test_test.cpp index 874d73bf52a..fb64834cfc7 100644 --- a/src/mongo/unittest/golden_test_test.cpp +++ b/src/mongo/unittest/golden_test_test.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include "mongo/base/string_data.h" diff --git a/src/mongo/util/options_parser/options_parser.cpp b/src/mongo/util/options_parser/options_parser.cpp index 46255631358..100b4c7c2bb 100644 --- a/src/mongo/util/options_parser/options_parser.cpp +++ b/src/mongo/util/options_parser/options_parser.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include -- 2.49.0