Lines 39-44
Link Here
|
39 |
#include <boost/iostreams/stream.hpp> |
39 |
#include <boost/iostreams/stream.hpp> |
40 |
#include <boost/iostreams/stream_buffer.hpp> |
40 |
#include <boost/iostreams/stream_buffer.hpp> |
41 |
#include <boost/iostreams/tee.hpp> |
41 |
#include <boost/iostreams/tee.hpp> |
|
|
42 |
#include <boost/filesystem.hpp> |
42 |
#include <fcntl.h> |
43 |
#include <fcntl.h> |
43 |
#include <fmt/format.h> |
44 |
#include <fmt/format.h> |
44 |
#include <iostream> |
45 |
#include <iostream> |
Lines 947-972
Link Here
|
947 |
boost::filesystem::directory_iterator i(from); |
948 |
boost::filesystem::directory_iterator i(from); |
948 |
while (i != end) { |
949 |
while (i != end) { |
949 |
boost::filesystem::path p = *i; |
950 |
boost::filesystem::path p = *i; |
950 |
if (p.leaf() == "metrics.interim" || p.leaf() == "metrics.interim.temp") { |
951 |
if (p.filename() == "metrics.interim" || p.filename() == "metrics.interim.temp") { |
951 |
// Ignore any errors for metrics.interim* files as these may disappear during copy |
952 |
// Ignore any errors for metrics.interim* files as these may disappear during copy |
952 |
boost::system::error_code ec; |
953 |
boost::system::error_code ec; |
953 |
boost::filesystem::copy_file(p, to / p.leaf(), ec); |
954 |
boost::filesystem::copy_file(p, to / p.filename(), ec); |
954 |
if (ec) { |
955 |
if (ec) { |
955 |
LOGV2_INFO(22814, |
956 |
LOGV2_INFO(22814, |
956 |
"Skipping copying of file from '{from}' to " |
957 |
"Skipping copying of file from '{from}' to " |
957 |
"'{to}' due to: {error}", |
958 |
"'{to}' due to: {error}", |
958 |
"Skipping copying of file due to error" |
959 |
"Skipping copying of file due to error" |
959 |
"from"_attr = p.generic_string(), |
960 |
"from"_attr = p.generic_string(), |
960 |
"to"_attr = (to / p.leaf()).generic_string(), |
961 |
"to"_attr = (to / p.filename()).generic_string(), |
961 |
"error"_attr = ec.message()); |
962 |
"error"_attr = ec.message()); |
962 |
} |
963 |
} |
963 |
} else if (p.leaf() != "mongod.lock" && p.leaf() != "WiredTiger.lock") { |
964 |
} else if (p.filename() != "mongod.lock" && p.filename() != "WiredTiger.lock") { |
964 |
if (boost::filesystem::is_directory(p)) { |
965 |
if (boost::filesystem::is_directory(p)) { |
965 |
boost::filesystem::path newDir = to / p.leaf(); |
966 |
boost::filesystem::path newDir = to / p.filename(); |
966 |
boost::filesystem::create_directory(newDir); |
967 |
boost::filesystem::create_directory(newDir); |
967 |
copyDir(p, newDir); |
968 |
copyDir(p, newDir); |
968 |
} else { |
969 |
} else { |
969 |
boost::filesystem::copy_file(p, to / p.leaf()); |
970 |
boost::filesystem::copy_file(p, to / p.filename()); |
970 |
} |
971 |
} |
971 |
} |
972 |
} |
972 |
++i; |
973 |
++i; |