mirror of
https://github.com/dragonflydb/dragonfly
synced 2024-11-22 07:33:19 +00:00
fix: clang warnings (#3509)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
fa0913e662
commit
a2e63f144c
@ -711,7 +711,7 @@ void ClusterFamily::DflySlotMigrationStatus(CmdArgList args, ConnectionContext*
|
|||||||
vector<string> reply;
|
vector<string> reply;
|
||||||
reply.reserve(incoming_migrations_jobs_.size() + outgoing_migration_jobs_.size());
|
reply.reserve(incoming_migrations_jobs_.size() + outgoing_migration_jobs_.size());
|
||||||
|
|
||||||
auto append_answer = [rb, &reply](string_view direction, string_view node_id, string_view filter,
|
auto append_answer = [&reply](string_view direction, string_view node_id, string_view filter,
|
||||||
MigrationState state, size_t keys_number, string_view error) {
|
MigrationState state, size_t keys_number, string_view error) {
|
||||||
if (filter.empty() || filter == node_id) {
|
if (filter.empty() || filter == node_id) {
|
||||||
error = error.empty() ? "0" : error;
|
error = error.empty() ? "0" : error;
|
||||||
@ -794,10 +794,11 @@ SlotRanges ClusterFamily::RemoveOutgoingMigrations(shared_ptr<ClusterConfig> new
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// returns removed incoming migration
|
// returns removed incoming migration
|
||||||
bool RemoveIncomingMigrationImpl(std::vector<std::shared_ptr<IncomingSlotMigration>>& jobs,
|
bool RemoveIncomingMigrationImpl(std::vector<std::shared_ptr<IncomingSlotMigration>>& jobs,
|
||||||
string source_id) {
|
string_view source_id) {
|
||||||
auto it = std::find_if(jobs.begin(), jobs.end(), [&source_id](const auto& im) {
|
auto it = std::find_if(jobs.begin(), jobs.end(), [source_id](const auto& im) {
|
||||||
// we can have only one migration per target-source pair
|
// we can have only one migration per target-source pair
|
||||||
return source_id == im->GetSourceID();
|
return source_id == im->GetSourceID();
|
||||||
});
|
});
|
||||||
@ -840,7 +841,7 @@ void ClusterFamily::InitMigration(CmdArgList args, ConnectionContext* cntx) {
|
|||||||
VLOG(1) << "Create incoming migration, args: " << args;
|
VLOG(1) << "Create incoming migration, args: " << args;
|
||||||
CmdArgParser parser{args};
|
CmdArgParser parser{args};
|
||||||
|
|
||||||
auto [source_id, flows_num] = parser.Next<std::string, uint32_t>();
|
auto [source_id, flows_num] = parser.Next<string_view, uint32_t>();
|
||||||
|
|
||||||
std::vector<SlotRange> slots;
|
std::vector<SlotRange> slots;
|
||||||
do {
|
do {
|
||||||
@ -853,7 +854,7 @@ void ClusterFamily::InitMigration(CmdArgList args, ConnectionContext* cntx) {
|
|||||||
|
|
||||||
const auto& incoming_migrations = cluster_config()->GetIncomingMigrations();
|
const auto& incoming_migrations = cluster_config()->GetIncomingMigrations();
|
||||||
bool found = any_of(incoming_migrations.begin(), incoming_migrations.end(),
|
bool found = any_of(incoming_migrations.begin(), incoming_migrations.end(),
|
||||||
[&](const MigrationInfo& info) {
|
[source_id = source_id](const MigrationInfo& info) {
|
||||||
// TODO: also compare slot ranges (in an order-agnostic way)
|
// TODO: also compare slot ranges (in an order-agnostic way)
|
||||||
return info.node_info.id == source_id;
|
return info.node_info.id == source_id;
|
||||||
});
|
});
|
||||||
@ -869,7 +870,7 @@ void ClusterFamily::InitMigration(CmdArgList args, ConnectionContext* cntx) {
|
|||||||
LOG_IF(WARNING, was_removed) << "Reinit issued for migration from:" << source_id;
|
LOG_IF(WARNING, was_removed) << "Reinit issued for migration from:" << source_id;
|
||||||
|
|
||||||
incoming_migrations_jobs_.emplace_back(make_shared<IncomingSlotMigration>(
|
incoming_migrations_jobs_.emplace_back(make_shared<IncomingSlotMigration>(
|
||||||
std::move(source_id), &server_family_->service(), SlotRanges(std::move(slots)), flows_num));
|
string(source_id), &server_family_->service(), SlotRanges(std::move(slots)), flows_num));
|
||||||
|
|
||||||
return cntx->SendOk();
|
return cntx->SendOk();
|
||||||
}
|
}
|
||||||
@ -961,8 +962,9 @@ void ClusterFamily::DflyMigrateAck(CmdArgList args, ConnectionContext* cntx) {
|
|||||||
|
|
||||||
VLOG(1) << "DFLYMIGRATE ACK" << args;
|
VLOG(1) << "DFLYMIGRATE ACK" << args;
|
||||||
auto in_migrations = tl_cluster_config->GetIncomingMigrations();
|
auto in_migrations = tl_cluster_config->GetIncomingMigrations();
|
||||||
auto m_it = std::find_if(in_migrations.begin(), in_migrations.end(),
|
auto m_it =
|
||||||
[source_id](const auto& m) { return m.node_info.id == source_id; });
|
std::find_if(in_migrations.begin(), in_migrations.end(),
|
||||||
|
[source_id = source_id](const auto& m) { return m.node_info.id == source_id; });
|
||||||
if (m_it == in_migrations.end()) {
|
if (m_it == in_migrations.end()) {
|
||||||
LOG(WARNING) << "migration isn't in config";
|
LOG(WARNING) << "migration isn't in config";
|
||||||
return cntx->SendLong(OutgoingMigration::kInvalidAttempt);
|
return cntx->SendLong(OutgoingMigration::kInvalidAttempt);
|
||||||
|
@ -81,7 +81,7 @@ class ClusterShardMigration {
|
|||||||
std::error_code Cancel() {
|
std::error_code Cancel() {
|
||||||
std::lock_guard lk(mu_);
|
std::lock_guard lk(mu_);
|
||||||
if (socket_ != nullptr) {
|
if (socket_ != nullptr) {
|
||||||
return socket_->proactor()->Await([s = socket_, sid = source_shard_id_]() {
|
return socket_->proactor()->Await([s = socket_]() {
|
||||||
if (s->IsOpen()) {
|
if (s->IsOpen()) {
|
||||||
return s->Shutdown(SHUT_RDWR); // Does not Close(), only forbids further I/O.
|
return s->Shutdown(SHUT_RDWR); // Does not Close(), only forbids further I/O.
|
||||||
}
|
}
|
||||||
|
@ -263,7 +263,7 @@ bool RestoreStreamer::ShouldWrite(const journal::JournalItem& item) const {
|
|||||||
// On FLUSH* we restart the migration
|
// On FLUSH* we restart the migration
|
||||||
CHECK(dest_ != nullptr);
|
CHECK(dest_ != nullptr);
|
||||||
cntx_->ReportError("FLUSH command during migration");
|
cntx_->ReportError("FLUSH command during migration");
|
||||||
dest_->Shutdown(SHUT_RDWR);
|
std::ignore = dest_->Shutdown(SHUT_RDWR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user