mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-21 09:00:35 +00:00
When a table is loaded on startup during a vnodes-to-tablets migration (forward or rollback), the `table_populator` runs a resharding compaction. Set the migration virtual task as parent of the resharding task. This enables users to easily find all node-local resharding tasks related to a particular migration. Make `migration_virtual_task::make_task_id()` public so that the `distributed_loader` can compute the migration's task ID. Signed-off-by: Nikos Dragazis <nikolaos.dragazis@scylladb.com>
101 lines
4.1 KiB
C++
101 lines
4.1 KiB
C++
/*
|
|
* Copyright (C) 2018-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
#include <seastar/core/future.hh>
|
|
#include <seastar/core/sharded.hh>
|
|
#include <seastar/core/sstring.hh>
|
|
#include <vector>
|
|
#include <functional>
|
|
#include "seastarx.hh"
|
|
#include "compaction/compaction_descriptor.hh"
|
|
#include "db/system_keyspace.hh"
|
|
#include "sstables/sstable_directory.hh"
|
|
|
|
namespace seastar {
|
|
class abort_source;
|
|
}
|
|
|
|
namespace replica {
|
|
class database;
|
|
class table;
|
|
using column_family = table;
|
|
}
|
|
|
|
namespace db {
|
|
class config;
|
|
class system_keyspace;
|
|
namespace view {
|
|
enum class sstable_destination_decision;
|
|
class view_builder;
|
|
class view_building_worker;
|
|
}
|
|
}
|
|
|
|
namespace sstables {
|
|
|
|
class entry_descriptor;
|
|
class foreign_sstable_open_info;
|
|
|
|
}
|
|
|
|
namespace service {
|
|
|
|
class storage_proxy;
|
|
|
|
}
|
|
|
|
namespace locator {
|
|
class effective_replication_map_factory;
|
|
}
|
|
|
|
class distributed_loader_for_tests;
|
|
|
|
namespace replica {
|
|
|
|
class table_populator;
|
|
class global_table_ptr;
|
|
|
|
class distributed_loader {
|
|
friend class ::distributed_loader_for_tests;
|
|
friend class table_populator;
|
|
|
|
static future<> reshape(sharded<sstables::sstable_directory>& dir, sharded<replica::database>& db, compaction::reshape_mode mode,
|
|
sstring ks_name, sstring table_name, compaction::compaction_sstable_creator_fn creator, std::function<bool (const sstables::shared_sstable&)> filter);
|
|
static future<> reshard(sharded<sstables::sstable_directory>& dir, sharded<replica::database>& db, sstring ks_name, sstring table_name, compaction::compaction_sstable_creator_fn creator,
|
|
compaction::owned_ranges_ptr owned_ranges_ptr = nullptr, bool vnodes_resharding = false, tasks::task_info parent_info = {});
|
|
static future<> process_sstable_dir(sharded<sstables::sstable_directory>& dir, sstables::sstable_directory::process_flags flags);
|
|
static future<> lock_table(global_table_ptr&, sharded<sstables::sstable_directory>& dir);
|
|
static future<size_t> make_sstables_available(sstables::sstable_directory& dir,
|
|
sharded<replica::database>& db, sharded<db::view::view_builder>& vb, sharded<db::view::view_building_worker>& vbw,
|
|
db::view::sstable_destination_decision needs_view_update, sstring ks, sstring cf);
|
|
static future<> populate_keyspace(sharded<replica::database>& db, sharded<db::system_keyspace>& sys_ks, keyspace& ks, sstring ks_name,
|
|
std::optional<service::intended_storage_mode> storage_mode = std::nullopt);
|
|
static future<std::tuple<table_id, std::vector<std::vector<sstables::shared_sstable>>>>
|
|
get_sstables_from(sharded<replica::database>& db, sstring ks, sstring cf, sstables::sstable_open_config cfg,
|
|
noncopyable_function<future<>(global_table_ptr&, sharded<sstables::sstable_directory>&)> start_dir);
|
|
|
|
public:
|
|
static future<> init_system_keyspace(sharded<db::system_keyspace>&, sharded<locator::effective_replication_map_factory>&, sharded<replica::database>&);
|
|
static future<> init_non_system_keyspaces(sharded<replica::database>& db, sharded<service::storage_proxy>& proxy, sharded<db::system_keyspace>& sys_ks);
|
|
|
|
// 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<std::tuple<table_id, std::vector<std::vector<sstables::shared_sstable>>>>
|
|
get_sstables_from_upload_dir(sharded<replica::database>& db, sstring ks, sstring cf, sstables::sstable_open_config cfg);
|
|
static future<std::tuple<table_id, std::vector<std::vector<sstables::shared_sstable>>>>
|
|
get_sstables_from_object_store(sharded<replica::database>& db, sstring ks, sstring cf, std::vector<sstring> sstables, sstring endpoint, sstring type, sstring bucket, sstring prefix, sstables::sstable_open_config cfg, std::function<seastar::abort_source*()> = {});
|
|
static future<> process_upload_dir(sharded<replica::database>& db, sharded<db::view::view_builder>& vb, sharded<db::view::view_building_worker>& vbw, sstring ks_name, sstring cf_name, bool skip_cleanup, bool skip_reshape);
|
|
};
|
|
|
|
}
|