Skip to content

Conversation

@YaacovHazan
Copy link
Collaborator

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.

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.
@oranagra oranagra added the release-notes indication that this issue needs to be mentioned in the release notes label 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
yossigo previously approved these changes Feb 24, 2021
Copy link
Collaborator

@yossigo yossigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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. */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YaacovHazan Consider moving this comment up to document the function and indicate that it works atomically for all socket fds.

@yossigo yossigo added the state:major-decision Requires core team consensus label Feb 24, 2021
@yossigo
Copy link
Collaborator

yossigo commented Feb 24, 2021

@redis/core-team please review.

@yossigo yossigo requested a review from a team February 24, 2021 08:17
@yossigo yossigo added the approval-needed Waiting for core team approval to be merged label Feb 24, 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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too much indentation.

/* 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. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remember to remove these from the non-mutable config list in tests/unit/introspection.tcl

YaacovHazan added 2 commits February 28, 2021 20:57
code review:
- fix indentation
- remove these configurations from skip_configs in introspection.tcl
}

if (changeListenPort(val, &server.ipfd, acceptTcpHandler) == C_ERR) {
*err = "Unable to listen on this port. Check server logs.";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i suppose it refers to the log print in listenToPort

@oranagra oranagra merged commit a031d26 into redis:unstable Mar 1, 2021
@oranagra oranagra mentioned this pull request Mar 1, 2021
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval-needed Waiting for core team approval to be merged release-notes indication that this issue needs to be mentioned in the release notes state:major-decision Requires core team consensus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants