Skip to content

Commit ffcf0d5

Browse files
authored
JAVA-3005: Refresh entire node list when new node added (#1604)
Empirically, Cassandra does not appear to send TopologyChangeType.REMOVED_NODE when a node in the ring crashes hard and is eventually replaced, even though the bad node is removed from the system tables. This results in the driver holding on to that node until a restart. The 3.x driver refreshes the entire node list when a node is added, so when a new node comes up to replace the crashed node, the crashed node is removed from the driver's state. With this change we port that behavior to the 4.x driver and refresh the entire node list when a new node is added. This also fixes JAVA-3002.
1 parent a76d38e commit ffcf0d5

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

changelog/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
<!-- Note: contrary to 3.x, insert new entries *first* in their section -->
44

5+
### 4.14.2 (in progress)
6+
7+
- [bug] JAVA-3002 JAVA-3005: Refresh entire node list when a new node is added
8+
59
### 4.14.1
610

711
- [improvement] JAVA-3013: Upgrade dependencies to address CVEs and other security issues, 4.14.1 edition

core/src/main/java/com/datastax/oss/driver/internal/core/metadata/NodeStateManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ private void onDebouncedTopologyEvent(TopologyEvent event) {
185185
}
186186
} else {
187187
LOG.debug(
188-
"[{}] Received UP event for unknown node {}, adding it",
188+
"[{}] Received UP event for unknown node {}, refreshing node list",
189189
logPrefix,
190190
event.broadcastRpcAddress);
191-
metadataManager.addNode(event.broadcastRpcAddress);
191+
metadataManager.refreshNodes();
192192
}
193193
break;
194194
case SUGGEST_DOWN:

core/src/test/java/com/datastax/oss/driver/internal/core/metadata/NodeStateManagerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public void should_apply_up_event_if_node_is_unknown_or_down() {
147147
}
148148

149149
@Test
150-
public void should_add_node_if_up_event_and_not_in_metadata() {
150+
public void should_refresh_node_list_if_up_event_and_not_in_metadata() {
151151
// Given
152152
new NodeStateManager(context);
153153

@@ -157,7 +157,7 @@ public void should_add_node_if_up_event_and_not_in_metadata() {
157157

158158
// Then
159159
verify(eventBus, never()).fire(any(NodeStateEvent.class));
160-
verify(metadataManager).addNode(NEW_ADDRESS);
160+
verify(metadataManager).refreshNodes();
161161
}
162162

163163
@Test

0 commit comments

Comments
 (0)