Make port, tls-port and bind configurations modifiable#8510
Merged
oranagra merged 4 commits intoredis:unstablefrom Mar 1, 2021
Merged
Make port, tls-port and bind configurations modifiable#8510oranagra merged 4 commits intoredis:unstablefrom
oranagra merged 4 commits intoredis:unstablefrom
Conversation
4fda8d1 to
33078f5
Compare
Add ability to modify port, tls-port and bind configurations by CONFIG SET command. To simplify the code and make it cleaner, a new structure added, socketFds, which contains the file descriptors array and its counter, and used for TCP, TLS and Cluster sockets file descriptors.
33078f5 to
94efa49
Compare
yossigo
reviewed
Feb 21, 2021
code review: - fix failure handling in listenToPort by rollback successful listens - add return value to createSocketAcceptHandler instead of panic - increasing tests coverage
yossigo
previously approved these changes
Feb 24, 2021
Collaborator
yossigo
left a comment
There was a problem hiding this comment.
@YaacovHazan just a small comment nitpick.
src/server.c
Outdated
Comment on lines
3008
to
3009
| /* Create an event handler for accepting new connections in TCP and TLS | ||
| * domain sockets. */ |
Collaborator
There was a problem hiding this comment.
@YaacovHazan Consider moving this comment up to document the function and indicate that it works atomically for all socket fds.
Collaborator
|
@redis/core-team please review. |
oranagra
reviewed
Feb 28, 2021
src/config.c
Outdated
Comment on lines
771
to
785
| int vlen; | ||
| sds *v = sdssplitlen(o->ptr,sdslen(o->ptr)," ",1,&vlen); | ||
|
|
||
| if (vlen < 1 || vlen > CONFIG_BINDADDR_MAX) { | ||
| addReplyError(c, "Too many bind addresses specified."); | ||
| sdsfreesplitres(v, vlen); | ||
| return; | ||
| } | ||
|
|
||
| if (changeBindAddr(v, vlen) == C_ERR) { | ||
| addReplyError(c, "Failed to bind to specified addresses."); | ||
| sdsfreesplitres(v, vlen); | ||
| return; | ||
| } | ||
| sdsfreesplitres(v, vlen); |
| /* Integer configs */ | ||
| createIntConfig("databases", NULL, IMMUTABLE_CONFIG, 1, INT_MAX, server.dbnum, 16, INTEGER_CONFIG, NULL, NULL), | ||
| createIntConfig("port", NULL, IMMUTABLE_CONFIG, 0, 65535, server.port, 6379, INTEGER_CONFIG, NULL, NULL), /* TCP port. */ | ||
| createIntConfig("port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.port, 6379, INTEGER_CONFIG, NULL, updatePort), /* TCP port. */ |
Member
There was a problem hiding this comment.
remember to remove these from the non-mutable config list in tests/unit/introspection.tcl
added 2 commits
February 28, 2021 20:57
code review: - fix indentation - remove these configurations from skip_configs in introspection.tcl
oranagra
approved these changes
Mar 1, 2021
itamarhaber
reviewed
Mar 1, 2021
| } | ||
|
|
||
| if (changeListenPort(val, &server.ipfd, acceptTcpHandler) == C_ERR) { | ||
| *err = "Unable to listen on this port. Check server logs."; |
Member
There was a problem hiding this comment.
I don't see new information added to the logs in changeListenPort, so perhaps change the message to something like:
"Unable to bind to port %d."
Member
There was a problem hiding this comment.
i suppose it refers to the log print in listenToPort
itamarhaber
approved these changes
Mar 1, 2021
yossigo
approved these changes
Mar 1, 2021
Merged
JackieXie168
pushed a commit
to JackieXie168/redis
that referenced
this pull request
Mar 2, 2021
Add ability to modify port, tls-port and bind configurations by CONFIG SET command. To simplify the code and make it cleaner, a new structure added, socketFds, which contains the file descriptors array and its counter, and used for TCP, TLS and Cluster sockets file descriptors.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add ability to modify port, tls-port and bind configurations by CONFIG SET command.
To simplify the code and make it cleaner, a new structure
added, socketFds, which contains the file descriptors array and its counter,
and used for TCP, TLS and Cluster sockets file descriptors.