Skip to content

Commit f09dc7f

Browse files
committed
Fix the failing tests due to connection profile missing STREAM type
Signed-off-by: Rishabh Maurya <[email protected]>
1 parent 46afedd commit f09dc7f

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

server/src/main/java/org/opensearch/transport/ConnectionProfile.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ public static ConnectionProfile buildDefaultConnectionProfile(Settings settings)
112112
// if we are not a data-node we don't need any dedicated channels for recovery
113113
builder.addConnections(DiscoveryNode.isDataNode(settings) ? connectionsPerNodeRecovery : 0, TransportRequestOptions.Type.RECOVERY);
114114
builder.addConnections(connectionsPerNodeReg, TransportRequestOptions.Type.REG);
115-
// TODO use different setting for connectionsPerNodeReg for stream request
116-
builder.addConnections(connectionsPerNodeReg, TransportRequestOptions.Type.STREAM);
115+
// we build a single channel profile with only supported type as STREAM for stream transport defined in StreamTransportService
116+
builder.addConnections(0, TransportRequestOptions.Type.STREAM);
117117
return builder.build();
118118
}
119119

server/src/main/java/org/opensearch/transport/StreamTransportService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public Transport.Connection getConnection(DiscoveryNode node) {
113113
try {
114114
return connectionManager.getConnection(node);
115115
} catch (Exception e) {
116-
logger.error("Failed to get streaming connection to node [{}]", node, e);
116+
logger.error("Failed to get streaming connection to node [{}]: {}", node, e.getMessage());
117117
throw new ConnectTransportException(node, "Failed to get streaming connection", e);
118118
}
119119
}

test/framework/src/main/java/org/opensearch/transport/AbstractSimpleTransportTestCase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,6 +2242,7 @@ public void testHandshakeUpdatesVersion() throws IOException {
22422242
TransportRequestOptions.Type.REG,
22432243
TransportRequestOptions.Type.STATE
22442244
);
2245+
builder.addConnections(0, TransportRequestOptions.Type.STREAM);
22452246
try (Transport.Connection connection = serviceA.openConnection(node, builder.build())) {
22462247
assertEquals(version, connection.getVersion());
22472248
}

0 commit comments

Comments
 (0)