-
Notifications
You must be signed in to change notification settings - Fork 940
Roll backward downgrade compatibility from Redis 7.0/7.2 and Valkey 7.2/8.0 to Redis 6.0 #2549
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
Open
satheeshaGowda
wants to merge
1
commit into
valkey-io:6.0
Choose a base branch
from
satheeshaGowda:6.0
base: 6.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -171,13 +171,30 @@ int clusterLoadConfig(char *filename) { | |
| n = createClusterNode(argv[0],0); | ||
| clusterAddNode(n); | ||
| } | ||
| /* Address and port */ | ||
| if ((p = strrchr(argv[1],':')) == NULL) { | ||
| /* Address and port. The format is ip:port[,hostname] */ | ||
| int aux_argc; | ||
| sds *aux_argv = sdssplitlen(argv[1],sdslen(argv[1]),",",1,&aux_argc); | ||
| if (aux_argv == NULL) { | ||
| sdsfreesplitres(argv,argc); | ||
| goto fmterr; | ||
| } | ||
|
|
||
| if (aux_argc > 1) { | ||
| if (sdslen(aux_argv[1]) > 0) { | ||
| sdsfree(n->hostname); | ||
| n->hostname = sdsnew(aux_argv[1]); | ||
| } else { | ||
| if (n->hostname) sdsclear(n->hostname); | ||
| } | ||
| } | ||
|
|
||
| if ((p = strrchr(aux_argv[0],':')) == NULL) { | ||
| sdsfreesplitres(aux_argv,aux_argc); | ||
| sdsfreesplitres(argv,argc); | ||
| goto fmterr; | ||
| } | ||
| *p = '\0'; | ||
| memcpy(n->ip,argv[1],strlen(argv[1])+1); | ||
| memcpy(n->ip,aux_argv[0],strlen(aux_argv[0])+1); | ||
| char *port = p+1; | ||
| char *busp = strchr(port,'@'); | ||
| if (busp) { | ||
|
|
@@ -189,6 +206,10 @@ int clusterLoadConfig(char *filename) { | |
| * In this case we set it to the default offset of 10000 from the | ||
| * base port. */ | ||
| n->cport = busp ? atoi(busp) : n->port + CLUSTER_PORT_INCR; | ||
| sdsfreesplitres(aux_argv,aux_argc); | ||
|
|
||
| /* The plaintext port for client in a TLS cluster (n->pport) is not | ||
| * stored in nodes.conf. It is received later over the bus protocol. */ | ||
|
|
||
| /* Parse flags */ | ||
| p = s = argv[2]; | ||
|
|
@@ -786,6 +807,7 @@ clusterNode *createClusterNode(char *nodename, int flags) { | |
| node->data_received = 0; | ||
| node->fail_time = 0; | ||
| node->link = NULL; | ||
| node->hostname = NULL; | ||
| memset(node->ip,0,sizeof(node->ip)); | ||
| node->port = 0; | ||
| node->cport = 0; | ||
|
|
@@ -956,6 +978,7 @@ void freeClusterNode(clusterNode *n) { | |
| if (n->link) freeClusterLink(n->link); | ||
| listRelease(n->fail_reports); | ||
| zfree(n->slaves); | ||
| if (n->hostname) sdsfree(n->hostname); | ||
| zfree(n); | ||
| } | ||
|
|
||
|
|
@@ -1752,12 +1775,12 @@ int clusterProcessPacket(clusterLink *link) { | |
|
|
||
| explen = sizeof(clusterMsg)-sizeof(union clusterMsgData); | ||
| explen += (sizeof(clusterMsgDataGossip)*count); | ||
| if (totlen != explen) return 1; | ||
| if (totlen < explen) return 1; | ||
| } else if (type == CLUSTERMSG_TYPE_FAIL) { | ||
| uint32_t explen = sizeof(clusterMsg)-sizeof(union clusterMsgData); | ||
|
|
||
| explen += sizeof(clusterMsgDataFail); | ||
| if (totlen != explen) return 1; | ||
| if (totlen < explen) return 1; | ||
| } else if (type == CLUSTERMSG_TYPE_PUBLISH) { | ||
| uint32_t explen = sizeof(clusterMsg)-sizeof(union clusterMsgData); | ||
|
|
||
|
|
@@ -1777,7 +1800,7 @@ int clusterProcessPacket(clusterLink *link) { | |
| uint32_t explen = sizeof(clusterMsg)-sizeof(union clusterMsgData); | ||
|
|
||
| explen += sizeof(clusterMsgDataUpdate); | ||
| if (totlen != explen) return 1; | ||
| if (totlen < explen) return 1; | ||
| } else if (type == CLUSTERMSG_TYPE_MODULE) { | ||
| uint32_t explen = sizeof(clusterMsg)-sizeof(union clusterMsgData); | ||
|
|
||
|
|
@@ -4123,11 +4146,15 @@ sds clusterGenNodeDescription(clusterNode *node) { | |
| sds ci; | ||
|
|
||
| /* Node coordinates */ | ||
| ci = sdscatprintf(sdsempty(),"%.40s %s:%d@%d ", | ||
| ci = sdscatprintf(sdsempty(),"%.40s %s:%d@%d", | ||
| node->name, | ||
| node->ip, | ||
| node->port, | ||
| node->cport); | ||
| if (node->hostname && sdslen(node->hostname) > 0) { | ||
|
Collaborator
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. Would be good to add a nodes.conf file with hostname in it and verify it gets loaded fine. |
||
| ci = sdscatfmt(ci,",%s",node->hostname); | ||
| } | ||
| ci = sdscat(ci," "); | ||
|
|
||
| /* Flags */ | ||
| ci = representClusterNodeFlags(ci, node->flags); | ||
|
|
@@ -4955,7 +4982,10 @@ int verifyDumpPayload(unsigned char *p, size_t len) { | |
|
|
||
| /* Verify RDB version */ | ||
| rdbver = (footer[1] << 8) | footer[0]; | ||
| if (rdbver > RDB_VERSION) return C_ERR; | ||
| if ((rdbver >= RDB_FOREIGN_VERSION_MIN && rdbver <= RDB_FOREIGN_VERSION_MAX) || | ||
| (rdbver > RDB_VERSION && server.rdb_version_check == RDB_VERSION_CHECK_STRICT)) { | ||
| return C_ERR; | ||
| } | ||
|
|
||
| /* Verify CRC64 */ | ||
| crc = crc64(0,p,len-8); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 we need to add hostname support, we would need to bring in extensions mechanism to older version as well.