From ef864ba167e6e92cac0a4582e80757196cbc91fc Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Sat, 1 Jun 2024 17:14:54 +0200 Subject: [PATCH] disable vid reuse compaction (#2276) The current implementation cannot be used practically since it causes several full reallocations of the whole free list per deletion - it needs to be reimplemented, or the chain cannot practically progress beyond ~2.5M blocks where a lot of removals happen. Co-authored-by: tersec --- nimbus/db/aristo/aristo_delete.nim | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/nimbus/db/aristo/aristo_delete.nim b/nimbus/db/aristo/aristo_delete.nim index 2c45738b0..6a59c6ba9 100644 --- a/nimbus/db/aristo/aristo_delete.nim +++ b/nimbus/db/aristo/aristo_delete.nim @@ -300,8 +300,13 @@ proc delSubTreeImpl( db.layersPutVtx(VertexID(1), wp.vid, leaf) db.layersResKey(VertexID(1), wp.vid) - # Squeze list of recycled vertex IDs - db.top.final.vGen = db.vGen.vidReorg() + # Squeeze list of recycled vertex IDs + # TODO this causes a reallocation of vGen which slows down subsequent + # additions to the list because the sequence must grow which entails a + # full copy in addition to this reorg itself - around block 2.5M this + # causes significant slowdown as the vid list is >1M entries long + # See also EIP-161 which is why there are so many deletions + # db.top.final.vGen = db.vGen.vidReorg() ok() @@ -393,8 +398,13 @@ proc deleteImpl( db.layersPutVtx(VertexID(1), wp.vid, leaf) db.layersResKey(VertexID(1), wp.vid) - # Squeze list of recycled vertex IDs - db.top.final.vGen = db.vGen.vidReorg() + # Squeeze list of recycled vertex IDs + # TODO this causes a reallocation of vGen which slows down subsequent + # additions to the list because the sequence must grow which entails a + # full copy in addition to this reorg itself - around block 2.5M this + # causes significant slowdown as the vid list is >1M entries long + # See also EIP-161 which is why there are so many deletions``` + # db.top.final.vGen = db.vGen.vidReorg() ok(emptySubTreeOk) # ------------------------------------------------------------------------------