Skip to content

Commit 8bb4dcc

Browse files
authored
fix: 18658: ReconnectNodeRemover.setPathInformation() may cause OOM (#18708)
Fixes: #18658 Reviewed-by: Anthony Petrov <[email protected]>, Nikita Lebedev <[email protected]> Signed-off-by: Artem Ananev <[email protected]>
1 parent a1d5aef commit 8bb4dcc

File tree

12 files changed

+532
-521
lines changed

12 files changed

+532
-521
lines changed

platform-sdk/swirlds-virtualmap/src/main/java/com/swirlds/virtualmap/internal/hash/VirtualHashListener.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,20 @@
1010
* Listens to various events that occur during the hashing process.
1111
*/
1212
public interface VirtualHashListener<K extends VirtualKey, V extends VirtualValue> {
13+
1314
/**
1415
* Called when starting a new fresh hash operation.
16+
*
17+
* @param firstLeafPath
18+
* The first leaf path in the virtual tree
19+
* @param lastLeafPath
20+
* The last leaf path in the virtual tree
1521
*/
16-
default void onHashingStarted() {}
22+
default void onHashingStarted(final long firstLeafPath, final long lastLeafPath) {}
1723

1824
/**
1925
* Called after each node is hashed, internal or leaf. This is called between
20-
* {@link #onHashingStarted()} and {@link #onHashingCompleted()}.
26+
* {@link #onHashingStarted(long, long)} and {@link #onHashingCompleted()}.
2127
*
2228
* @param path
2329
* Node path
@@ -28,7 +34,7 @@ default void onNodeHashed(final long path, final Hash hash) {}
2834

2935
/**
3036
* Called after each leaf node on a rank is hashed. This is called between
31-
* {@link #onHashingStarted()} and {@link #onHashingCompleted()}.
37+
* {@link #onHashingStarted(long, long)} and {@link #onHashingCompleted()}.
3238
*
3339
* @param leaf
3440
* A non-null leaf record representing the hashed leaf.

platform-sdk/swirlds-virtualmap/src/main/java/com/swirlds/virtualmap/internal/hash/VirtualHasher.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ public Hash hash(
277277
: ForkJoinPool.commonPool();
278278

279279
// Let the listener know we have started hashing.
280-
listener.onHashingStarted();
280+
listener.onHashingStarted(firstLeafPath, lastLeafPath);
281281

282282
if (!sortedDirtyLeaves.hasNext()) {
283283
// Nothing to hash.

platform-sdk/swirlds-virtualmap/src/main/java/com/swirlds/virtualmap/internal/merkle/AbstractHashListener.java

-216
This file was deleted.

platform-sdk/swirlds-virtualmap/src/main/java/com/swirlds/virtualmap/internal/merkle/FullLeafRehashHashListener.java

-76
This file was deleted.

0 commit comments

Comments
 (0)