Skip to content

Commit 609ab95

Browse files
committed
Avoid repacking the same map
1 parent 130d406 commit 609ab95

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/accesscontrol/DocumentSubsetBitsetCache.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838

3939
import java.io.Closeable;
4040
import java.io.IOException;
41-
import java.util.Collections;
4241
import java.util.LinkedHashMap;
4342
import java.util.List;
4443
import java.util.Map;
@@ -316,7 +315,7 @@ public Map<String, Object> usageStats() {
316315
stats.put("evictions", cacheStats.getEvictions());
317316
stats.put("hits_time_in_millis", TimeValue.nsecToMSec(hitsTimeInNanos.sum()));
318317
stats.put("misses_time_in_millis", TimeValue.nsecToMSec(missesTimeInNanos.sum()));
319-
return Collections.unmodifiableMap(stats);
318+
return stats;
320319
}
321320

322321
private static final class BitsetCacheKey {

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/CompositeRolesStore.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -671,9 +671,7 @@ Iterable<ProjectScoped<RoleKey>> cachedRoles() {
671671
}
672672

673673
public Map<String, Object> usageStatsWithJustDls() {
674-
// LinkedHashMap for ordering in transport.
675-
// if adding properties consider consistent ordering for human-readability of JSON.
676-
return Map.of("dls", Map.of("bit_set_cache", new LinkedHashMap<>(dlsBitsetCache.usageStats())));
674+
return Map.of("dls", Map.of("bit_set_cache", dlsBitsetCache.usageStats()));
677675
}
678676

679677
public void usageStats(ActionListener<Map<String, Object>> listener) {

0 commit comments

Comments
 (0)