-
Notifications
You must be signed in to change notification settings - Fork 702
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
[WIP] Skip the checksum for diskless replication #1181
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1272,6 +1272,9 @@ void syncCommand(client *c) { | |
* - rdb-channel <1|0> | ||
* Used to identify the client as a replica's rdb connection in an dual channel | ||
* sync session. | ||
* | ||
* - repl-diskless-load <1|0> | ||
* Replica is capable of load data from replication stream, request to skip checksum. | ||
* */ | ||
void replconfCommand(client *c) { | ||
int j; | ||
|
@@ -1302,6 +1305,13 @@ void replconfCommand(client *c) { | |
sdslen(addr)); | ||
return; | ||
} | ||
} else if (!strcasecmp(c->argv[j]->ptr, "repl-diskless-load")) { | ||
/* REPLCONF repl-diskless-load is used to identify the client is capable of | ||
* load directly without creating rdb file */ | ||
long rdb_diskless_load = 0; | ||
if (getRangeLongFromObjectOrReply(c, c->argv[j + 1], 0, 1, &rdb_diskless_load, NULL) != C_OK) return; | ||
if (rdb_diskless_load == 1) | ||
c->replica_req |= REPLICA_REQ_CHKSUM_SKIP; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think at this point the skip CRC is more "capability" than "requirement" on the replica side. So I would suggest adding a replconf capa indication instead. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Initially my plan also was to add in capabilities, However the capabilies were not passed many function as requirements being passed. Since requirements are so flexible in the available functions I added in the requirements. But I agree with you this should be part of the capa. PR is still in-progress I will try to make this in Capabilities instead of requirements. Thank you! |
||
} else if (!strcasecmp(c->argv[j]->ptr, "capa")) { | ||
/* Ignore capabilities not understood by this primary. */ | ||
if (!strcasecmp(c->argv[j + 1]->ptr, "eof")) | ||
|
@@ -2613,7 +2623,7 @@ static int dualChannelReplHandleHandshake(connection *conn, sds *err) { | |
/* Send replica listening port to primary for clarification */ | ||
sds portstr = getReplicaPortString(); | ||
*err = sendCommand(conn, "REPLCONF", "capa", "eof", "rdb-only", "1", "rdb-channel", "1", "listening-port", portstr, | ||
NULL); | ||
"repl-diskless-load", useDisklessLoad() ? "1" : "0", NULL); | ||
sdsfree(portstr); | ||
if (*err) { | ||
serverLog(LL_WARNING, "Sending command to primary in dual channel replication handshake: %s", *err); | ||
|
@@ -3506,6 +3516,12 @@ void syncWithPrimary(connection *conn) { | |
server.dual_channel_replication ? "dual-channel" : NULL, NULL); | ||
if (err) goto write_error; | ||
|
||
/* Inform the primary of replicas repl-diskless-load config. */ | ||
if (useDisklessLoad()) { | ||
err = sendCommand(conn, "REPLCONF", "repl-diskless-load", "1", NULL); | ||
if (err) goto write_error; | ||
} | ||
|
||
/* Inform the primary of our (replica) version. */ | ||
err = sendCommand(conn, "REPLCONF", "version", VALKEY_VERSION, NULL); | ||
if (err) goto write_error; | ||
|
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 probably keep only one rdbSaveRio :)
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.
Thank you for noticing this. I am aware of this and removed in my local branch, this has had happened because I had merge conflict in the branch so created this by copying the code from original branch. it was missed during the copy paste