Skip to content

Commit 99393b5

Browse files
authored
Fixed assertion unsafe call of ClusterService.state() (opensearch-project#19775)
* Fixed assertion unsafe call of ClusterService.state() Signed-off-by: Nils Bandener <nils.bandener@eliatra.com> * Added changelog Signed-off-by: Nils Bandener <nils.bandener@eliatra.com> --------- Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
1 parent 753c135 commit 99393b5

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4040
- [Java Agent] Allow JRT protocol URLs in protection domain extraction ([#19683](https://github.com/opensearch-project/OpenSearch/pull/19683))
4141
- Fix potential concurrent modification exception when updating allocation filters ([#19701])(https://github.com/opensearch-project/OpenSearch/pull/19701))
4242
- Fix file-based ingestion consumer to handle start point beyond max line number([#19757])(https://github.com/opensearch-project/OpenSearch/pull/19757))
43+
- Fixed assertion unsafe use of ClusterService.state() in ResourceUsageCollectorService ([#19775])(https://github.com/opensearch-project/OpenSearch/pull/19775))
4344

4445
### Dependencies
4546
- Update to Gradle 9.1 ([#19575](https://github.com/opensearch-project/OpenSearch/pull/19575))

server/src/main/java/org/opensearch/node/ResourceUsageCollectorService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public NodesResourceUsageStats stats() {
126126
* Fetch local node resource usage statistics and add it to store along with the current timestamp
127127
*/
128128
private void collectLocalNodeResourceUsageStats() {
129-
if (nodeResourceUsageTracker.isReady() && clusterService.state() != null) {
129+
if (nodeResourceUsageTracker.isReady() && clusterService.isStateInitialised()) {
130130
collectNodeResourceUsageStats(
131131
clusterService.state().nodes().getLocalNodeId(),
132132
System.currentTimeMillis(),

0 commit comments

Comments
 (0)