This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git
The following commit(s) were added to refs/heads/master by this push:
new 7f7570934 Simplify/Remove double delete/lookup in heartbeat cleanup
code.
7f7570934 is described below
commit 7f75709340b0bce5c6a3f13afda5f050a58e4125
Author: Sam Maclennan <[email protected]>
AuthorDate: Fri Apr 5 13:28:09 2024 -0400
Simplify/Remove double delete/lookup in heartbeat cleanup code.
---
.../src/jvm/org/apache/storm/utils/VersionedStore.java | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/storm-client/src/jvm/org/apache/storm/utils/VersionedStore.java
b/storm-client/src/jvm/org/apache/storm/utils/VersionedStore.java
index c4fd33f26..68582289b 100644
--- a/storm-client/src/jvm/org/apache/storm/utils/VersionedStore.java
+++ b/storm-client/src/jvm/org/apache/storm/utils/VersionedStore.java
@@ -128,15 +128,11 @@ public class VersionedStore {
public void cleanup(int versionsToKeep) throws IOException {
List<Long> versions = getAllVersions();
if (versionsToKeep >= 0) {
- versions = versions.subList(0, Math.min(versions.size(),
versionsToKeep));
+ versions = versions.subList(Math.min(versions.size(),
versionsToKeep), versions.size());
}
- HashSet<Long> keepers = new HashSet<Long>(versions);
- for (String p : listDir(root)) {
- Long v = parseVersion(p);
- if (v != null && !keepers.contains(v)) {
- deleteVersion(v);
- }
+ for (Long v : versions) {
+ deleteVersion(v);
}
}