Skip to content

Commit

Permalink
[BUG]Added support for data balancing when SSL is enabled. snapshot m…
Browse files Browse the repository at this point in the history
…anager add ssl config (#5920)

* snapshot manager add ssl config

* snapshot manager add ssl config

* fix cpplint code style

* fix code style

* fix code style

---------

Co-authored-by: l00416797 <liuxudong6@huawei.com>
Co-authored-by: Wey Gu <weyl.gu@gmail.com>
  • Loading branch information
3 people authored Sep 20, 2024
1 parent 3e9c106 commit b2437e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/kvstore/raftex/SnapshotManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ SnapshotManager::SnapshotManager() {
ioThreadPool_.reset(new folly::IOThreadPoolExecutor(
FLAGS_snapshot_io_threads,
std::make_shared<folly::NamedThreadFactory>("snapshot-ioexecutor")));
connManager_.reset(
new thrift::ThriftClientManager<raftex::cpp2::RaftexServiceAsyncClient>(FLAGS_enable_ssl));
}

folly::Future<StatusOr<std::pair<LogID, TermID>>> SnapshotManager::sendSnapshot(
Expand Down Expand Up @@ -131,7 +133,7 @@ folly::Future<raftex::cpp2::SendSnapshotResponse> SnapshotManager::send(
req.done_ref() = finished;
auto* evb = ioThreadPool_->getEventBase();
return folly::via(evb, [this, addr, evb, req = std::move(req)]() mutable {
auto client = connManager_.client(addr, evb, false, FLAGS_snapshot_send_timeout_ms);
auto client = connManager_->client(addr, evb, false, FLAGS_snapshot_send_timeout_ms);
return client->future_sendSnapshot(req);
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/kvstore/raftex/SnapshotManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "common/base/Base.h"
#include "common/base/StatusOr.h"
#include "common/ssl/SSLConfig.h"
#include "common/thrift/ThriftClientManager.h"
#include "interface/gen-cpp2/RaftexServiceAsyncClient.h"
#include "interface/gen-cpp2/raftex_types.h"
Expand Down Expand Up @@ -93,7 +94,7 @@ class SnapshotManager {
private:
std::unique_ptr<folly::IOThreadPoolExecutor> executor_;
std::unique_ptr<folly::IOThreadPoolExecutor> ioThreadPool_;
thrift::ThriftClientManager<raftex::cpp2::RaftexServiceAsyncClient> connManager_;
std::unique_ptr<thrift::ThriftClientManager<raftex::cpp2::RaftexServiceAsyncClient>> connManager_;
};

} // namespace raftex
Expand Down

0 comments on commit b2437e4

Please sign in to comment.