mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-08 16:03:20 +00:00
treewide: use std::filesystem
Rather than {std::experimental,boost,seastar::compat}::filesystem
On Sat, 2019-03-23 at 01:44 +0200, Avi Kivity wrote:
> The intent for seastar::compat was to allow the application to choose
> the C++ dialect and have seastar follow, rather than have seastar choose
> the types and have the application follow (as in your patch).
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
@@ -1111,7 +1111,7 @@ for mode in build_modes:
|
|||||||
args.user_cflags += " " + pkg_config('jsoncpp', '--cflags')
|
args.user_cflags += " " + pkg_config('jsoncpp', '--cflags')
|
||||||
args.user_cflags += ' -march=' + args.target
|
args.user_cflags += ' -march=' + args.target
|
||||||
libs = ' '.join([maybe_static(args.staticyamlcpp, '-lyaml-cpp'), '-latomic', '-llz4', '-lz', '-lsnappy', pkg_config('jsoncpp', '--libs'),
|
libs = ' '.join([maybe_static(args.staticyamlcpp, '-lyaml-cpp'), '-latomic', '-llz4', '-lz', '-lsnappy', pkg_config('jsoncpp', '--libs'),
|
||||||
maybe_static(args.staticboost, '-lboost_filesystem'), ' -lstdc++fs', ' -lcrypt', ' -lcryptopp', ' -lpthread',
|
' -lstdc++fs', ' -lcrypt', ' -lcryptopp', ' -lpthread',
|
||||||
maybe_static(args.staticboost, '-lboost_date_time'), ])
|
maybe_static(args.staticboost, '-lboost_date_time'), ])
|
||||||
|
|
||||||
xxhash_dir = 'xxHash'
|
xxhash_dir = 'xxHash'
|
||||||
|
|||||||
@@ -134,8 +134,8 @@ db::config::add_options(boost::program_options::options_description_easy_init& i
|
|||||||
return init;
|
return init;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path db::config::get_conf_dir() {
|
db::fs::path db::config::get_conf_dir() {
|
||||||
using namespace boost::filesystem;
|
using namespace db::fs;
|
||||||
|
|
||||||
path confdir;
|
path confdir;
|
||||||
auto* cd = std::getenv("SCYLLA_CONF");
|
auto* cd = std::getenv("SCYLLA_CONF");
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include <seastar/core/sstring.hh>
|
#include <seastar/core/sstring.hh>
|
||||||
@@ -39,6 +38,8 @@ namespace seastar { class file; struct logging_settings; }
|
|||||||
|
|
||||||
namespace db {
|
namespace db {
|
||||||
|
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
class extensions;
|
class extensions;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -74,7 +75,7 @@ public:
|
|||||||
* @return path of the directory where configuration files are located
|
* @return path of the directory where configuration files are located
|
||||||
* according the environment variables definitions.
|
* according the environment variables definitions.
|
||||||
*/
|
*/
|
||||||
static boost::filesystem::path get_conf_dir();
|
static fs::path get_conf_dir();
|
||||||
|
|
||||||
using string_map = std::unordered_map<sstring, sstring>;
|
using string_map = std::unordered_map<sstring, sstring>;
|
||||||
//program_options::string_map;
|
//program_options::string_map;
|
||||||
|
|||||||
@@ -798,7 +798,7 @@ void manager::end_point_hints_manager::sender::send_hints_maybe() noexcept {
|
|||||||
manager_logger.trace("send_hints(): we handled {} segments", replayed_segments_count);
|
manager_logger.trace("send_hints(): we handled {} segments", replayed_segments_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static future<> scan_for_hints_dirs(const sstring& hints_directory, std::function<future<> (stdx::filesystem::path dir, directory_entry de, unsigned shard_id)> f) {
|
static future<> scan_for_hints_dirs(const sstring& hints_directory, std::function<future<> (fs::path dir, directory_entry de, unsigned shard_id)> f) {
|
||||||
return lister::scan_dir(hints_directory, { directory_entry_type::directory }, [f = std::move(f)] (fs::path dir, directory_entry de) mutable {
|
return lister::scan_dir(hints_directory, { directory_entry_type::directory }, [f = std::move(f)] (fs::path dir, directory_entry de) mutable {
|
||||||
try {
|
try {
|
||||||
return f(std::move(dir), std::move(de), std::stoi(de.name.c_str()));
|
return f(std::move(dir), std::move(de), std::stoi(de.name.c_str()));
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
#include "disk-error-handler.hh"
|
#include "disk-error-handler.hh"
|
||||||
#include "seastarx.hh"
|
#include "seastarx.hh"
|
||||||
#include <seastar/core/sleep.hh>
|
#include <seastar/core/sleep.hh>
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
|
|
||||||
namespace db {
|
namespace db {
|
||||||
namespace hints {
|
namespace hints {
|
||||||
@@ -198,7 +197,7 @@ future<> resource_manager::prepare_per_device_limits() {
|
|||||||
// Since we possibly deferred, we need to recheck the _per_device_limits_map.
|
// Since we possibly deferred, we need to recheck the _per_device_limits_map.
|
||||||
if (inserted) {
|
if (inserted) {
|
||||||
// By default, give each group of managers 10% of the available disk space. Give each shard an equal share of the available space.
|
// By default, give each group of managers 10% of the available disk space. Give each shard an equal share of the available space.
|
||||||
it->second.max_shard_disk_space_size = boost::filesystem::space(shard_manager.hints_dir().c_str()).capacity / (10 * smp::count);
|
it->second.max_shard_disk_space_size = std::filesystem::space(shard_manager.hints_dir().c_str()).capacity / (10 * smp::count);
|
||||||
// If hints directory is a mountpoint, we assume it's on dedicated (i.e. not shared with data/commitlog/etc) storage.
|
// If hints directory is a mountpoint, we assume it's on dedicated (i.e. not shared with data/commitlog/etc) storage.
|
||||||
// Then, reserve 90% of all space instead of 10% above.
|
// Then, reserve 90% of all space instead of 10% above.
|
||||||
if (is_mountpoint) {
|
if (is_mountpoint) {
|
||||||
|
|||||||
@@ -22,14 +22,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
#include <filesystem>
|
||||||
#include <seastar/core/shared_ptr.hh>
|
#include <seastar/core/shared_ptr.hh>
|
||||||
#include <seastar/core/file.hh>
|
#include <seastar/core/file.hh>
|
||||||
#include <seastar/core/enum.hh>
|
#include <seastar/core/enum.hh>
|
||||||
#include <experimental/filesystem>
|
|
||||||
|
|
||||||
#include "seastarx.hh"
|
#include "seastarx.hh"
|
||||||
|
|
||||||
namespace fs = std::experimental::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
class lister final {
|
class lister final {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ production_snitch_base::production_snitch_base(const sstring& prop_file_name)
|
|||||||
if (!prop_file_name.empty()) {
|
if (!prop_file_name.empty()) {
|
||||||
_prop_file_name = prop_file_name;
|
_prop_file_name = prop_file_name;
|
||||||
} else {
|
} else {
|
||||||
using namespace boost::filesystem;
|
using namespace db::fs;
|
||||||
|
|
||||||
path def_prop_file(db::config::get_conf_dir());
|
path def_prop_file(db::config::get_conf_dir());
|
||||||
def_prop_file /= path(snitch_properties_filename);
|
def_prop_file /= path(snitch_properties_filename);
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
|
|
||||||
#include "gms/endpoint_state.hh"
|
#include "gms/endpoint_state.hh"
|
||||||
#include "locator/token_metadata.hh"
|
#include "locator/token_metadata.hh"
|
||||||
|
|||||||
9
main.cc
9
main.cc
@@ -70,6 +70,8 @@
|
|||||||
#include "gms/feature_service.hh"
|
#include "gms/feature_service.hh"
|
||||||
#include "distributed_loader.hh"
|
#include "distributed_loader.hh"
|
||||||
|
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
seastar::metrics::metric_groups app_metrics;
|
seastar::metrics::metric_groups app_metrics;
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
@@ -91,14 +93,13 @@ V get_or_default(const std::unordered_map<K, V, Args...>& ss, const K2& key, con
|
|||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boost::filesystem::path relative_conf_dir(boost::filesystem::path path) {
|
static fs::path relative_conf_dir(fs::path path) {
|
||||||
static auto conf_dir = db::config::get_conf_dir(); // this is not gonna change in our life time
|
static auto conf_dir = db::config::get_conf_dir(); // this is not gonna change in our life time
|
||||||
return conf_dir / path;
|
return conf_dir / path;
|
||||||
}
|
}
|
||||||
|
|
||||||
static future<>
|
static future<>
|
||||||
read_config(bpo::variables_map& opts, db::config& cfg) {
|
read_config(bpo::variables_map& opts, db::config& cfg) {
|
||||||
using namespace boost::filesystem;
|
|
||||||
sstring file;
|
sstring file;
|
||||||
|
|
||||||
if (opts.count("options-file") > 0) {
|
if (opts.count("options-file") > 0) {
|
||||||
@@ -568,7 +569,7 @@ int main(int ac, char** av) {
|
|||||||
|
|
||||||
supervisor::notify("creating hints directories");
|
supervisor::notify("creating hints directories");
|
||||||
if (hinted_handoff_enabled) {
|
if (hinted_handoff_enabled) {
|
||||||
boost::filesystem::path hints_base_dir(db.local().get_config().hints_directory());
|
fs::path hints_base_dir(db.local().get_config().hints_directory());
|
||||||
dirs.touch_and_lock(db.local().get_config().hints_directory()).get();
|
dirs.touch_and_lock(db.local().get_config().hints_directory()).get();
|
||||||
directories.insert(db.local().get_config().hints_directory());
|
directories.insert(db.local().get_config().hints_directory());
|
||||||
for (unsigned i = 0; i < smp::count; ++i) {
|
for (unsigned i = 0; i < smp::count; ++i) {
|
||||||
@@ -577,7 +578,7 @@ int main(int ac, char** av) {
|
|||||||
directories.insert(std::move(shard_dir));
|
directories.insert(std::move(shard_dir));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boost::filesystem::path view_pending_updates_base_dir = boost::filesystem::path(db.local().get_config().view_hints_directory());
|
fs::path view_pending_updates_base_dir = fs::path(db.local().get_config().view_hints_directory());
|
||||||
sstring view_pending_updates_base_dir_str = view_pending_updates_base_dir.native();
|
sstring view_pending_updates_base_dir_str = view_pending_updates_base_dir.native();
|
||||||
dirs.touch_and_lock(view_pending_updates_base_dir_str).get();
|
dirs.touch_and_lock(view_pending_updates_base_dir_str).get();
|
||||||
directories.insert(view_pending_updates_base_dir_str);
|
directories.insert(view_pending_updates_base_dir_str);
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
#include <seastar/core/distributed.hh>
|
#include <seastar/core/distributed.hh>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <experimental/filesystem>
|
|
||||||
#include "types.hh"
|
#include "types.hh"
|
||||||
#include "clustering_key_filter.hh"
|
#include "clustering_key_filter.hh"
|
||||||
#include <seastar/core/enum.hh>
|
#include <seastar/core/enum.hh>
|
||||||
@@ -75,7 +74,7 @@ namespace mc {
|
|||||||
class writer;
|
class writer;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace fs = std::experimental::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
extern logging::logger sstlog;
|
extern logging::logger sstlog;
|
||||||
class key;
|
class key;
|
||||||
|
|||||||
@@ -304,6 +304,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static future<> do_with(std::function<future<>(cql_test_env&)> func, cql_test_config cfg_in) {
|
static future<> do_with(std::function<future<>(cql_test_env&)> func, cql_test_config cfg_in) {
|
||||||
|
using namespace std::filesystem;
|
||||||
|
|
||||||
return seastar::async([cfg_in = std::move(cfg_in), func] {
|
return seastar::async([cfg_in = std::move(cfg_in), func] {
|
||||||
logalloc::prime_segment_pool(memory::stats().total_memory(), memory::min_free_memory()).get();
|
logalloc::prime_segment_pool(memory::stats().total_memory(), memory::min_free_memory()).get();
|
||||||
bool old_active = false;
|
bool old_active = false;
|
||||||
@@ -339,13 +341,13 @@ public:
|
|||||||
cfg->ring_delay_ms() = 500;
|
cfg->ring_delay_ms() = 500;
|
||||||
cfg->experimental() = true;
|
cfg->experimental() = true;
|
||||||
cfg->shutdown_announce_in_ms() = 0;
|
cfg->shutdown_announce_in_ms() = 0;
|
||||||
boost::filesystem::create_directories((data_dir_path + "/system").c_str());
|
create_directories((data_dir_path + "/system").c_str());
|
||||||
boost::filesystem::create_directories(cfg->commitlog_directory().c_str());
|
create_directories(cfg->commitlog_directory().c_str());
|
||||||
boost::filesystem::create_directories(cfg->hints_directory().c_str());
|
create_directories(cfg->hints_directory().c_str());
|
||||||
boost::filesystem::create_directories(cfg->view_hints_directory().c_str());
|
create_directories(cfg->view_hints_directory().c_str());
|
||||||
for (unsigned i = 0; i < smp::count; ++i) {
|
for (unsigned i = 0; i < smp::count; ++i) {
|
||||||
boost::filesystem::create_directories((cfg->hints_directory() + "/" + std::to_string(i)).c_str());
|
create_directories((cfg->hints_directory() + "/" + std::to_string(i)).c_str());
|
||||||
boost::filesystem::create_directories((cfg->view_hints_directory() + "/" + std::to_string(i)).c_str());
|
create_directories((cfg->view_hints_directory() + "/" + std::to_string(i)).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
const gms::inet_address listen("127.0.0.1");
|
const gms::inet_address listen("127.0.0.1");
|
||||||
|
|||||||
@@ -24,16 +24,18 @@
|
|||||||
#include "locator/ec2_snitch.hh"
|
#include "locator/ec2_snitch.hh"
|
||||||
#include "utils/fb_utilities.hh"
|
#include "utils/fb_utilities.hh"
|
||||||
#include <seastar/testing/test_case.hh>
|
#include <seastar/testing/test_case.hh>
|
||||||
#include <boost/filesystem.hpp>
|
#include <seastar/util/std-compat.hh>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
static boost::filesystem::path test_files_subdir("tests/snitch_property_files");
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
|
static fs::path test_files_subdir("tests/snitch_property_files");
|
||||||
|
|
||||||
future<> one_test(const std::string& property_fname, bool exp_result) {
|
future<> one_test(const std::string& property_fname, bool exp_result) {
|
||||||
using namespace locator;
|
using namespace locator;
|
||||||
using namespace boost::filesystem;
|
using namespace std::filesystem;
|
||||||
|
|
||||||
printf("Testing %s property file: %s\n",
|
printf("Testing %s property file: %s\n",
|
||||||
(exp_result ? "well-formed" : "ill-formed"),
|
(exp_result ? "well-formed" : "ill-formed"),
|
||||||
|
|||||||
@@ -38,8 +38,11 @@
|
|||||||
#include <seastar/testing/test_case.hh>
|
#include <seastar/testing/test_case.hh>
|
||||||
#include <seastar/http/httpd.hh>
|
#include <seastar/http/httpd.hh>
|
||||||
#include <seastar/net/inet_address.hh>
|
#include <seastar/net/inet_address.hh>
|
||||||
|
#include <seastar/util/std-compat.hh>
|
||||||
|
|
||||||
static boost::filesystem::path test_files_subdir("tests/snitch_property_files");
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
|
static fs::path test_files_subdir("tests/snitch_property_files");
|
||||||
static constexpr const char* DUMMY_META_SERVER_IP = "DUMMY_META_SERVER_IP";
|
static constexpr const char* DUMMY_META_SERVER_IP = "DUMMY_META_SERVER_IP";
|
||||||
static constexpr const char* USE_GCE_META_SERVER = "USE_GCE_META_SERVER";
|
static constexpr const char* USE_GCE_META_SERVER = "USE_GCE_META_SERVER";
|
||||||
|
|
||||||
@@ -60,10 +63,9 @@ class gce_meta_get_handler : public seastar::httpd::handler_base {
|
|||||||
future<> one_test(const std::string& property_fname, bool exp_result) {
|
future<> one_test(const std::string& property_fname, bool exp_result) {
|
||||||
return seastar::async([property_fname, exp_result] () {
|
return seastar::async([property_fname, exp_result] () {
|
||||||
using namespace locator;
|
using namespace locator;
|
||||||
using namespace boost::filesystem;
|
|
||||||
|
|
||||||
path fname(test_files_subdir);
|
fs::path fname(test_files_subdir);
|
||||||
fname /= path(property_fname);
|
fname /= fs::path(property_fname);
|
||||||
|
|
||||||
utils::fb_utilities::set_broadcast_address(gms::inet_address("localhost"));
|
utils::fb_utilities::set_broadcast_address(gms::inet_address("localhost"));
|
||||||
utils::fb_utilities::set_broadcast_rpc_address(gms::inet_address("localhost"));
|
utils::fb_utilities::set_broadcast_rpc_address(gms::inet_address("localhost"));
|
||||||
|
|||||||
@@ -23,16 +23,18 @@
|
|||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
#include "locator/gossiping_property_file_snitch.hh"
|
#include "locator/gossiping_property_file_snitch.hh"
|
||||||
#include <seastar/testing/test_case.hh>
|
#include <seastar/testing/test_case.hh>
|
||||||
#include <boost/filesystem.hpp>
|
#include <seastar/util/std-compat.hh>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
static boost::filesystem::path test_files_subdir("tests/snitch_property_files");
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
|
static fs::path test_files_subdir("tests/snitch_property_files");
|
||||||
|
|
||||||
future<> one_test(const std::string& property_fname, bool exp_result) {
|
future<> one_test(const std::string& property_fname, bool exp_result) {
|
||||||
using namespace locator;
|
using namespace locator;
|
||||||
using namespace boost::filesystem;
|
using namespace std::filesystem;
|
||||||
|
|
||||||
printf("Testing %s property file: %s\n",
|
printf("Testing %s property file: %s\n",
|
||||||
(exp_result ? "well-formed" : "ill-formed"),
|
(exp_result ? "well-formed" : "ill-formed"),
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
#include <boost/range/irange.hpp>
|
#include <boost/range/irange.hpp>
|
||||||
#include <boost/range/algorithm_ext.hpp>
|
#include <boost/range/algorithm_ext.hpp>
|
||||||
#include <boost/range/adaptors.hpp>
|
#include <boost/range/adaptors.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
#include <json/json.h>
|
#include <json/json.h>
|
||||||
#include "tests/cql_test_env.hh"
|
#include "tests/cql_test_env.hh"
|
||||||
#include "tests/perf/perf.hh"
|
#include "tests/perf/perf.hh"
|
||||||
|
|||||||
@@ -23,18 +23,20 @@
|
|||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
#include "locator/gossiping_property_file_snitch.hh"
|
#include "locator/gossiping_property_file_snitch.hh"
|
||||||
#include <seastar/testing/test_case.hh>
|
#include <seastar/testing/test_case.hh>
|
||||||
#include <boost/filesystem.hpp>
|
#include <seastar/util/std-compat.hh>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
static boost::filesystem::path test_files_subdir("tests/snitch_property_files");
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
|
static fs::path test_files_subdir("tests/snitch_property_files");
|
||||||
|
|
||||||
future<> one_test(const std::string& property_fname1,
|
future<> one_test(const std::string& property_fname1,
|
||||||
const std::string& property_fname2,
|
const std::string& property_fname2,
|
||||||
bool exp_result) {
|
bool exp_result) {
|
||||||
using namespace locator;
|
using namespace locator;
|
||||||
using namespace boost::filesystem;
|
using namespace std::filesystem;
|
||||||
|
|
||||||
utils::fb_utilities::set_broadcast_address(gms::inet_address("localhost"));
|
utils::fb_utilities::set_broadcast_address(gms::inet_address("localhost"));
|
||||||
utils::fb_utilities::set_broadcast_rpc_address(gms::inet_address("localhost"));
|
utils::fb_utilities::set_broadcast_rpc_address(gms::inet_address("localhost"));
|
||||||
|
|||||||
@@ -3086,7 +3086,7 @@ static sstring get_write_test_path(sstring table_name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This method should not be called for compressed sstables because compression is not deterministic
|
// This method should not be called for compressed sstables because compression is not deterministic
|
||||||
static void compare_sstables(const seastar::compat::filesystem::path& result_path, sstring table_name) {
|
static void compare_sstables(const std::filesystem::path& result_path, sstring table_name) {
|
||||||
for (auto file_type : {component_type::Data,
|
for (auto file_type : {component_type::Data,
|
||||||
component_type::Index,
|
component_type::Index,
|
||||||
component_type::Digest,
|
component_type::Digest,
|
||||||
@@ -3136,7 +3136,7 @@ static tmpdir write_and_compare_sstables(schema_ptr s, lw_shared_ptr<memtable> m
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static sstable_assertions validate_read(schema_ptr s, const seastar::compat::filesystem::path& path, std::vector<mutation> mutations) {
|
static sstable_assertions validate_read(schema_ptr s, const std::filesystem::path& path, std::vector<mutation> mutations) {
|
||||||
sstable_assertions sst(s, path.string(), 1);
|
sstable_assertions sst(s, path.string(), 1);
|
||||||
sst.load();
|
sst.load();
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,8 @@
|
|||||||
|
|
||||||
#include "sstable_utils.hh"
|
#include "sstable_utils.hh"
|
||||||
|
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
using namespace sstables;
|
using namespace sstables;
|
||||||
|
|
||||||
static const sstring some_keyspace("ks");
|
static const sstring some_keyspace("ks");
|
||||||
@@ -3633,7 +3635,7 @@ SEASTAR_TEST_CASE(test_partition_skipping) {
|
|||||||
|
|
||||||
// Must be run in a seastar thread
|
// Must be run in a seastar thread
|
||||||
static
|
static
|
||||||
shared_sstable make_sstable_easy(test_env& env, const seastar::compat::filesystem::path& path, flat_mutation_reader rd, sstable_writer_config cfg, const sstables::sstable::version_types version) {
|
shared_sstable make_sstable_easy(test_env& env, const fs::path& path, flat_mutation_reader rd, sstable_writer_config cfg, const sstables::sstable::version_types version) {
|
||||||
auto s = rd.schema();
|
auto s = rd.schema();
|
||||||
auto sst = env.make_sstable(s, path.string(), 1, version, big);
|
auto sst = env.make_sstable(s, path.string(), 1, version, big);
|
||||||
sst->write_components(std::move(rd), 1, s, cfg, encoding_stats{}).get();
|
sst->write_components(std::move(rd), 1, s, cfg, encoding_stats{}).get();
|
||||||
@@ -3817,8 +3819,7 @@ SEASTAR_TEST_CASE(test_skipping_using_index) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static void copy_directory(boost::filesystem::path src_dir, boost::filesystem::path dst_dir) {
|
static void copy_directory(fs::path src_dir, fs::path dst_dir) {
|
||||||
namespace fs = boost::filesystem;
|
|
||||||
fs::create_directory(dst_dir);
|
fs::create_directory(dst_dir);
|
||||||
auto src_dir_components = std::distance(src_dir.begin(), src_dir.end());
|
auto src_dir_components = std::distance(src_dir.begin(), src_dir.end());
|
||||||
using rdi = fs::recursive_directory_iterator;
|
using rdi = fs::recursive_directory_iterator;
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
#include "tests/test_services.hh"
|
#include "tests/test_services.hh"
|
||||||
#include "tests/sstable_test_env.hh"
|
#include "tests/sstable_test_env.hh"
|
||||||
#include "tmpdir.hh"
|
#include "tmpdir.hh"
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
constexpr auto la = sstables::sstable::version_types::la;
|
constexpr auto la = sstables::sstable::version_types::la;
|
||||||
@@ -689,11 +688,11 @@ public:
|
|||||||
storage_service_for_tests ssft;
|
storage_service_for_tests ssft;
|
||||||
auto src_dir = tmpdir();
|
auto src_dir = tmpdir();
|
||||||
auto dest_dir = tmpdir();
|
auto dest_dir = tmpdir();
|
||||||
for (const auto& entry : seastar::compat::filesystem::directory_iterator(src.c_str())) {
|
for (const auto& entry : std::filesystem::directory_iterator(src.c_str())) {
|
||||||
seastar::compat::filesystem::copy(entry.path(), src_dir.path() / entry.path().filename());
|
std::filesystem::copy(entry.path(), src_dir.path() / entry.path().filename());
|
||||||
}
|
}
|
||||||
auto dest_path = dest_dir.path() / src.c_str();
|
auto dest_path = dest_dir.path() / src.c_str();
|
||||||
seastar::compat::filesystem::create_directories(dest_path);
|
std::filesystem::create_directories(dest_path);
|
||||||
test_env env;
|
test_env env;
|
||||||
fut(env, src_dir.path().string(), dest_path.string()).get();
|
fut(env, src_dir.path().string(), dest_path.string()).get();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,23 +27,25 @@
|
|||||||
|
|
||||||
#include "utils/UUID.hh"
|
#include "utils/UUID.hh"
|
||||||
|
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
// Creates a new empty directory with arbitrary name, which will be removed
|
// Creates a new empty directory with arbitrary name, which will be removed
|
||||||
// automatically when tmpdir object goes out of scope.
|
// automatically when tmpdir object goes out of scope.
|
||||||
class tmpdir {
|
class tmpdir {
|
||||||
seastar::compat::filesystem::path _path;
|
fs::path _path;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void remove() {
|
void remove() {
|
||||||
if (!_path.empty()) {
|
if (!_path.empty()) {
|
||||||
seastar::compat::filesystem::remove_all(_path);
|
fs::remove_all(_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
tmpdir()
|
tmpdir()
|
||||||
: _path(seastar::compat::filesystem::temp_directory_path() /
|
: _path(fs::temp_directory_path() /
|
||||||
fmt::format(FMT_STRING("scylla-{}"), utils::make_random_uuid())) {
|
fs::path(fmt::format(FMT_STRING("scylla-{}"), utils::make_random_uuid()))) {
|
||||||
seastar::compat::filesystem::create_directories(_path);
|
fs::create_directories(_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpdir(tmpdir&& other) noexcept : _path(std::exchange(other._path, {})) { }
|
tmpdir(tmpdir&& other) noexcept : _path(std::exchange(other._path, {})) { }
|
||||||
@@ -58,5 +60,5 @@ public:
|
|||||||
remove();
|
remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
const seastar::compat::filesystem::path& path() const noexcept { return _path; }
|
const fs::path& path() const noexcept { return _path; }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
|
|
||||||
#include <seastar/core/sstring.hh>
|
#include <seastar/core/sstring.hh>
|
||||||
#include <seastar/core/future.hh>
|
#include <seastar/core/future.hh>
|
||||||
|
|||||||
Reference in New Issue
Block a user