From 3f221bf7cbd9b2db7706302fe5e05562f3f1b685 Mon Sep 17 00:00:00 2001 From: Mike McCandless Date: Thu, 16 Jun 2016 04:39:34 -0400 Subject: [PATCH 1/5] Add total_indexing_buffer/_in_bytes to nodes info API --- .../admin/cluster/node/info/NodeInfo.java | 19 +++++++++- .../cluster/node/info/NodesInfoResponse.java | 2 ++ .../elasticsearch/indices/IndicesService.java | 11 ++++-- .../node/service/NodeService.java | 6 ++-- .../nodesinfo/NodeInfoStreamingTests.java | 2 +- .../nodesinfo/SimpleNodesInfoIT.java | 26 +++++++++++++- docs/reference/cluster/nodes-info.asciidoc | 36 ++++++++++++++++++- 7 files changed, 93 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java index 87ec2d052ab..cf4f3e812d4 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java @@ -27,6 +27,7 @@ import org.elasticsearch.common.Nullable; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.http.HttpInfo; import org.elasticsearch.ingest.core.IngestInfo; import org.elasticsearch.monitor.jvm.JvmInfo; @@ -78,12 +79,16 @@ public class NodeInfo extends BaseNodeResponse { @Nullable private IngestInfo ingest; + @Nullable + private ByteSizeValue totalIndexingBuffer; + public NodeInfo() { } public NodeInfo(Version version, Build build, DiscoveryNode node, @Nullable Map serviceAttributes, @Nullable Settings settings, @Nullable OsInfo os, @Nullable ProcessInfo process, @Nullable JvmInfo jvm, @Nullable ThreadPoolInfo threadPool, - @Nullable TransportInfo transport, @Nullable HttpInfo http, @Nullable PluginsAndModules plugins, @Nullable IngestInfo ingest) { + @Nullable TransportInfo transport, @Nullable HttpInfo http, @Nullable PluginsAndModules plugins, @Nullable IngestInfo ingest, + ByteSizeValue totalIndexingBuffer) { super(node); this.version = version; this.build = build; @@ -97,6 +102,7 @@ public class NodeInfo extends BaseNodeResponse { this.http = http; this.plugins = plugins; this.ingest = ingest; + this.totalIndexingBuffer = totalIndexingBuffer; } /** @@ -186,6 +192,11 @@ public class NodeInfo extends BaseNodeResponse { return ingest; } + @Nullable + public ByteSizeValue getTotalIndexingBuffer() { + return totalIndexingBuffer; + } + public static NodeInfo readNodeInfo(StreamInput in) throws IOException { NodeInfo nodeInfo = new NodeInfo(); nodeInfo.readFrom(in); @@ -197,6 +208,7 @@ public class NodeInfo extends BaseNodeResponse { super.readFrom(in); version = Version.readVersion(in); build = Build.readBuild(in); + totalIndexingBuffer = new ByteSizeValue(in.readLong()); if (in.readBoolean()) { Map builder = new HashMap<>(); int size = in.readVInt(); @@ -240,6 +252,11 @@ public class NodeInfo extends BaseNodeResponse { super.writeTo(out); out.writeVInt(version.id); Build.writeBuild(build, out); + if (totalIndexingBuffer == null) { + out.writeLong(0); + } else { + out.writeLong(totalIndexingBuffer.bytes()); + } if (getServiceAttributes() == null) { out.writeBoolean(false); } else { diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java index d5a43eb030e..c42deeac703 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java @@ -69,6 +69,8 @@ public class NodesInfoResponse extends BaseNodesResponse implements To builder.field("version", nodeInfo.getVersion()); builder.field("build_hash", nodeInfo.getBuild().shortHash()); + builder.field("total_indexing_buffer_in_bytes", nodeInfo.getTotalIndexingBuffer().bytes()); + builder.field("total_indexing_buffer", nodeInfo.getTotalIndexingBuffer()); if (nodeInfo.getServiceAttributes() != null) { for (Map.Entry nodeAttribute : nodeInfo.getServiceAttributes().entrySet()) { diff --git a/core/src/main/java/org/elasticsearch/indices/IndicesService.java b/core/src/main/java/org/elasticsearch/indices/IndicesService.java index 92bcfbe64a2..89db99be923 100644 --- a/core/src/main/java/org/elasticsearch/indices/IndicesService.java +++ b/core/src/main/java/org/elasticsearch/indices/IndicesService.java @@ -27,11 +27,11 @@ import org.apache.lucene.util.CollectionUtil; import org.apache.lucene.util.IOUtils; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.admin.indices.stats.CommonStats; -import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags; import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags.Flag; -import org.elasticsearch.action.fieldstats.FieldStats; +import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags; import org.elasticsearch.action.admin.indices.stats.IndexShardStats; import org.elasticsearch.action.admin.indices.stats.ShardStats; +import org.elasticsearch.action.fieldstats.FieldStats; import org.elasticsearch.action.search.SearchType; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; @@ -53,9 +53,10 @@ import org.elasticsearch.common.lease.Releasable; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.IndexScopedSettings; -import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting.Property; +import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.Callback; import org.elasticsearch.common.util.concurrent.EsExecutors; @@ -1140,6 +1141,10 @@ public class IndicesService extends AbstractLifecycleComponent } } + public ByteSizeValue getTotalIndexingBufferBytes() { + return indexingMemoryController.indexingBufferSize(); + } + /** * Cache something calculated at the shard level. * @param shard the shard this item is part of diff --git a/core/src/main/java/org/elasticsearch/node/service/NodeService.java b/core/src/main/java/org/elasticsearch/node/service/NodeService.java index 1cbdfe12d2c..8280cb6d6ef 100644 --- a/core/src/main/java/org/elasticsearch/node/service/NodeService.java +++ b/core/src/main/java/org/elasticsearch/node/service/NodeService.java @@ -135,7 +135,8 @@ public class NodeService extends AbstractComponent implements Closeable { transportService.info(), httpServer == null ? null : httpServer.info(), pluginService == null ? null : pluginService.info(), - ingestService == null ? null : ingestService.info() + ingestService == null ? null : ingestService.info(), + indicesService == null ? null : indicesService.getTotalIndexingBufferBytes() ); } @@ -150,7 +151,8 @@ public class NodeService extends AbstractComponent implements Closeable { transport ? transportService.info() : null, http ? (httpServer == null ? null : httpServer.info()) : null, plugin ? (pluginService == null ? null : pluginService.info()) : null, - ingest ? (ingestService == null ? null : ingestService.info()) : null + ingest ? (ingestService == null ? null : ingestService.info()) : null, + indicesService == null ? null : indicesService.getTotalIndexingBufferBytes() ); } diff --git a/core/src/test/java/org/elasticsearch/nodesinfo/NodeInfoStreamingTests.java b/core/src/test/java/org/elasticsearch/nodesinfo/NodeInfoStreamingTests.java index 92dac4bd784..b84ffca106c 100644 --- a/core/src/test/java/org/elasticsearch/nodesinfo/NodeInfoStreamingTests.java +++ b/core/src/test/java/org/elasticsearch/nodesinfo/NodeInfoStreamingTests.java @@ -141,6 +141,6 @@ public class NodeInfoStreamingTests extends ESTestCase { plugins.addModule(DummyPluginInfo.INSTANCE); plugins.addPlugin(DummyPluginInfo.INSTANCE); IngestInfo ingestInfo = new IngestInfo(Collections.emptyList()); - return new NodeInfo(VersionUtils.randomVersion(random()), build, node, serviceAttributes, settings, osInfo, process, jvm, threadPoolInfo, transport, htttpInfo, plugins, ingestInfo); + return new NodeInfo(VersionUtils.randomVersion(random()), build, node, serviceAttributes, settings, osInfo, process, jvm, threadPoolInfo, transport, htttpInfo, plugins, ingestInfo, null); } } diff --git a/core/src/test/java/org/elasticsearch/nodesinfo/SimpleNodesInfoIT.java b/core/src/test/java/org/elasticsearch/nodesinfo/SimpleNodesInfoIT.java index b7dcf2872e2..73f0b99ecf4 100644 --- a/core/src/test/java/org/elasticsearch/nodesinfo/SimpleNodesInfoIT.java +++ b/core/src/test/java/org/elasticsearch/nodesinfo/SimpleNodesInfoIT.java @@ -24,14 +24,15 @@ import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.EsExecutors; -import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.Scope; +import org.elasticsearch.test.ESIntegTestCase; import java.util.List; import static org.elasticsearch.client.Requests.nodesInfoRequest; import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; @@ -80,6 +81,29 @@ public class SimpleNodesInfoIT extends ESIntegTestCase { assertThat(response.getNodesMap().get(server2NodeId), notNullValue()); } + public void testNodesInfosTotalIndexingBuffer() throws Exception { + List nodesIds = internalCluster().startNodesAsync(2).get(); + final String node_1 = nodesIds.get(0); + final String node_2 = nodesIds.get(1); + + ClusterHealthResponse clusterHealth = client().admin().cluster().prepareHealth().setWaitForGreenStatus().setWaitForNodes("2").get(); + logger.info("--> done cluster_health, status {}", clusterHealth.getStatus()); + + String server1NodeId = internalCluster().getInstance(ClusterService.class, node_1).state().nodes().getLocalNodeId(); + String server2NodeId = internalCluster().getInstance(ClusterService.class, node_2).state().nodes().getLocalNodeId(); + logger.info("--> started nodes: {} and {}", server1NodeId, server2NodeId); + + NodesInfoResponse response = client().admin().cluster().prepareNodesInfo().execute().actionGet(); + assertThat(response.getNodes().size(), is(2)); + assertThat(response.getNodesMap().get(server1NodeId), notNullValue()); + assertNotNull(response.getNodesMap().get(server1NodeId).getTotalIndexingBuffer()); + assertThat(response.getNodesMap().get(server1NodeId).getTotalIndexingBuffer().bytes(), greaterThan(0L)); + + assertThat(response.getNodesMap().get(server2NodeId), notNullValue()); + assertNotNull(response.getNodesMap().get(server2NodeId).getTotalIndexingBuffer()); + assertThat(response.getNodesMap().get(server2NodeId).getTotalIndexingBuffer().bytes(), greaterThan(0L)); + } + public void testAllocatedProcessors() throws Exception { List nodesIds = internalCluster(). startNodesAsync( diff --git a/docs/reference/cluster/nodes-info.asciidoc b/docs/reference/cluster/nodes-info.asciidoc index 5ed979abd0d..8b505218664 100644 --- a/docs/reference/cluster/nodes-info.asciidoc +++ b/docs/reference/cluster/nodes-info.asciidoc @@ -15,7 +15,41 @@ The second command selectively retrieves nodes information of only `nodeId1` and `nodeId2`. All the nodes selective options are explained <>. -By default, it just returns all attributes and core settings for a node. +By default, it just returns all attributes and core settings for a node: + +[float] +[[core-info]] + +`build_hash`:: + Short hash of the last git commit in this release. + +`host`:: + The node's host name. + +`http_address`:: + Host and port where primary HTTP connections are accepted. + +`ip`:: + The node's IP address. + +`name`:: + The node's name. + +`total_indexing_buffer`:: + Total heap allowed to be used to hold recently indexed + documents before they must be written to disk. This size is + a shared pool across all shards on this node, and is + controlled by <>. + +`total_indexing_buffer_in_bytes`:: + Same as `total_indexing_buffer`, but expressed in bytes. + +`transport_address`:: + Host and port where transport HTTP connections are accepted. + +`version`:: + Elasticsearch version running on this node. + It also allows to get only information on `settings`, `os`, `process`, `jvm`, `thread_pool`, `transport`, `http`, `plugins` and `ingest`: From ebc3c17c34c170a72cca528fdee6acedcab73a7e Mon Sep 17 00:00:00 2001 From: Mike McCandless Date: Mon, 20 Jun 2016 14:20:23 -0400 Subject: [PATCH 2/5] add indices flag to nodes info request; use boolean to express 'null' indexing buffer value on the wire --- .../admin/cluster/node/info/NodeInfo.java | 9 ++++++-- .../cluster/node/info/NodesInfoRequest.java | 21 +++++++++++++++++++ .../node/info/NodesInfoRequestBuilder.java | 8 +++++++ .../cluster/node/info/NodesInfoResponse.java | 5 +++-- .../node/info/TransportNodesInfoAction.java | 2 +- .../stats/TransportClusterStatsAction.java | 2 +- .../node/service/NodeService.java | 4 ++-- .../node/info/RestNodesInfoAction.java | 3 ++- .../nodesinfo/SimpleNodesInfoIT.java | 11 ++++++++++ 9 files changed, 56 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java index cf4f3e812d4..312b4a5a05c 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java @@ -208,7 +208,11 @@ public class NodeInfo extends BaseNodeResponse { super.readFrom(in); version = Version.readVersion(in); build = Build.readBuild(in); - totalIndexingBuffer = new ByteSizeValue(in.readLong()); + if (in.readBoolean()) { + totalIndexingBuffer = new ByteSizeValue(in.readLong()); + } else { + totalIndexingBuffer = null; + } if (in.readBoolean()) { Map builder = new HashMap<>(); int size = in.readVInt(); @@ -253,8 +257,9 @@ public class NodeInfo extends BaseNodeResponse { out.writeVInt(version.id); Build.writeBuild(build, out); if (totalIndexingBuffer == null) { - out.writeLong(0); + out.writeBoolean(false); } else { + out.writeBoolean(true); out.writeLong(totalIndexingBuffer.bytes()); } if (getServiceAttributes() == null) { diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequest.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequest.java index 66c5cfd65d4..b547d1d7432 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequest.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequest.java @@ -39,6 +39,7 @@ public class NodesInfoRequest extends BaseNodesRequest { private boolean http = true; private boolean plugins = true; private boolean ingest = true; + private boolean indices = true; public NodesInfoRequest() { } @@ -64,6 +65,7 @@ public class NodesInfoRequest extends BaseNodesRequest { http = false; plugins = false; ingest = false; + indices = false; return this; } @@ -80,6 +82,7 @@ public class NodesInfoRequest extends BaseNodesRequest { http = true; plugins = true; ingest = true; + indices = true; return this; } @@ -221,6 +224,22 @@ public class NodesInfoRequest extends BaseNodesRequest { return ingest; } + /** + * Should information about indices (currently just indexing buffers) be returned + * @param indices true if you want info + */ + public NodesInfoRequest indices(boolean indices) { + this.indices = indices; + return this; + } + + /** + * @return true if information about indices (currently just indexing buffers) + */ + public boolean indices() { + return indices; + } + @Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); @@ -233,6 +252,7 @@ public class NodesInfoRequest extends BaseNodesRequest { http = in.readBoolean(); plugins = in.readBoolean(); ingest = in.readBoolean(); + indices = in.readBoolean(); } @Override @@ -247,5 +267,6 @@ public class NodesInfoRequest extends BaseNodesRequest { out.writeBoolean(http); out.writeBoolean(plugins); out.writeBoolean(ingest); + out.writeBoolean(indices); } } diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequestBuilder.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequestBuilder.java index fc484012379..16befb79aab 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequestBuilder.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequestBuilder.java @@ -118,4 +118,12 @@ public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder implements To builder.field("version", nodeInfo.getVersion()); builder.field("build_hash", nodeInfo.getBuild().shortHash()); - builder.field("total_indexing_buffer_in_bytes", nodeInfo.getTotalIndexingBuffer().bytes()); - builder.field("total_indexing_buffer", nodeInfo.getTotalIndexingBuffer()); + if (nodeInfo.getTotalIndexingBuffer() != null) { + builder.byteSizeField("total_indexing_buffer", "total_indexing_buffer_in_bytes", nodeInfo.getTotalIndexingBuffer()); + } if (nodeInfo.getServiceAttributes() != null) { for (Map.Entry nodeAttribute : nodeInfo.getServiceAttributes().entrySet()) { diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java index f68e2d65903..857ec494688 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java @@ -77,7 +77,7 @@ public class TransportNodesInfoAction extends TransportNodesAction shardsStats = new ArrayList<>(); for (IndexService indexService : indicesService) { diff --git a/core/src/main/java/org/elasticsearch/node/service/NodeService.java b/core/src/main/java/org/elasticsearch/node/service/NodeService.java index 8280cb6d6ef..2f056ba1325 100644 --- a/core/src/main/java/org/elasticsearch/node/service/NodeService.java +++ b/core/src/main/java/org/elasticsearch/node/service/NodeService.java @@ -141,7 +141,7 @@ public class NodeService extends AbstractComponent implements Closeable { } public NodeInfo info(boolean settings, boolean os, boolean process, boolean jvm, boolean threadPool, - boolean transport, boolean http, boolean plugin, boolean ingest) { + boolean transport, boolean http, boolean plugin, boolean ingest, boolean indices) { return new NodeInfo(version, Build.CURRENT, discovery.localNode(), serviceAttributes, settings ? settingsFilter.filter(this.settings) : null, os ? monitorService.osService().info() : null, @@ -152,7 +152,7 @@ public class NodeService extends AbstractComponent implements Closeable { http ? (httpServer == null ? null : httpServer.info()) : null, plugin ? (pluginService == null ? null : pluginService.info()) : null, ingest ? (ingestService == null ? null : ingestService.info()) : null, - indicesService == null ? null : indicesService.getTotalIndexingBufferBytes() + indices ? indicesService.getTotalIndexingBufferBytes() : null ); } diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java index 0f1e8691770..312fd0b0b7a 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java @@ -43,7 +43,7 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestNodesInfoAction extends BaseRestHandler { private final SettingsFilter settingsFilter; - private final static Set ALLOWED_METRICS = Sets.newHashSet("http", "jvm", "os", "plugins", "process", "settings", "thread_pool", "transport", "ingest"); + private final static Set ALLOWED_METRICS = Sets.newHashSet("http", "jvm", "os", "plugins", "process", "settings", "thread_pool", "transport", "ingest", "indices"); @Inject public RestNodesInfoAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) { @@ -97,6 +97,7 @@ public class RestNodesInfoAction extends BaseRestHandler { nodesInfoRequest.http(metrics.contains("http")); nodesInfoRequest.plugins(metrics.contains("plugins")); nodesInfoRequest.ingest(metrics.contains("ingest")); + nodesInfoRequest.indices(metrics.contains("indices")); } settingsFilter.addFilterSettingParams(request); diff --git a/core/src/test/java/org/elasticsearch/nodesinfo/SimpleNodesInfoIT.java b/core/src/test/java/org/elasticsearch/nodesinfo/SimpleNodesInfoIT.java index 73f0b99ecf4..0cc30f8d569 100644 --- a/core/src/test/java/org/elasticsearch/nodesinfo/SimpleNodesInfoIT.java +++ b/core/src/test/java/org/elasticsearch/nodesinfo/SimpleNodesInfoIT.java @@ -102,6 +102,17 @@ public class SimpleNodesInfoIT extends ESIntegTestCase { assertThat(response.getNodesMap().get(server2NodeId), notNullValue()); assertNotNull(response.getNodesMap().get(server2NodeId).getTotalIndexingBuffer()); assertThat(response.getNodesMap().get(server2NodeId).getTotalIndexingBuffer().bytes(), greaterThan(0L)); + + // again, using only the indices flag + response = client().admin().cluster().prepareNodesInfo().clear().setIndices(true).execute().actionGet(); + assertThat(response.getNodes().size(), is(2)); + assertThat(response.getNodesMap().get(server1NodeId), notNullValue()); + assertNotNull(response.getNodesMap().get(server1NodeId).getTotalIndexingBuffer()); + assertThat(response.getNodesMap().get(server1NodeId).getTotalIndexingBuffer().bytes(), greaterThan(0L)); + + assertThat(response.getNodesMap().get(server2NodeId), notNullValue()); + assertNotNull(response.getNodesMap().get(server2NodeId).getTotalIndexingBuffer()); + assertThat(response.getNodesMap().get(server2NodeId).getTotalIndexingBuffer().bytes(), greaterThan(0L)); } public void testAllocatedProcessors() throws Exception { From eecf094ac1b168962d797164ab4842b16a12a7e4 Mon Sep 17 00:00:00 2001 From: Mike McCandless Date: Mon, 20 Jun 2016 14:23:32 -0400 Subject: [PATCH 3/5] add indices nodes info flag to docs --- docs/reference/cluster/nodes-info.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/cluster/nodes-info.asciidoc b/docs/reference/cluster/nodes-info.asciidoc index 8b505218664..77f77da3c89 100644 --- a/docs/reference/cluster/nodes-info.asciidoc +++ b/docs/reference/cluster/nodes-info.asciidoc @@ -51,7 +51,7 @@ By default, it just returns all attributes and core settings for a node: Elasticsearch version running on this node. It also allows to get only information on `settings`, `os`, `process`, `jvm`, -`thread_pool`, `transport`, `http`, `plugins` and `ingest`: +`thread_pool`, `transport`, `http`, `plugins`, `ingest` and `indices`: [source,js] -------------------------------------------------- From 1bd0482393b5000a6d8f13703c8d8aae46302cf0 Mon Sep 17 00:00:00 2001 From: Mike McCandless Date: Wed, 22 Jun 2016 09:52:54 -0400 Subject: [PATCH 4/5] don't include indexing buffer in cluster stats; randomize indexing buffer in NodeInfoStreamingTests; add @Nullable annotation --- .../action/admin/cluster/node/info/NodeInfo.java | 2 +- .../cluster/stats/TransportClusterStatsAction.java | 2 +- .../nodesinfo/NodeInfoStreamingTests.java | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java index 312b4a5a05c..f1f3f20a492 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java @@ -88,7 +88,7 @@ public class NodeInfo extends BaseNodeResponse { public NodeInfo(Version version, Build build, DiscoveryNode node, @Nullable Map serviceAttributes, @Nullable Settings settings, @Nullable OsInfo os, @Nullable ProcessInfo process, @Nullable JvmInfo jvm, @Nullable ThreadPoolInfo threadPool, @Nullable TransportInfo transport, @Nullable HttpInfo http, @Nullable PluginsAndModules plugins, @Nullable IngestInfo ingest, - ByteSizeValue totalIndexingBuffer) { + @Nullable ByteSizeValue totalIndexingBuffer) { super(node); this.version = version; this.build = build; diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/TransportClusterStatsAction.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/TransportClusterStatsAction.java index c4c6f3e6ecc..73a5e978fb7 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/TransportClusterStatsAction.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/TransportClusterStatsAction.java @@ -92,7 +92,7 @@ public class TransportClusterStatsAction extends TransportNodesAction shardsStats = new ArrayList<>(); for (IndexService indexService : indicesService) { diff --git a/core/src/test/java/org/elasticsearch/nodesinfo/NodeInfoStreamingTests.java b/core/src/test/java/org/elasticsearch/nodesinfo/NodeInfoStreamingTests.java index b84ffca106c..191eee160ff 100644 --- a/core/src/test/java/org/elasticsearch/nodesinfo/NodeInfoStreamingTests.java +++ b/core/src/test/java/org/elasticsearch/nodesinfo/NodeInfoStreamingTests.java @@ -30,6 +30,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.BoundTransportAddress; import org.elasticsearch.common.transport.DummyTransportAddress; import org.elasticsearch.common.transport.TransportAddress; +import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.http.HttpInfo; @@ -141,6 +142,13 @@ public class NodeInfoStreamingTests extends ESTestCase { plugins.addModule(DummyPluginInfo.INSTANCE); plugins.addPlugin(DummyPluginInfo.INSTANCE); IngestInfo ingestInfo = new IngestInfo(Collections.emptyList()); - return new NodeInfo(VersionUtils.randomVersion(random()), build, node, serviceAttributes, settings, osInfo, process, jvm, threadPoolInfo, transport, htttpInfo, plugins, ingestInfo, null); + ByteSizeValue indexingBuffer; + if (random().nextBoolean()) { + indexingBuffer = null; + } else { + // pick a random long that sometimes exceeds an int: + indexingBuffer = new ByteSizeValue(random().nextLong() & ((1L<<40)-1)); + } + return new NodeInfo(VersionUtils.randomVersion(random()), build, node, serviceAttributes, settings, osInfo, process, jvm, threadPoolInfo, transport, htttpInfo, plugins, ingestInfo, indexingBuffer); } } From cbc7ff3f9cf4bd5fe7182fdbbdea5f1432f041dc Mon Sep 17 00:00:00 2001 From: Mike McCandless Date: Wed, 22 Jun 2016 10:04:33 -0400 Subject: [PATCH 5/5] NodeService.indicesService is never null --- .../main/java/org/elasticsearch/node/service/NodeService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/elasticsearch/node/service/NodeService.java b/core/src/main/java/org/elasticsearch/node/service/NodeService.java index ce242fc66a1..ed03dc9375c 100644 --- a/core/src/main/java/org/elasticsearch/node/service/NodeService.java +++ b/core/src/main/java/org/elasticsearch/node/service/NodeService.java @@ -133,7 +133,7 @@ public class NodeService extends AbstractComponent implements Closeable { httpServer == null ? null : httpServer.info(), pluginService == null ? null : pluginService.info(), ingestService == null ? null : ingestService.info(), - indicesService == null ? null : indicesService.getTotalIndexingBufferBytes() + indicesService.getTotalIndexingBufferBytes() ); }