Lines 36-41
Link Here
|
36 |
#include <boost/iostreams/stream_buffer.hpp> |
36 |
#include <boost/iostreams/stream_buffer.hpp> |
37 |
#include <boost/iostreams/tee.hpp> |
37 |
#include <boost/iostreams/tee.hpp> |
38 |
#include <csignal> |
38 |
#include <csignal> |
|
|
39 |
#include <boost/filesystem.hpp> |
39 |
#include <fcntl.h> |
40 |
#include <fcntl.h> |
40 |
#include <fmt/format.h> |
41 |
#include <fmt/format.h> |
41 |
#include <fstream> |
42 |
#include <fstream> |
Lines 316-341
void copyDir(const boost::filesystem::path& from, const boost::filesystem::path&
Link Here
|
316 |
boost::filesystem::directory_iterator i(from); |
317 |
boost::filesystem::directory_iterator i(from); |
317 |
while (i != end) { |
318 |
while (i != end) { |
318 |
boost::filesystem::path p = *i; |
319 |
boost::filesystem::path p = *i; |
319 |
if (p.leaf() == "metrics.interim" || p.leaf() == "metrics.interim.temp") { |
320 |
if (p.filename() == "metrics.interim" || p.filename() == "metrics.interim.temp") { |
320 |
// Ignore any errors for metrics.interim* files as these may disappear during copy |
321 |
// Ignore any errors for metrics.interim* files as these may disappear during copy |
321 |
boost::system::error_code ec; |
322 |
boost::system::error_code ec; |
322 |
boost::filesystem::copy_file(p, to / p.leaf(), ec); |
323 |
boost::filesystem::copy_file(p, to / p.filename(), ec); |
323 |
if (ec) { |
324 |
if (ec) { |
324 |
LOGV2_INFO(22814, |
325 |
LOGV2_INFO(22814, |
325 |
"Skipping copying of file from '{from}' to " |
326 |
"Skipping copying of file from '{from}' to " |
326 |
"'{to}' due to: {error}", |
327 |
"'{to}' due to: {error}", |
327 |
"Skipping copying of file due to error" |
328 |
"Skipping copying of file due to error" |
328 |
"from"_attr = p.generic_string(), |
329 |
"from"_attr = p.generic_string(), |
329 |
"to"_attr = (to / p.leaf()).generic_string(), |
330 |
"to"_attr = (to / p.filename()).generic_string(), |
330 |
"error"_attr = ec.message()); |
331 |
"error"_attr = ec.message()); |
331 |
} |
332 |
} |
332 |
} else if (p.leaf() != "mongod.lock" && p.leaf() != "WiredTiger.lock") { |
333 |
} else if (p.filename() != "mongod.lock" && p.filename() != "WiredTiger.lock") { |
333 |
if (boost::filesystem::is_directory(p)) { |
334 |
if (boost::filesystem::is_directory(p)) { |
334 |
boost::filesystem::path newDir = to / p.leaf(); |
335 |
boost::filesystem::path newDir = to / p.filename(); |
335 |
boost::filesystem::create_directory(newDir); |
336 |
boost::filesystem::create_directory(newDir); |
336 |
copyDir(p, newDir); |
337 |
copyDir(p, newDir); |
337 |
} else { |
338 |
} else { |
338 |
boost::filesystem::copy_file(p, to / p.leaf()); |
339 |
boost::filesystem::copy_file(p, to / p.filename()); |
339 |
} |
340 |
} |
340 |
} |
341 |
} |
341 |
++i; |
342 |
++i; |