diff --git a/nimbus/db/aristo/aristo_init/rocks_db.nim b/nimbus/db/aristo/aristo_init/rocks_db.nim index f65f867a4..c1f69dcc5 100644 --- a/nimbus/db/aristo/aristo_init/rocks_db.nim +++ b/nimbus/db/aristo/aristo_init/rocks_db.nim @@ -147,7 +147,14 @@ proc getIdgFn(db: RdbBackendRef): GetIdgFn = return ok w # Compiler error with `ok(EmptyVidSeq)` # Decode data record - data.deblobify seq[VertexID] + # TODO vid reuse disabled, implementation too slow since list could have + # millions of entries + data.deblobify(seq[VertexID]).map(proc (v: seq[VertexID]): seq[VertexID] = + if v.len > 1: + @[v[^1]] + else: + v + ) proc getLstFn(db: RdbBackendRef): GetLstFn = result = diff --git a/nimbus/db/aristo/aristo_vid.nim b/nimbus/db/aristo/aristo_vid.nim index f77bee00c..adba964cb 100644 --- a/nimbus/db/aristo/aristo_vid.nim +++ b/nimbus/db/aristo/aristo_vid.nim @@ -45,19 +45,6 @@ proc vidFetch*(db: AristoDbRef; pristine = false): VertexID = doAssert LEAST_FREE_VID <= result.distinctBase -proc vidPeek*(db: AristoDbRef): VertexID = - ## Like `new()` without consuming this *ID*. It will return the *ID* that - ## would be returned by the `new()` function. - ## - case db.vGen.len: - of 0: - VertexID(LEAST_FREE_VID) - of 1: - db.vGen[^1] - else: - db.vGen[^2] - - proc vidDispose*(db: AristoDbRef; vid: VertexID) = ## Recycle the argument `vtxID` which is useful after deleting entries from ## the vertex table to prevent the `VertexID` type key values small. @@ -69,10 +56,13 @@ proc vidDispose*(db: AristoDbRef; vid: VertexID) = let topID = db.vGen[^1] # Only store smaller numbers: all numberts larger than `topID` # are free numbers - if vid < topID: + # TODO vid reuse disabled, implementation too slow since list could grow + # to millions of entries + # if vid < topID: + # db.top.final.vGen[^1] = vid + # db.top.final.vGen.add topID + if vid == topID - 1: # no gap - can recycle db.top.final.vGen[^1] = vid - db.top.final.vGen.add topID - proc vidReorg*(vGen: seq[VertexID]): seq[VertexID] = ## Return a compacted version of the argument vertex ID generator state