From 7aa1e91e418f946479603bf2ea130199de0d41de Mon Sep 17 00:00:00 2001 From: Delweng Date: Thu, 2 Mar 2023 10:09:16 +0800 Subject: [PATCH 1/3] core/state: no need to prune block reserved = ancient Signed-off-by: Delweng --- core/state/pruner/pruner.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/state/pruner/pruner.go b/core/state/pruner/pruner.go index 1555852d03..f7f135ca46 100644 --- a/core/state/pruner/pruner.go +++ b/core/state/pruner/pruner.go @@ -378,8 +378,11 @@ func (p *BlockPruner) backUpOldDb(name string, cache, handles int, namespace str // If the items in freezer is less than the block amount that we want to reserve, it is not enough, should stop. if itemsOfAncient < p.BlockAmountReserved { - log.Error("the number of old blocks is not enough to reserve,", "ancient items", itemsOfAncient, "the amount specified", p.BlockAmountReserved) + log.Error("the number of old blocks is not enough to reserve", "ancient items", itemsOfAncient, "the amount specified", p.BlockAmountReserved) return errors.New("the number of old blocks is not enough to reserve") + } else if itemsOfAncient == p.BlockAmountReserved { + log.Error("the number of old blocks is the same to be reserved", "ancient items", itemsOfAncient, "the amount specified", p.BlockAmountReserved) + return errors.New("the number of old blocks is the same to be reserved") } var oldOffSet uint64 From ae7044948a33325721d258e3007dc780077a49f5 Mon Sep 17 00:00:00 2001 From: Delweng Date: Thu, 2 Mar 2023 10:13:36 +0800 Subject: [PATCH 2/3] Revert "core/state: no need to prune block This reverts commit 1bbd4b8605e54b2cefdf1e4c5a5509c0dd3faaba. Signed-off-by: Delweng --- core/state/pruner/pruner.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/state/pruner/pruner.go b/core/state/pruner/pruner.go index f7f135ca46..1555852d03 100644 --- a/core/state/pruner/pruner.go +++ b/core/state/pruner/pruner.go @@ -378,11 +378,8 @@ func (p *BlockPruner) backUpOldDb(name string, cache, handles int, namespace str // If the items in freezer is less than the block amount that we want to reserve, it is not enough, should stop. if itemsOfAncient < p.BlockAmountReserved { - log.Error("the number of old blocks is not enough to reserve", "ancient items", itemsOfAncient, "the amount specified", p.BlockAmountReserved) + log.Error("the number of old blocks is not enough to reserve,", "ancient items", itemsOfAncient, "the amount specified", p.BlockAmountReserved) return errors.New("the number of old blocks is not enough to reserve") - } else if itemsOfAncient == p.BlockAmountReserved { - log.Error("the number of old blocks is the same to be reserved", "ancient items", itemsOfAncient, "the amount specified", p.BlockAmountReserved) - return errors.New("the number of old blocks is the same to be reserved") } var oldOffSet uint64 From d0539a4997d63a9d515dd3a536c5a2635834d519 Mon Sep 17 00:00:00 2001 From: Delweng Date: Thu, 2 Mar 2023 10:16:19 +0800 Subject: [PATCH 3/3] core/state: no need to prune block if the same Signed-off-by: Delweng --- core/state/pruner/pruner.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/state/pruner/pruner.go b/core/state/pruner/pruner.go index 1555852d03..f7f135ca46 100644 --- a/core/state/pruner/pruner.go +++ b/core/state/pruner/pruner.go @@ -378,8 +378,11 @@ func (p *BlockPruner) backUpOldDb(name string, cache, handles int, namespace str // If the items in freezer is less than the block amount that we want to reserve, it is not enough, should stop. if itemsOfAncient < p.BlockAmountReserved { - log.Error("the number of old blocks is not enough to reserve,", "ancient items", itemsOfAncient, "the amount specified", p.BlockAmountReserved) + log.Error("the number of old blocks is not enough to reserve", "ancient items", itemsOfAncient, "the amount specified", p.BlockAmountReserved) return errors.New("the number of old blocks is not enough to reserve") + } else if itemsOfAncient == p.BlockAmountReserved { + log.Error("the number of old blocks is the same to be reserved", "ancient items", itemsOfAncient, "the amount specified", p.BlockAmountReserved) + return errors.New("the number of old blocks is the same to be reserved") } var oldOffSet uint64