Scan the table's pending_delete sub-directory if it exists. Remove any temporary pending_delete log files to roll back the respective delete_atomically operation. Replay completed pending_delete log files to roll forward the respective delete_atomically operation, and finally delete the log files. Cleanup of temporary sstable directories and pending_delete sstables are done in a preliminary scan phase when populating the column family so that we won't attempt to load the to-be-deleted sstables. Fixes #4082 Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
76 lines
2.8 KiB
C++
76 lines
2.8 KiB
C++
/*
|
|
* Copyright (C) 2018 ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* This file is part of Scylla.
|
|
*
|
|
* Scylla is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Scylla is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
#include <seastar/core/future.hh>
|
|
#include <seastar/core/distributed.hh>
|
|
#include <seastar/core/sstring.hh>
|
|
#include <seastar/core/file.hh>
|
|
#include <vector>
|
|
#include <functional>
|
|
#include "seastarx.hh"
|
|
|
|
class database;
|
|
class table;
|
|
using column_family = table;
|
|
namespace db {
|
|
class system_distributed_keyspace;
|
|
namespace view {
|
|
class view_update_generator;
|
|
}
|
|
}
|
|
|
|
namespace sstables {
|
|
|
|
class entry_descriptor;
|
|
class foreign_sstable_open_info;
|
|
|
|
}
|
|
|
|
namespace service {
|
|
|
|
class storage_proxy;
|
|
|
|
}
|
|
|
|
class distributed_loader {
|
|
public:
|
|
static void reshard(distributed<database>& db, sstring ks_name, sstring cf_name);
|
|
static future<> open_sstable(distributed<database>& db, sstables::entry_descriptor comps,
|
|
std::function<future<> (column_family&, sstables::foreign_sstable_open_info)> func,
|
|
const io_priority_class& pc = default_priority_class());
|
|
static future<> load_new_sstables(distributed<database>& db, distributed<db::view::view_update_generator>& view_update_generator,
|
|
sstring ks, sstring cf, std::vector<sstables::entry_descriptor> new_tables);
|
|
static future<std::vector<sstables::entry_descriptor>> flush_upload_dir(distributed<database>& db, distributed<db::system_distributed_keyspace>& sys_dist_ks, sstring ks_name, sstring cf_name);
|
|
static future<sstables::entry_descriptor> probe_file(distributed<database>& db, sstring sstdir, sstring fname);
|
|
static future<> populate_column_family(distributed<database>& db, sstring sstdir, sstring ks, sstring cf);
|
|
static future<> populate_keyspace(distributed<database>& db, sstring datadir, sstring ks_name);
|
|
static future<> init_system_keyspace(distributed<database>& db);
|
|
static future<> ensure_system_table_directories(distributed<database>& db);
|
|
static future<> init_non_system_keyspaces(distributed<database>& db, distributed<service::storage_proxy>& proxy);
|
|
private:
|
|
static future<> cleanup_column_family_temp_sst_dirs(sstring sstdir);
|
|
static future<> handle_sstables_pending_delete(sstring pending_deletes_dir);
|
|
static future<> do_populate_column_family(distributed<database>& db, sstring sstdir, sstring ks, sstring cf);
|
|
};
|