data files: add version into meta-header#18226
Conversation
AskAlexSharov
left a comment
There was a problem hiding this comment.
AccountsDomain.History page-level compression enable - it's for another PR
db/seg/compress.go
Outdated
| return err | ||
| } | ||
|
|
||
| if c.featureFlagBitmask&PageLevelCompressionEnabled == PageLevelCompressionEnabled { |
There was a problem hiding this comment.
- add type for
featureFlagBitmaskand add method.Has(flag)for that type featureFlagBitmask uint8- max 8 feature flags - not limiting us too much?compPageValuesCount uint8- 256 keys per page - not limiting us too much?
There was a problem hiding this comment.
at this moment only 3 bits are reserved in bitmask, and we use max 64 values per page, this is why I decided to use uint8 for both types.
We always can upgrade if we need - because we still control version byte.
db/seg/decompress.go
Outdated
| d.version = d.data[0] | ||
|
|
||
| // 1st byte: version, | ||
| // 2nd byte: defines how exactly the file is compressed |
There was a problem hiding this comment.
this comment is valid not for all versions - better move it inside if
db/state/statecfg/state_schema.go
Outdated
| Hist: HistCfg{ | ||
| ValuesTable: kv.TblAccountHistoryVals, | ||
| CompressorCfg: seg.DefaultCfg, Compression: seg.CompressNone, | ||
| CompressorCfg: seg.DefaultCfg.WithValuesOnCompressedPage(16), Compression: seg.CompressNone, |
There was a problem hiding this comment.
AccountsDomain.History page-level compression enable - is for another PR
| Accessors: AccessorHashMap, | ||
|
|
||
| HistoryLargeValues: false, | ||
| HistoryValuesOnCompressedPage: 64, |
There was a problem hiding this comment.
seems this field can be removed - because HistoryCompressCfg.WithValuesOnCompressedPage added. (up to you)
8c964af to
6f6f616
Compare
6f6f616 to
a4cbce4
Compare
Cherry-picked this PR: #18226 and also changed snapshots format version from v1 to v0 in compressor settings because new format will be used as default only since 3.4
This PR changes the internal format of snapshot files, specifically how the files are written to disk:
the first indicates the version, the second is a feature bitmask used during compression of the file.
If the page-level compression flag is enabled, a third additional byte follows the first two bytes in the file. It indicates the compression level — the number of elements per page.