Skip to content

Commit a751fe3

Browse files
committed
Don't log invalid row for zero-token nodes
In some cases having zero token node is a normal thing. Logging invalid row each time driver updates metadata confuses users in such case and produce bad UX.
1 parent 1ca5689 commit a751fe3

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

driver-core/src/main/java/com/datastax/driver/core/ControlConnection.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,12 +1007,15 @@ private boolean isValidPeer(Row peerRow, boolean logIfInvalid) {
10071007
&& !peerRow.isNull("data_center")
10081008
&& peerRow.getColumnDefinitions().contains("rack")
10091009
&& !peerRow.isNull("rack")
1010-
&& peerRow.getColumnDefinitions().contains("tokens")
1011-
&& (!peerRow.isNull("tokens")
1012-
|| cluster
1013-
.configuration
1014-
.getQueryOptions()
1015-
.shouldConsiderZeroTokenNodesValidPeers());
1010+
&& peerRow.getColumnDefinitions().contains("tokens");
1011+
1012+
if (isValid && peerRow.isNull("tokens")) {
1013+
// Don't log invalid row for zero token nodes, but report it if it is configured so.
1014+
return cluster
1015+
.configuration
1016+
.getQueryOptions()
1017+
.shouldConsiderZeroTokenNodesValidPeers();
1018+
}
10161019
}
10171020
if (!isValid && logIfInvalid)
10181021
logger.warn(

0 commit comments

Comments
 (0)