From c07beadb99faeffc661bb516c6181f8e61e5918a Mon Sep 17 00:00:00 2001 From: Nick Ginther Date: Mon, 16 Sep 2024 11:25:37 -0500 Subject: [PATCH] remove extant sizes --- .../src/java/org/apache/solr/storage/SizeAwareDirectory.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/solr/core/src/java/org/apache/solr/storage/SizeAwareDirectory.java b/solr/core/src/java/org/apache/solr/storage/SizeAwareDirectory.java index 5dbf84e9abc..180d142534e 100644 --- a/solr/core/src/java/org/apache/solr/storage/SizeAwareDirectory.java +++ b/solr/core/src/java/org/apache/solr/storage/SizeAwareDirectory.java @@ -76,6 +76,9 @@ private static class FileSizeMap implements Accountable { public Sizes add(String name, Sizes sizes) { Sizes extant = fileSizeMap.put(name, sizes); + if (extant != null) { + onDiskSize.add(-extant.onDiskSize); + } onDiskSize.add(sizes.onDiskSize); return extant; } @@ -96,7 +99,7 @@ public Sizes get(String key) { return fileSizeMap.get(key); } - public long size() { + public int size() { return fileSizeMap.size(); }