/* * Copyright (C) 2018-present ScyllaDB */ /* * SPDX-License-Identifier: AGPL-3.0-or-later */ #pragma once #include #include #include #include #include #include #include #include #include "seastarx.hh" #include "compaction/compaction_descriptor.hh" namespace replica { class database; class table; using column_family = table; } namespace db { class config; class system_distributed_keyspace; class system_keyspace; namespace view { class view_update_generator; } } namespace sstables { class entry_descriptor; class foreign_sstable_open_info; class sstable_directory; } namespace service { class storage_proxy; class storage_service; } namespace gms { class gossiper; } class distributed_loader_for_tests; namespace replica { class distributed_loader { friend class ::distributed_loader_for_tests; static future<> reshape(sharded& dir, sharded& db, sstables::reshape_mode mode, sstring ks_name, sstring table_name, sstables::compaction_sstable_creator_fn creator, std::function filter); static future<> reshard(sharded& dir, sharded& db, sstring ks_name, sstring table_name, sstables::compaction_sstable_creator_fn creator); static future<> process_sstable_dir(sharded& dir, bool sort_sstables_according_to_owner = true); static future<> lock_table(sharded& dir, sharded& db, sstring ks_name, sstring cf_name); static future make_sstables_available(sstables::sstable_directory& dir, sharded& db, sharded& view_update_generator, std::filesystem::path datadir, sstring ks, sstring cf); using allow_offstrategy_compaction = bool_class; using must_exist = bool_class; static future<> populate_column_family(distributed& db, sstring sstdir, sstring ks, sstring cf, allow_offstrategy_compaction, must_exist = must_exist::yes); static future<> populate_keyspace(distributed& db, sstring datadir, sstring ks_name); static future<> cleanup_column_family_temp_sst_dirs(sstring sstdir); static future<> handle_sstables_pending_delete(sstring pending_deletes_dir); public: static future<> init_system_keyspace(distributed& db, distributed& ss, sharded& g, db::config& cfg); static future<> init_non_system_keyspaces(distributed& db, distributed& proxy, sharded& sys_ks); static future<> ensure_system_table_directories(distributed& db); // Scan sstables under upload directory. Return a vector with smp::count entries. // Each entry with index of idx should be accessed on shard idx only. // Each entry contains a vector of sstables for this shard. // The table UUID is returned too. static future>>> get_sstables_from_upload_dir(distributed& db, sstring ks, sstring cf); static future<> process_upload_dir(distributed& db, distributed& sys_dist_ks, distributed& view_update_generator, sstring ks_name, sstring cf_name); }; }