-
Notifications
You must be signed in to change notification settings - Fork 880
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
introduce --replicaof
flag
#1583
Conversation
Signed-off-by: talbii <ido@dragonflydb.io>
Signed-off-by: talbii <41526934+talbii@users.noreply.github.com>
Signed-off-by: talbii <ido@dragonflydb.io>
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.
Hey @talbii, see some comments but please feel free to reach out if I missed something or if anything's unclear
Signed-off-by: talbii <ido@dragonflydb.io>
Signed-off-by: talbii <ido@dragonflydb.io>
…roduce `ReplicaOfFlag` Signed-off-by: talbii <ido@dragonflydb.io>
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.
Good work, some minor comments.
Moreover, add a test with the new flag on replication_test.py
.
If you have any questions or if anything I commented is unclear, plz reach me out internally and we can jump on a call. I am here if you need me anything :)
Signed-off-by: talbii <ido@dragonflydb.io>
…until `REPLICAOF NO ONE` is recieved Signed-off-by: talbii <ido@dragonflydb.io>
Signed-off-by: talbii <ido@dragonflydb.io>
Signed-off-by: talbii <ido@dragonflydb.io>
Signed-off-by: talbii <ido@dragonflydb.io>
Signed-off-by: talbii <ido@dragonflydb.io>
Signed-off-by: talbii <ido@dragonflydb.io>
Signed-off-by: talbii <ido@dragonflydb.io>
Signed-off-by: talbii <ido@dragonflydb.io>
Signed-off-by: talbii <41526934+talbii@users.noreply.github.com>
src/server/server_family.cc
Outdated
}; | ||
transaction->Execute(std::move(cb), true); | ||
if (should_flush_db == ShouldFlushDb::kFlush) | ||
FlushEntireDb(cntx->transaction); |
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.
Wouldn't this be a problem, in that after this function finishes the transaction will be concluded afterwards? Or is it ok to Schedule()
an already concluded transaction?
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.
that I am not too sure about, but I'm not sure I understand your concern? The logic of FlushEntireDb
(or FLUSHDB
or Drakarys
..) schedules the transaction first and then executes it, which is fine.
Are you worried that replication continues past the already-executed transaction?
Maybe @romange could chime in, I saw that he originally wrote this code 🙂
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'm worried that transactions can't be used more than once, in which case maybe something unintended can happen after we flush the DB, when we try to use the tx again
Signed-off-by: talbii <ido@dragonflydb.io>
Signed-off-by: talbii <ido@dragonflydb.io>
Signed-off-by: talbii <ido@dragonflydb.io>
Signed-off-by: talbii <ido@dragonflydb.io>
src/server/replica.cc
Outdated
* an instance with '--replicaof' and then \b immediately | ||
* sending a command. | ||
* | ||
* In that instance, we have to run f() on the current fiber. |
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.
But what's the downside of running in current fiber? Why not always do it as such? And why not run it just via f()
instead of awaiting for our own thread?
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.
that I am not entirely sure about. Presumably this was done in order to not block the current fiber, the same fiber that runs MainReplicationFb
.
About why I run f()
using AwaitBrief
, I was not sure that was the same outcome. I'll change it, thanks!
Signed-off-by: talbii <ido@dragonflydb.io>
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.
🥳
Please run the tests multiple times before merging this in, to make sure they are robust
Closes #1381.