Files
scylladb/streaming/stream_transfer_task.hh
Asias He 953af38281 streaming: Allow drop table during streaming
Currently, if a table is dropped during streaming, the streaming would
fail with no_such_column_family error.

Since the table is dropped anyway, it makes more sense to ignore the
streaming result of the dropped table, whether it is successful or
failed.

This allows users to drop tables during node operations, e.g., bootstrap
or decommission a node.

This is especially useful for the cloud users where it is hard to
coordinate between a node operation by admin and user cql change.

This patch also fixes a possible user after free issue by not passing
the table reference object around.

Fixes #10395

Closes #10396
2022-04-24 17:43:20 +03:00

58 lines
1.4 KiB
C++

/*
*
* Modified by ScyllaDB
* Copyright (C) 2015-present ScyllaDB
*/
/*
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
*/
#pragma once
#include "utils/UUID.hh"
#include "streaming/stream_task.hh"
#include "streaming/stream_detail.hh"
#include <map>
#include <seastar/core/semaphore.hh>
namespace streaming {
class stream_session;
class send_info;
/**
* StreamTransferTask sends sections of SSTable files in certain ColumnFamily.
*/
class stream_transfer_task : public stream_task {
private:
// A stream_transfer_task always contains the same range to stream
dht::token_range_vector _ranges;
std::map<unsigned, dht::partition_range_vector> _shard_ranges;
long _total_size;
bool _mutation_done_sent = false;
public:
using UUID = utils::UUID;
stream_transfer_task(stream_transfer_task&&) = default;
stream_transfer_task(shared_ptr<stream_session> session, UUID cf_id, dht::token_range_vector ranges, long total_size = 0);
~stream_transfer_task();
public:
virtual void abort() override {
}
virtual int get_total_number_of_files() const override {
return 1;
}
virtual long get_total_size() const override {
return _total_size;
}
future<> execute();
void append_ranges(const dht::token_range_vector& ranges);
void sort_and_merge_ranges();
};
} // namespace streaming