Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RocksDBException: Busy during snapsync #7745

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Stream;

import org.apache.tuweni.bytes.Bytes;
Expand All @@ -44,7 +45,7 @@ public abstract class TrieNodeHealingRequest extends SnapDataRequest
private final Bytes location;
protected Bytes data;

protected boolean requiresPersisting = true;
protected AtomicBoolean requiresPersisting = new AtomicBoolean(true);

protected TrieNodeHealingRequest(final Hash nodeHash, final Hash rootHash, final Bytes location) {
super(TRIE_NODE, rootHash);
Expand All @@ -65,7 +66,7 @@ public int persist(
return 0;
}
int saved = 0;
if (requiresPersisting) {
if (requiresPersisting.getAndSet(false)) {
checkNotNull(data, "Must set data before node can be persisted.");
saved =
doPersist(
Expand Down Expand Up @@ -143,7 +144,7 @@ public boolean isExpired(final SnapSyncProcessState snapSyncState) {
}

public boolean isRequiresPersisting() {
return requiresPersisting;
return requiresPersisting.get();
}

public Bytes32 getNodeHash() {
Expand Down Expand Up @@ -173,7 +174,7 @@ public void setData(final Bytes data) {
}

public void setRequiresPersisting(final boolean requiresPersisting) {
this.requiresPersisting = requiresPersisting;
this.requiresPersisting.set(requiresPersisting);
}

private boolean nodeIsHashReferencedDescendant(final Node<Bytes> node) {
Expand Down
Loading