nearcore
nearcore copied to clipboard
Migrate to ValueRefs in DBCol::StateChanges
DBCol::StateChanges basically maps TrieKeys to values. However, the same values are stored in DBCol::State, keyed by hash, and have the same liveness time. So we could dramatically optimise disk space occupied by it by storing value hashes or ValueRefs, which is a common structure inlining the value if its size is small.
Needs to be done if DBCol::StateChanges size spikes. Becomes a bit more actual after https://github.com/near/nearcore/pull/10903.
Can be tracked at "mainnet cold db size" dashboard: https://nearinc.grafana.net/goto/UU7VYNbIR?orgId=1