-
Notifications
You must be signed in to change notification settings - Fork 876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(server): support cluster replication #2748
Conversation
@adiholden please rebase |
569190c
to
dccf89c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
src/server/cluster/slot_set.h
Outdated
std::string slots_str; | ||
for (SlotId i = 0; i < kSlotsNumber; ++i) { | ||
if (slots_->test(i)) { | ||
absl::StrAppend(&slots_str, absl::StrCat(i)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need a separator here? A comma or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a space, as you use it to build commands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, I will also need to add a pytest tests to make sure we actually flush the correct slots
src/server/journal/executor.cc
Outdated
void JournalExecutor::FlushSlots(const SlotRange& slot_range) { | ||
SlotRanges slot_ranges = {slot_range}; | ||
SlotSet slot_set(slot_ranges); | ||
auto cmd = BuildFromParts("FLUSHSLOTS", slot_set.ToString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This string is likely to be pretty huge. We could modify FLUSHSLOTS
to accept slot ranges, but perhaps that's over engineering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think sending two numbers instead of up to 16 thousand is over-engineering 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you that we need to move to slot ranges, but this is a big change.. I would like to do it in a different PR as this one is already big enough
src/server/replica.cc
Outdated
@@ -375,13 +376,17 @@ error_code Replica::InitiatePSync() { | |||
io::PrefixSource ps{io_buf.InputBuffer(), Sock()}; | |||
|
|||
// Set LOADING state. | |||
CHECK(service_.SwitchState(GlobalState::ACTIVE, GlobalState::LOADING).first == | |||
GlobalState::LOADING); | |||
CHECK(service_.SwitchState(GlobalState::ACTIVE, GlobalState::LOADING) == GlobalState::LOADING); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CHECK_EQ()
for better logging? 🙏
src/server/replica.cc
Outdated
@@ -466,8 +471,7 @@ error_code Replica::InitiateDflySync() { | |||
RETURN_ON_ERR(cntx_.SwitchErrorHandler(std::move(err_handler))); | |||
|
|||
// Make sure we're in LOADING state. | |||
CHECK(service_.SwitchState(GlobalState::ACTIVE, GlobalState::LOADING).first == | |||
GlobalState::LOADING); | |||
CHECK(service_.SwitchState(GlobalState::ACTIVE, GlobalState::LOADING) == GlobalState::LOADING); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
src/server/server_family.cc
Outdated
@@ -554,6 +550,58 @@ string_view GetRedisMode() { | |||
return ClusterConfig::IsEnabledOrEmulated() ? "cluster"sv : "standalone"sv; | |||
} | |||
|
|||
struct ReplicaOfArgs { | |||
bool no_one = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd make this a method instead of a member. That could remove impossible states.
src/server/server_family.cc
Outdated
bool no_one = false; | ||
string_view host; | ||
string_view port_sv; | ||
uint32_t port; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint16_t
?
src/server/server_family.cc
Outdated
return replicaof_args; | ||
} | ||
|
||
if (!absl::SimpleAtoi(replicaof_args.port_sv, &replicaof_args.port) || replicaof_args.port < 1 || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use a uint16_t
above you could change the range check to simply be replicaof_arg.port == 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont see absl::SimpleAtoi impl with int16_t
do you have any utility function that we can use ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. I don't know why absl made that decision, but yeah, we need to use a temporary and check its upper range it looks like :|
src/server/server_family.cc
Outdated
if (!absl::SimpleAtoi(*slot_end, &slot_id_end)) { | ||
return facade::OpStatus::INVALID_INT; | ||
} | ||
if (slot_id_end > ClusterConfig::kMaxSlotNum) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (slot_id_end > ClusterConfig::kMaxSlotNum) { | |
if ((slot_id_end > ClusterConfig::kMaxSlotNum) || (slot_id_end < slot_id_start)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should really have a utility function for parsing slots or slot pairs in cluster code 😅
src/server/server_family.cc
Outdated
if (replica_) | ||
replica_->Stop(); | ||
// Stop all cluster replication. | ||
for (auto& replica : cluster_replicas_) { | ||
replica->Stop(); | ||
} | ||
cluster_replicas_.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be wrapped in a small utility function
btw don't we need to call replica_.reset()
like above?
src/server/server_family.cc
Outdated
Replica::Info rinfo = replica_->GetInfo(); | ||
rb->StartArray(4); | ||
|
||
size_t additional_replication = cluster_replicas_.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd drop additional_replication
and use the size()
method inline, I don't think it adds clarity
src/server/journal/executor.cc
Outdated
void JournalExecutor::FlushSlots(const SlotRange& slot_range) { | ||
SlotRanges slot_ranges = {slot_range}; | ||
SlotSet slot_set(slot_ranges); | ||
auto cmd = BuildFromParts("FLUSHSLOTS", slot_set.ToString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think sending two numbers instead of up to 16 thousand is over-engineering 😆
src/server/main_service.cc
Outdated
if (global_state_ == to && global_state_ == GlobalState::LOADING) { | ||
++loading_state_counter_; | ||
return global_state_; | ||
} | ||
if (global_state_ == from && global_state_ == GlobalState::LOADING && | ||
loading_state_counter_ > 0) { | ||
--loading_state_counter_; | ||
if (loading_state_counter_ > 0) { | ||
return global_state_; | ||
} | ||
} | ||
|
||
if (global_state_ != from) { | ||
return global_state_; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice trick to make it compatible. It only feels a little bit complicated because we have implicit rules which are stricter than the interface, i.e. for LOADING the from
parameter has no meaning. So maybe it could have been handled by a function like RequestLoadingState() or smth.... Just a nit 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for LOADING the from parameter is used as if we are not already in LOADING state we will change the state to LOADING only if global_state_ == from
so if we are in TAKEOVE/SHUTDOWN we will not change to loading because we ask to move from ACTIVE to LOADING
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After looking more into the code, I think that we dont realy need the from param in the switch state as we will not be able to issue commands if we are not in active mode
I will do the change we RequestLoadingState and will later revisit the SwitchState function in a different PR
src/server/server_family.cc
Outdated
if (!absl::SimpleAtoi(*slot_end, &slot_id_end)) { | ||
return facade::OpStatus::INVALID_INT; | ||
} | ||
if (slot_id_end > ClusterConfig::kMaxSlotNum) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should really have a utility function for parsing slots or slot pairs in cluster code 😅
src/server/server_family.cc
Outdated
for (auto& replica : cluster_replicas_) { | ||
replica->Stop(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this needs not to be embedded into if (replica_)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can move this outside but cluster_replicas_ will be not empty only if replica_ is set
std::shared_ptr<Replica> replica_ ABSL_GUARDED_BY(replicaof_mu_); | ||
std::vector<std::unique_ptr<Replica>> cluster_replicas_ | ||
ABSL_GUARDED_BY(replicaof_mu_); // used to replicating multiple nodes to single dragonfly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like replica_ is the leading node, whereas in reality they're equal. Either way it's not worth generalizing if it's just ad-hoc
Signed-off-by: adi_holden <adi@dragonflydb.io>
Signed-off-by: adi_holden <adi@dragonflydb.io>
Signed-off-by: adi_holden <adi@dragonflydb.io>
Signed-off-by: adi_holden <adi@dragonflydb.io>
Signed-off-by: adi_holden <adi@dragonflydb.io>
2d82f10
to
a017887
Compare
Signed-off-by: adi_holden <adi@dragonflydb.io>
src/server/cluster/slot_set.h
Outdated
std::string slots_str; | ||
for (SlotId i = 0; i < kSlotsNumber; ++i) { | ||
if (slots_->test(i)) { | ||
absl::StrAppend(&slots_str, absl::StrCat(i, " ")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absl::StrAppend(&slots_str, absl::StrCat(i, " ")); | |
absl::StrAppend(&slots_str, i, " "); |
src/server/cluster/slot_set.h
Outdated
if (slots_->test(i)) { | ||
absl::StrAppend(&slots_str, absl::StrCat(i, " ")); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
} | |
if (!slots_str.empty()) { | |
slots_str.pop_back(); | |
} |
src/server/cluster/slot_set.h
Outdated
@@ -93,6 +95,16 @@ class SlotSet { | |||
return res; | |||
} | |||
|
|||
std::string ToString() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you use this? It looks like the new approach doesn't require this, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true will remove
src/server/common.h
Outdated
@@ -160,6 +160,12 @@ enum class GlobalState : uint8_t { | |||
TAKEN_OVER, | |||
}; | |||
|
|||
const char* GlobalStateName(GlobalState gs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're modifying this, consider returning string_view
src/server/debugcmd.cc
Outdated
LOG(WARNING) << GlobalStateName(new_state.first) << " in progress, ignored"; | ||
|
||
if (new_state != GlobalState::LOADING) { | ||
LOG(WARNING) << GlobalStateName(new_state) << " in progress, ignored"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOG(WARNING) << GlobalStateName(new_state) << " in progress, ignored"; | |
LOG(WARNING) << new_state << " in progress, ignored"; |
Isn't this why you added the above operator<<
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the operator because CHECK_EQ of 2 states did not work as it requires operator<<
src/server/main_service.h
Outdated
GlobalState global_state_ = GlobalState::ACTIVE; // protected by mu_; | ||
uint32_t loading_state_counter_ = 0; // protected by mu_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GlobalState global_state_ = GlobalState::ACTIVE; // protected by mu_; | |
uint32_t loading_state_counter_ = 0; // protected by mu_; | |
GlobalState global_state_ ABSL_GUARDED_BY(my_) = GlobalState::ACTIVE;; | |
uint32_t loading_state_counter_ ABSL_GUARDED_BY(my_) = 0; |
src/server/server_family.cc
Outdated
struct ReplicaOfArgs { | ||
bool no_one = false; | ||
string_view host; | ||
string_view port_sv; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow, sorry.
Why not have uint16_t
and have it be 0
in case is it replica of no-one?
Then instead of port_sv
member you could have a std::string GetPortString()
, which will not allocate memory because of small string optimization (but in any case it's not important in this flow)
src/server/server_family.cc
Outdated
struct ReplicaOfArgs { | ||
bool no_one = false; | ||
string_view host; | ||
string_view port_sv; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that this is critical :) It's a nit.
src/server/server_family.cc
Outdated
if (new_state.first != GlobalState::LOADING) { | ||
LOG(WARNING) << GlobalStateName(new_state.first) << " in progress, ignored"; | ||
if (new_state != GlobalState::LOADING) { | ||
LOG(WARNING) << GlobalStateName(new_state) << " in progress, ignored"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOG(WARNING) << GlobalStateName(new_state) << " in progress, ignored"; | |
LOG(WARNING) << new_state << " in progress, ignored"; |
src/server/server_family.cc
Outdated
return cntx->SendError(replicaof_args.status()); | ||
} | ||
if (replicaof_args->IsReplicaOfNoOne()) { | ||
return cntx->SendError("ADDREPLICAOF does not supprot no one"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return cntx->SendError("ADDREPLICAOF does not supprot no one"); | |
return cntx->SendError("ADDREPLICAOF does not support no one"); |
Signed-off-by: adi_holden <adi@dragonflydb.io>
Signed-off-by: adi_holden <adi@dragonflydb.io>
Signed-off-by: adi_holden <adi@dragonflydb.io>
return nullopt; | ||
} | ||
if (parser.HasNext()) { | ||
auto [slot_start, slot_end] = parser.Next<SlotId, SlotId>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to check if parser has an error here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will return 0 for invalid integers, so we can have a spurious "invalid slot range" which is not a problem I guess 🤷🏻♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is [0, 0]
an invalid range? We should be able to move the single slot 0
.. and ranges are inclusive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not, but it also can be [x 0]
🙂
Signed-off-by: adi_holden <adi@dragonflydb.io>
…nfly ( v1.15.1 → v1.16.0 ) (#3354) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [docker.dragonflydb.io/dragonflydb/dragonfly](https://togithub.com/dragonflydb/dragonfly) | minor | `v1.15.1` -> `v1.16.0` | --- ### Release Notes <details> <summary>dragonflydb/dragonfly (docker.dragonflydb.io/dragonflydb/dragonfly)</summary> ### [`v1.16.0`](https://togithub.com/dragonflydb/dragonfly/releases/tag/v1.16.0) [Compare Source](https://togithub.com/dragonflydb/dragonfly/compare/v1.15.1...v1.16.0) ##### Dragonfly v1.16.0 Our spring release. We are getting closer to 2.0 with some very exciting features ahead. Stay tuned! Some prominent changes include: - Improved memory accounting of client connections ([#​2710](https://togithub.com/dragonflydb/dragonfly/issues/2710) [#​2755](https://togithub.com/dragonflydb/dragonfly/issues/2755) and [#​2692](https://togithub.com/dragonflydb/dragonfly/issues/2692) ) - FT.AGGREGATE call ([#​2413](https://togithub.com/dragonflydb/dragonfly/issues/2413)) - Properly handle and replicate Memcache flags ([#​2787](https://togithub.com/dragonflydb/dragonfly/issues/2787) [#​2807](https://togithub.com/dragonflydb/dragonfly/issues/2807)) - Intoduce BF.AGGREGATE BD.(M)ADD and BF.(M)EXISTS methods ([#​2801](https://togithub.com/dragonflydb/dragonfly/issues/2801)). Note, that it does not work with snapshots and replication yet. - Dragonfly builds natively on MacOS. We would love some help with extending the release pipeline to create a proper macos binary. - Following the requests from the Edge developers community, we added a basic HTTP API support! Try running Dragonfly with: `--expose_http_api` flag and then call `curl -X POST -d '["ping"]' localhost:6379/api`. We will follow up with more extensive docs later this month. - Lots of stability fixes, especially around Sidekiq and BullMQ workloads. ##### What's Changed - chore: make usan asan optional and enable them on CI by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2631 - fix: missing manual trigger for daily sanitizers by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2682 - bug(tiering): fix overflow in page offset calculation and wrong hash offset calculation by [@​theyueli](https://togithub.com/theyueli) in [dragonflydb/dragonfly#2683 - Chore: Fixed Docker Health Check by [@​manojks1999](https://togithub.com/manojks1999) in [dragonflydb/dragonfly#2659 - chore: Increase disk space in the coverage runs by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2684 - fix(flushall): Decommit memory after releasing tables. by [@​chakaz](https://togithub.com/chakaz) in [dragonflydb/dragonfly#2691 - feat(server): Account for serializer's temporary buffer size by [@​chakaz](https://togithub.com/chakaz) in [dragonflydb/dragonfly#2689 - refactor: remove FULL-SYNC-CUT cmd [#​2687](https://togithub.com/dragonflydb/dragonfly/issues/2687) by [@​BorysTheDev](https://togithub.com/BorysTheDev) in [dragonflydb/dragonfly#2688 - chore: add malloc-based stats and decommit by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2692 - feat(cluster): automatic slot migration finalization [#​2697](https://togithub.com/dragonflydb/dragonfly/issues/2697) by [@​BorysTheDev](https://togithub.com/BorysTheDev) in [dragonflydb/dragonfly#2698 - Basic FT.AGGREGATE by [@​dranikpg](https://togithub.com/dranikpg) in [dragonflydb/dragonfly#2413 - chore: little transaction cleanup by [@​dranikpg](https://togithub.com/dranikpg) in [dragonflydb/dragonfly#2608 - fix(channel store): add acquire/release pair in fast update path by [@​dranikpg](https://togithub.com/dranikpg) in [dragonflydb/dragonfly#2704 - chore: add ubuntu22 devcontainer by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2700 - feat(cluster): Add `--cluster_id` flag by [@​chakaz](https://togithub.com/chakaz) in [dragonflydb/dragonfly#2695 - feat(server): Use mimalloc in SSL calls by [@​chakaz](https://togithub.com/chakaz) in [dragonflydb/dragonfly#2710 - chore: Pull helio with new BlockingCounter by [@​dranikpg](https://togithub.com/dranikpg) in [dragonflydb/dragonfly#2711 - chore(transaction): Simplify PollExecution by [@​dranikpg](https://togithub.com/dranikpg) in [dragonflydb/dragonfly#2712 - chore(transaction): Don't call GetLocalMask from blocking controller by [@​dranikpg](https://togithub.com/dranikpg) in [dragonflydb/dragonfly#2715 - chore: improve compatibility of EXPIRE functions with Redis by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2696 - chore: disable flaky fuzzy migration test by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2716 - chore: update sanitizers workflow by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2686 - chore: Use c-ares for resolving hosts in `ProtocolClient` by [@​chakaz](https://togithub.com/chakaz) in [dragonflydb/dragonfly#2719 - Remove check-fail in ExpireIfNeeded and introduce DFLY LOAD by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2699 - chore: Record cmd stat from invoke by [@​dranikpg](https://togithub.com/dranikpg) in [dragonflydb/dragonfly#2720 - fix(transaction): nullptr access on non transactional commands by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2724 - fix(BgSave): async from sync by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2702 - chore: remove core/fibers by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2723 - fix(transaction): Replace with armed sync point by [@​dranikpg](https://togithub.com/dranikpg) in [dragonflydb/dragonfly#2708 - feat(json): Deserialize ReJSON format by [@​chakaz](https://togithub.com/chakaz) in [dragonflydb/dragonfly#2725 - feat: add flag masteruser by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2693 - refactor: block list refactoring [#​2580](https://togithub.com/dragonflydb/dragonfly/issues/2580) by [@​BorysTheDev](https://togithub.com/BorysTheDev) in [dragonflydb/dragonfly#2732 - chore: fix DeduceExecMode by [@​dranikpg](https://togithub.com/dranikpg) in [dragonflydb/dragonfly#2733 - fix(cluster): Reply with correct `\n` / `\r\n` from `CLUSTER` sub cmd by [@​chakaz](https://togithub.com/chakaz) in [dragonflydb/dragonfly#2731 - chore: Introduce fiber stack allocator by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2730 - fix(cluster): Save replica ID per replica by [@​chakaz](https://togithub.com/chakaz) in [dragonflydb/dragonfly#2735 - fix(ssl): Proper cleanup by [@​chakaz](https://togithub.com/chakaz) in [dragonflydb/dragonfly#2742 - chore: add skeleton files for flat_dfs code by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2738 - chore: better error reporting when connecting to tls with plain socket by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2740 - chore: Support json paths without root selector by [@​dranikpg](https://togithub.com/dranikpg) in [dragonflydb/dragonfly#2747 - chore: journal cleanup by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2749 - refactor: remove start-slot-migration cmd [#​2727](https://togithub.com/dragonflydb/dragonfly/issues/2727) by [@​BorysTheDev](https://togithub.com/BorysTheDev) in [dragonflydb/dragonfly#2728 - feat(server): Add TLS usage to /metrics and `INFO MEMORY` by [@​chakaz](https://togithub.com/chakaz) in [dragonflydb/dragonfly#2755 - chore: preparations for adding flat json support by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2752 - chore(transaction): Introduce RunCallback by [@​dranikpg](https://togithub.com/dranikpg) in [dragonflydb/dragonfly#2760 - feat(replication): Do not auto replicate different master by [@​chakaz](https://togithub.com/chakaz) in [dragonflydb/dragonfly#2753 - Improve Helm chart to be rendered locally and on machines where is not the application target by [@​fafg](https://togithub.com/fafg) in [dragonflydb/dragonfly#2706 - chore: preparation for basic http api by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2764 - feat(server): Add metric for RDB save duration. by [@​chakaz](https://togithub.com/chakaz) in [dragonflydb/dragonfly#2768 - chore: fix flat_dfs read tests. by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2772 - fix(ci): do not overwrite last_log_file among tests by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2759 - feat(server): support cluster replication by [@​adiholden](https://togithub.com/adiholden) in [dragonflydb/dragonfly#2748 - fix: fiber preempts on read path and OnCbFinish() clears fetched_items\_ by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2763 - chore(ci): open last_log_file in append mode by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2776 - doc(README): fix outdated expiry ranges description by [@​enjoy-binbin](https://togithub.com/enjoy-binbin) in [dragonflydb/dragonfly#2779 - Benchmark runner by [@​adiholden](https://togithub.com/adiholden) in [dragonflydb/dragonfly#2780 - chore(replication-tests): add cache_mode on test replication all by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2685 - feat(tiering): DiskStorage by [@​dranikpg](https://togithub.com/dranikpg) in [dragonflydb/dragonfly#2770 - chore: add a boilerplate for bloom filter family by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2782 - chore: introduce conversion routines between JsonType and FlatJson by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2785 - chore: Fix memcached flags not updated by [@​dranikpg](https://togithub.com/dranikpg) in [dragonflydb/dragonfly#2787 - chore: remove duplicate code from dash and simplify by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2765 - chore: disable test_cluster_slot_migration by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2788 - fix: new\[] delete\[] missmatch in disk_storage by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2792 - fix: sanitizers clang build and clean up some warnings by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2793 - chore: add bloom filter class by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2791 - chore: add SBF data structure by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2795 - chore(tiering): Disable compilation for MacOs by [@​dranikpg](https://togithub.com/dranikpg) in [dragonflydb/dragonfly#2799 - chore: fix daily build by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2798 - chore: expose SBF via compact_object by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2797 - fix(ci): malloc trim on sanitizers workflow by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2794 - fix(cluster): Don't miss updates in FLUSHSLOTS by [@​chakaz](https://togithub.com/chakaz) in [dragonflydb/dragonfly#2783 - feat: add bf.(m)add and bf.(m)exists commands by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2801 - fix: SBF memory leaks by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2803 - chore: refactor StringFamily::Set to use CmdArgParser by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2800 - fix: propagate memcached flags to replica by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2807 - DFLYMIGRATE ACK refactoring by [@​BorysTheDev](https://togithub.com/BorysTheDev) in [dragonflydb/dragonfly#2790 - feat: add master lsn and journal_executed dcheck in replica via ping by [@​kostasrim](https://togithub.com/kostasrim) in [dragonflydb/dragonfly#2778 - fix: correct json response for errors by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2813 - chore: bloom test - cover corner cases by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2806 - bug(server): do not write lsn opcode to journal by [@​adiholden](https://togithub.com/adiholden) in [dragonflydb/dragonfly#2814 - chore: Fix build by disabling the tests. by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2821 - fix(replication): replication with multi shard sync enabled lagging by [@​adiholden](https://togithub.com/adiholden) in [dragonflydb/dragonfly#2823 - fix: io_uring/fibers bug in DnsResolve by [@​romange](https://togithub.com/romange) in [dragonflydb/dragonfly#2825 ##### New Contributors - [@​manojks1999](https://togithub.com/manojks1999) made their first contribution in [dragonflydb/dragonfly#2659 - [@​fafg](https://togithub.com/fafg) made their first contribution in [dragonflydb/dragonfly#2706 - [@​enjoy-binbin](https://togithub.com/enjoy-binbin) made their first contribution in [dragonflydb/dragonfly#2779 ##### Huge thanks to all the contributors! ❤️ 🇮🇱 🇺🇦 **Full Changelog**: dragonflydb/dragonfly@v1.15.0...v1.16.0 </details> <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNzkuMCIsInVwZGF0ZWRJblZlciI6IjM3LjI3OS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL21pbm9yIl19--> Co-authored-by: repo-jeeves[bot] <106431701+repo-jeeves[bot]@users.noreply.github.com>
In this PR we introduce new command
ADDREPLICAOF
and extend REPLICAOF command with optional params
The slot range data is used only to flush the relevant data if the replication to a node disconnected
To replicate a cluster we first issue command
REPLICAOF
with data for a single node from the cluster
than for each additinal cluster master node we run
ADDREPLICAOF
To promote the replica to master we will run
REPLICAOF NO ONE
If we run REPLICAOF this will start replication from scratch removing all added replicas