diff options
author | Ferenc Szabo <frncmx@gmail.com> | 2018-11-13 22:22:53 +0800 |
---|---|---|
committer | Anton Evangelatov <anton.evangelatov@gmail.com> | 2018-11-13 22:22:53 +0800 |
commit | c41e1bd1ebf8a625dd22a07c31bcd6837705e0d7 (patch) | |
tree | 8f9414a1f46a9ab95f0544b4d9aa0efce05725bf /swarm/storage/schema.go | |
parent | 4fecc7a3b1b9c51efad47ea128abcb7259158487 (diff) | |
download | dexon-c41e1bd1ebf8a625dd22a07c31bcd6837705e0d7.tar dexon-c41e1bd1ebf8a625dd22a07c31bcd6837705e0d7.tar.gz dexon-c41e1bd1ebf8a625dd22a07c31bcd6837705e0d7.tar.bz2 dexon-c41e1bd1ebf8a625dd22a07c31bcd6837705e0d7.tar.lz dexon-c41e1bd1ebf8a625dd22a07c31bcd6837705e0d7.tar.xz dexon-c41e1bd1ebf8a625dd22a07c31bcd6837705e0d7.tar.zst dexon-c41e1bd1ebf8a625dd22a07c31bcd6837705e0d7.zip |
swarm/storage: fix garbage collector index skew (#18080)
On file access LDBStore's tryAccessIdx() function created a faulty
GC Index Data entry, because not indexing the ikey correctly.
That caused the chunk addresses/hashes to start with '00' and the last
two digits were dropped. => Incorrect chunk address.
Besides the fix, the commit also contains a schema change which will
run the CleanGCIndex() function to clean the GC index from erroneous
entries.
Note: CleanGCIndex() rebuilds the index from scratch which can take
a really-really long time with a huge DB (possibly an hour).
Diffstat (limited to 'swarm/storage/schema.go')
-rw-r--r-- | swarm/storage/schema.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/swarm/storage/schema.go b/swarm/storage/schema.go index fb8498a29..91847ca0f 100644 --- a/swarm/storage/schema.go +++ b/swarm/storage/schema.go @@ -1,6 +1,17 @@ package storage +// The DB schema we want to use. The actual/current DB schema might differ +// until migrations are run. +const CurrentDbSchema = DbSchemaHalloween + +// There was a time when we had no schema at all. +const DbSchemaNone = "" + // "purity" is the first formal schema of LevelDB we release together with Swarm 0.3.5 const DbSchemaPurity = "purity" -const CurrentDbSchema = DbSchemaPurity +// "halloween" is here because we had a screw in the garbage collector index. +// Because of that we had to rebuild the GC index to get rid of erroneous +// entries and that takes a long time. This schema is used for bookkeeping, +// so rebuild index will run just once. +const DbSchemaHalloween = "halloween" |