Skip to content

Commit 783c7c8

Browse files
author
elasticsearchmachine
committed
Merge remote-tracking branch 'origin/main' into lucene_snapshot
2 parents d1387ff + 4a8a8a0 commit 783c7c8

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed

muted-tests.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,23 @@ tests:
275275
- class: org.elasticsearch.packaging.test.ArchiveTests
276276
method: test43AutoconfigurationNotTriggeredWhenTlsAlreadyConfigured
277277
issue: https://github.com/elastic/elasticsearch/issues/118202
278+
- class: org.elasticsearch.packaging.test.ArchiveTests
279+
method: test44AutoConfigurationNotTriggeredOnNotWriteableConfDir
280+
issue: https://github.com/elastic/elasticsearch/issues/118208
281+
- class: org.elasticsearch.packaging.test.ArchiveTests
282+
method: test51AutoConfigurationWithPasswordProtectedKeystore
283+
issue: https://github.com/elastic/elasticsearch/issues/118212
284+
- class: org.elasticsearch.xpack.inference.InferenceCrudIT
285+
method: testUnifiedCompletionInference
286+
issue: https://github.com/elastic/elasticsearch/issues/118210
287+
- class: org.elasticsearch.ingest.common.IngestCommonClientYamlTestSuiteIT
288+
issue: https://github.com/elastic/elasticsearch/issues/118215
289+
- class: org.elasticsearch.datastreams.DataStreamsClientYamlTestSuiteIT
290+
method: test {p0=data_stream/120_data_streams_stats/Multiple data stream}
291+
issue: https://github.com/elastic/elasticsearch/issues/118217
292+
- class: org.elasticsearch.xpack.security.operator.OperatorPrivilegesIT
293+
method: testEveryActionIsEitherOperatorOnlyOrNonOperator
294+
issue: https://github.com/elastic/elasticsearch/issues/118220
278295

279296
# Examples:
280297
#

server/src/main/java/org/elasticsearch/monitor/os/OsService.java

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public class OsService implements ReportingService<OsInfo> {
2525

2626
private static final Logger logger = LogManager.getLogger(OsService.class);
2727

28-
private final OsProbe probe;
2928
private final OsInfo info;
3029
private final SingleObjectCache<OsStats> osStatsCache;
3130

@@ -37,10 +36,9 @@ public class OsService implements ReportingService<OsInfo> {
3736
);
3837

3938
public OsService(Settings settings) throws IOException {
40-
this.probe = OsProbe.getInstance();
4139
TimeValue refreshInterval = REFRESH_INTERVAL_SETTING.get(settings);
42-
this.info = probe.osInfo(refreshInterval.millis(), EsExecutors.nodeProcessors(settings));
43-
this.osStatsCache = new OsStatsCache(refreshInterval, probe.osStats());
40+
this.info = OsProbe.getInstance().osInfo(refreshInterval.millis(), EsExecutors.nodeProcessors(settings));
41+
this.osStatsCache = new OsStatsCache(refreshInterval);
4442
logger.debug("using refresh_interval [{}]", refreshInterval);
4543
}
4644

@@ -53,14 +51,28 @@ public OsStats stats() {
5351
return osStatsCache.getOrRefresh();
5452
}
5553

56-
private class OsStatsCache extends SingleObjectCache<OsStats> {
57-
OsStatsCache(TimeValue interval, OsStats initValue) {
58-
super(interval, initValue);
54+
private static class OsStatsCache extends SingleObjectCache<OsStats> {
55+
56+
private static final OsStats MISSING = new OsStats(
57+
0L,
58+
new OsStats.Cpu((short) 0, new double[0]),
59+
new OsStats.Mem(0, 0, 0),
60+
new OsStats.Swap(0, 0),
61+
null
62+
);
63+
64+
OsStatsCache(TimeValue interval) {
65+
super(interval, MISSING);
5966
}
6067

6168
@Override
6269
protected OsStats refresh() {
63-
return probe.osStats();
70+
return OsProbe.getInstance().osStats();
71+
}
72+
73+
@Override
74+
protected boolean needsRefresh() {
75+
return getNoRefresh() == MISSING || super.needsRefresh();
6476
}
6577
}
6678
}

0 commit comments

Comments
 (0)