Skip to content

Conversation

@StavRLevi
Copy link
Collaborator

@StavRLevi StavRLevi commented Apr 9, 2025

Close #13892
config set port cmd updates server.port. cluster slot retrieves information about cluster slots and their associated nodes. the fix updates this info when config set port cmd is done, so cluster slots cmd returns the right value.

… information about cluster slots and their associated nodes. the fix update this info when set cmd is done.
@CLAassistant
Copy link

CLAassistant commented Apr 9, 2025

CLA assistant check
All committers have signed the CLA.

@sundb
Copy link
Collaborator

sundb commented Apr 9, 2025

please add a test to cover this bug.

@sundb sundb added the release-notes indication that this issue needs to be mentioned in the release notes label Apr 9, 2025
@StavRLevi StavRLevi changed the title RED-13892: update the cluster info in config set cmd update the cluster info in config set cmd Apr 9, 2025
@StavRLevi StavRLevi changed the title update the cluster info in config set cmd https://github.com/redis/redis/issues/13892 update the cluster info in config set cmd Apr 9, 2025
@sundb sundb changed the title https://github.com/redis/redis/issues/13892 update the cluster info in config set cmd Update the cluster info in config set cmd Apr 9, 2025
@sundb sundb changed the title Update the cluster info in config set cmd Fix missing cluster info update in CONFIG SET command Apr 9, 2025
# Get the original port and change to new_port
set orig_port [lindex [R 0 config get port] 1]
assert {$orig_port != ""}
set new_port [expr {$orig_port + 100}]
Copy link
Collaborator

Choose a reason for hiding this comment

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

use find_available_port?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For my understanding, we use find_available_port when we need to dynamically allocate unused ports for new Redis instances.
But in this case — the test uses an already running Redis instance (R 0) and calls CONFIG SET port on it. So i think that lindex [R 0 config get port] 1 is valid here (In fact, using the live port is essential to reproduce the bug being tested) — we're not launching a new instance, just modifying the config of an existing one.
The point of this test is to verify that the updated port is properly reflected in CLUSTER SLOTS. So using the original running port ([config get port]) ensures we're updating the correct live node.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But $orig_port + 100 might not work, right? However, this is unlikely, because there are not many instances of the cluster, unless all 100 ports in the middle are used.
we can leave it as it is.

Copy link
Member

Choose a reason for hiding this comment

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

i think find_available_port is better, when we run ./runtest, we may create many instances, this test is not run by ./runtest-cluster, see also tests in #8510.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok, got it. will fix.

@sundb sundb requested a review from ShooterIT April 14, 2025 09:56
@ShooterIT
Copy link
Member

BTW, this title is too broad, let's be precise, how about

Fix port update not reflected in CLUSTER SLOTS

@StavRLevi StavRLevi changed the title Fix missing cluster info update in CONFIG SET command Fix port update not reflected in CLUSTER SLOTS Apr 16, 2025
assert_match "*@$base_bus_port *" [R 0 CLUSTER NODES]
}

test "CONFIG SET port updates cluster-announced port" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
test "CONFIG SET port updates cluster-announced port" {
test "CONFIG SET port updates cluster-announced port" {

@sundb sundb merged commit a257b6b into redis:unstable Apr 21, 2025
17 of 18 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Redis 8.2 Apr 21, 2025
@YaacovHazan YaacovHazan moved this from Todo to pending in Redis 7.2 Backport Apr 22, 2025
@YaacovHazan YaacovHazan moved this from Todo to Pending in Redis 7.4 Backport Apr 22, 2025
sundb pushed a commit that referenced this pull request Apr 24, 2025
### Problem 

A previous PR (#13932) fixed the TCP
port issue in CLUSTER SLOTS, but it seems the handling of the TLS port
was overlooked.

There is this comment in the `addNodeToNodeReply` function in the
`cluster.c` file:
```c
    /* Report TLS ports to TLS client, and report non-TLS port to non-TLS client. */
    addReplyLongLong(c, clusterNodeClientPort(node, shouldReturnTlsInfo()));
    addReplyBulkCBuffer(c, clusterNodeGetName(node), CLUSTER_NAMELEN);
```

### Fixed 

This PR fixes the TLS port issue and adds relevant tests.
@YaacovHazan YaacovHazan moved this from Pending to Todo in Redis 7.4 Backport May 25, 2025
@YaacovHazan YaacovHazan moved this from pending to Todo in Redis 7.2 Backport May 25, 2025
@YaacovHazan YaacovHazan moved this from To Do to In progress in Redis 6.2 Backport May 26, 2025
@YaacovHazan YaacovHazan moved this from In progress to To Do in Redis 6.2 Backport May 26, 2025
@YaacovHazan YaacovHazan moved this from To Do to Pending in Redis 6.2 Backport May 26, 2025
YaacovHazan pushed a commit to YaacovHazan/redis that referenced this pull request May 26, 2025
Close redis#13892 
config set port cmd updates server.port. cluster slot retrieves
information about cluster slots and their associated nodes. the fix
updates this info when config set port cmd is done, so cluster slots cmd
returns the right value.
YaacovHazan pushed a commit to YaacovHazan/redis that referenced this pull request May 26, 2025
### Problem 

A previous PR (redis#13932) fixed the TCP
port issue in CLUSTER SLOTS, but it seems the handling of the TLS port
was overlooked.

There is this comment in the `addNodeToNodeReply` function in the
`cluster.c` file:
```c
    /* Report TLS ports to TLS client, and report non-TLS port to non-TLS client. */
    addReplyLongLong(c, clusterNodeClientPort(node, shouldReturnTlsInfo()));
    addReplyBulkCBuffer(c, clusterNodeGetName(node), CLUSTER_NAMELEN);
```

### Fixed 

This PR fixes the TLS port issue and adds relevant tests.
YaacovHazan pushed a commit to YaacovHazan/redis that referenced this pull request May 26, 2025
Close redis#13892 
config set port cmd updates server.port. cluster slot retrieves
information about cluster slots and their associated nodes. the fix
updates this info when config set port cmd is done, so cluster slots cmd
returns the right value.
YaacovHazan pushed a commit to YaacovHazan/redis that referenced this pull request May 26, 2025
### Problem 

A previous PR (redis#13932) fixed the TCP
port issue in CLUSTER SLOTS, but it seems the handling of the TLS port
was overlooked.

There is this comment in the `addNodeToNodeReply` function in the
`cluster.c` file:
```c
    /* Report TLS ports to TLS client, and report non-TLS port to non-TLS client. */
    addReplyLongLong(c, clusterNodeClientPort(node, shouldReturnTlsInfo()));
    addReplyBulkCBuffer(c, clusterNodeGetName(node), CLUSTER_NAMELEN);
```

### Fixed 

This PR fixes the TLS port issue and adds relevant tests.
YaacovHazan pushed a commit that referenced this pull request May 27, 2025
Close #13892 
config set port cmd updates server.port. cluster slot retrieves
information about cluster slots and their associated nodes. the fix
updates this info when config set port cmd is done, so cluster slots cmd
returns the right value.
YaacovHazan pushed a commit that referenced this pull request May 27, 2025
### Problem 

A previous PR (#13932) fixed the TCP
port issue in CLUSTER SLOTS, but it seems the handling of the TLS port
was overlooked.

There is this comment in the `addNodeToNodeReply` function in the
`cluster.c` file:
```c
    /* Report TLS ports to TLS client, and report non-TLS port to non-TLS client. */
    addReplyLongLong(c, clusterNodeClientPort(node, shouldReturnTlsInfo()));
    addReplyBulkCBuffer(c, clusterNodeGetName(node), CLUSTER_NAMELEN);
```

### Fixed 

This PR fixes the TLS port issue and adds relevant tests.
YaacovHazan pushed a commit that referenced this pull request May 27, 2025
Close #13892 
config set port cmd updates server.port. cluster slot retrieves
information about cluster slots and their associated nodes. the fix
updates this info when config set port cmd is done, so cluster slots cmd
returns the right value.
YaacovHazan pushed a commit that referenced this pull request May 27, 2025
### Problem 

A previous PR (#13932) fixed the TCP
port issue in CLUSTER SLOTS, but it seems the handling of the TLS port
was overlooked.

There is this comment in the `addNodeToNodeReply` function in the
`cluster.c` file:
```c
    /* Report TLS ports to TLS client, and report non-TLS port to non-TLS client. */
    addReplyLongLong(c, clusterNodeClientPort(node, shouldReturnTlsInfo()));
    addReplyBulkCBuffer(c, clusterNodeGetName(node), CLUSTER_NAMELEN);
```

### Fixed 

This PR fixes the TLS port issue and adds relevant tests.
@YaacovHazan YaacovHazan moved this from Todo to Done in Redis 7.2 Backport Jun 29, 2025
@YaacovHazan YaacovHazan moved this from Todo to Done in Redis 7.4 Backport Jun 29, 2025
@sundb sundb added this to Redis 8.0 Aug 15, 2025
@sundb sundb removed this from Redis 8.2 Aug 15, 2025
@sundb sundb moved this from Todo to Done in Redis 8.0 Aug 15, 2025
funny-dog pushed a commit to funny-dog/redis that referenced this pull request Sep 17, 2025
Close redis#13892 
config set port cmd updates server.port. cluster slot retrieves
information about cluster slots and their associated nodes. the fix
updates this info when config set port cmd is done, so cluster slots cmd
returns the right value.
funny-dog pushed a commit to funny-dog/redis that referenced this pull request Sep 17, 2025
### Problem 

A previous PR (redis#13932) fixed the TCP
port issue in CLUSTER SLOTS, but it seems the handling of the TLS port
was overlooked.

There is this comment in the `addNodeToNodeReply` function in the
`cluster.c` file:
```c
    /* Report TLS ports to TLS client, and report non-TLS port to non-TLS client. */
    addReplyLongLong(c, clusterNodeClientPort(node, shouldReturnTlsInfo()));
    addReplyBulkCBuffer(c, clusterNodeGetName(node), CLUSTER_NAMELEN);
```

### Fixed 

This PR fixes the TLS port issue and adds relevant tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes indication that this issue needs to be mentioned in the release notes

Projects

Status: Pending
Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] Changing port is not reflected in cluster slot

4 participants