From 365b768910868e75fc9ffbbba6954a40603ae1c8 Mon Sep 17 00:00:00 2001 From: Lazy Nina <> Date: Wed, 27 Dec 2023 18:57:46 -0500 Subject: [PATCH 1/4] Don't add to the queue in snapshot.Run for the SnapshotOperationProcessChunk, we already added to the channel GetSnapshot --- lib/snapshot.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/snapshot.go b/lib/snapshot.go index 35f15f663..1c3f96adb 100644 --- a/lib/snapshot.go +++ b/lib/snapshot.go @@ -462,9 +462,6 @@ func (snap *Snapshot) Run() { snap.SnapshotProcessBlock(operation.blockNode) case SnapshotOperationProcessChunk: - // If operationQueueSemaphore is full, we are already storing too many chunks in memory. Block the thread while - // we wait for the queue to clear up. - snap.operationQueueSemaphore <- struct{}{} glog.V(1).Infof("Snapshot.Run: Number of operations in the operation channel (%v)", snap.OperationChannel.GetStatus()) if err := snap.SetSnapshotChunk(operation.mainDb, operation.mainDbMutex, operation.snapshotChunk, From d3e1733166fb43b14eaf8acd2ddf1fd7f638dcf3 Mon Sep 17 00:00:00 2001 From: Lazy Nina <> Date: Wed, 27 Dec 2023 18:57:46 -0500 Subject: [PATCH 2/4] Don't add to the queue in snapshot.Run for the SnapshotOperationProcessChunk, we already added to the channel GetSnapshot --- lib/server.go | 4 +++- lib/snapshot.go | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/server.go b/lib/server.go index c63b2013e..44ff22e5c 100644 --- a/lib/server.go +++ b/lib/server.go @@ -565,7 +565,9 @@ func NewServer( // This can happen if the node was terminated mid-operation last time it was running. The recovery process rolls back // blocks to the beginning of the current snapshot epoch and resets to the state checksum to the epoch checksum. if shouldRestart { - stateChangeSyncer.Reset() + if stateChangeSyncer == nil { + stateChangeSyncer.Reset() + } glog.Errorf(CLog(Red, "NewServer: Forcing a rollback to the last snapshot epoch because node was not closed "+ "properly last time")) if err := _snapshot.ForceResetToLastSnapshot(_chain); err != nil { diff --git a/lib/snapshot.go b/lib/snapshot.go index 35f15f663..1c3f96adb 100644 --- a/lib/snapshot.go +++ b/lib/snapshot.go @@ -462,9 +462,6 @@ func (snap *Snapshot) Run() { snap.SnapshotProcessBlock(operation.blockNode) case SnapshotOperationProcessChunk: - // If operationQueueSemaphore is full, we are already storing too many chunks in memory. Block the thread while - // we wait for the queue to clear up. - snap.operationQueueSemaphore <- struct{}{} glog.V(1).Infof("Snapshot.Run: Number of operations in the operation channel (%v)", snap.OperationChannel.GetStatus()) if err := snap.SetSnapshotChunk(operation.mainDb, operation.mainDbMutex, operation.snapshotChunk, From 05d42d3c958e767681fe4bd76a87c0a5c031ef4b Mon Sep 17 00:00:00 2001 From: Lazy Nina <> Date: Wed, 27 Dec 2023 19:23:31 -0500 Subject: [PATCH 3/4] trigger build From 025b63a30ac5a4030fce4f7375881e35390b29db Mon Sep 17 00:00:00 2001 From: Lazy Nina <> Date: Wed, 27 Dec 2023 19:37:30 -0500 Subject: [PATCH 4/4] fix condition on state change syncer reset --- lib/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/server.go b/lib/server.go index 44ff22e5c..8428c1665 100644 --- a/lib/server.go +++ b/lib/server.go @@ -565,7 +565,7 @@ func NewServer( // This can happen if the node was terminated mid-operation last time it was running. The recovery process rolls back // blocks to the beginning of the current snapshot epoch and resets to the state checksum to the epoch checksum. if shouldRestart { - if stateChangeSyncer == nil { + if stateChangeSyncer != nil { stateChangeSyncer.Reset() } glog.Errorf(CLog(Red, "NewServer: Forcing a rollback to the last snapshot epoch because node was not closed "+