Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align remote info api with new settings #53441

Merged
merged 5 commits into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

public class ProxyModeInfo implements RemoteConnectionInfo.ModeInfo {
static final String NAME = "proxy";
static final String ADDRESS = "address";
static final String NUM_SOCKETS_CONNECTED = "num_sockets_connected";
static final String MAX_SOCKET_CONNECTIONS = "max_socket_connections";
static final String PROXY_ADDRESS = "proxy_address";
static final String NUM_PROXY_SOCKETS_CONNECTED = "num_proxy_sockets_connected";
static final String MAX_PROXY_SOCKET_CONNECTIONS = "max_proxy_socket_connections";
private final String address;
private final int maxSocketConnections;
private final int numSocketsConnected;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public final class RemoteConnectionInfo {
PARSER.declareString(constructorArg(), new ParseField(INITIAL_CONNECT_TIMEOUT));
PARSER.declareBoolean(constructorArg(), new ParseField(SKIP_UNAVAILABLE));

PARSER.declareString(optionalConstructorArg(), new ParseField(ProxyModeInfo.ADDRESS));
PARSER.declareInt(optionalConstructorArg(), new ParseField(ProxyModeInfo.MAX_SOCKET_CONNECTIONS));
PARSER.declareInt(optionalConstructorArg(), new ParseField(ProxyModeInfo.NUM_SOCKETS_CONNECTED));
PARSER.declareString(optionalConstructorArg(), new ParseField(ProxyModeInfo.PROXY_ADDRESS));
PARSER.declareInt(optionalConstructorArg(), new ParseField(ProxyModeInfo.MAX_PROXY_SOCKET_CONNECTIONS));
PARSER.declareInt(optionalConstructorArg(), new ParseField(ProxyModeInfo.NUM_PROXY_SOCKETS_CONNECTED));

PARSER.declareStringArray(optionalConstructorArg(), new ParseField(SniffModeInfo.SEEDS));
PARSER.declareInt(optionalConstructorArg(), new ParseField(SniffModeInfo.MAX_CONNECTIONS_PER_CLUSTER));
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/cluster/remote-info.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ by the configured remote cluster alias.
Maximum number of connections maintained for the remote cluster when sniff
mode is configured.

`address`::
`proxy_address`::
Address for remote connections when proxy mode is configured.

`num_sockets_connected`::
`num_proxy_sockets_connected`::
Number of open socket connections to the remote cluster when proxy mode
is configured.

`max_socket_connections`::
`max_proxy_socket_connections`::
The maximum number of socket connections to the remote cluster when proxy
mode is configured.
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
cluster.remote_info: {}

- match: { test_remote_cluster.connected: true }
- match: { test_remote_cluster.address: $remote_ip }
- gt: { test_remote_cluster.num_sockets_connected: 0}
- match: { test_remote_cluster.max_socket_connections: 10}
- match: { test_remote_cluster.proxy_address: $remote_ip }
- gt: { test_remote_cluster.num_proxy_sockets_connected: 0}
- match: { test_remote_cluster.max_proxy_socket_connections: 10}
- match: { test_remote_cluster.initial_connect_timeout: "30s" }
- match: { test_remote_cluster.mode: "proxy" }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ private ProxyModeInfo(StreamInput input) throws IOException {

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.field("address", address);
builder.field("num_sockets_connected", numSocketsConnected);
builder.field("max_socket_connections", maxSocketConnections);
builder.field("proxy_address", address);
builder.field("num_proxy_sockets_connected", numSocketsConnected);
builder.field("max_proxy_socket_connections", maxSocketConnections);
return builder;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,8 @@ public void testRenderConnectionInfoXContent() throws IOException {
"\"num_nodes_connected\":2,\"max_connections_per_cluster\":3,\"initial_connect_timeout\":\"30m\"," +
"\"skip_unavailable\":true}}", Strings.toString(builder));
} else {
assertEquals("{\"test_cluster\":{\"connected\":true,\"mode\":\"proxy\",\"address\":\"seed:1\"," +
"\"num_sockets_connected\":16,\"max_socket_connections\":18,\"initial_connect_timeout\":\"30m\"," +
assertEquals("{\"test_cluster\":{\"connected\":true,\"mode\":\"proxy\",\"proxy_address\":\"seed:1\"," +
"\"num_proxy_sockets_connected\":16,\"max_proxy_socket_connections\":18,\"initial_connect_timeout\":\"30m\"," +
"\"skip_unavailable\":true}}", Strings.toString(builder));
}
}
Expand Down