Update pebble db to latest format by default (#10720)
Some checks are pending
CodeQL / codeql (push) Waiting to run
Docker Build / docker-build (push) Waiting to run
Gateway Conformance / gateway-conformance (push) Waiting to run
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Waiting to run
Go Build / go-build (push) Waiting to run
Go Check / go-check (push) Waiting to run
Go Lint / go-lint (push) Waiting to run
Go Test / go-test (push) Waiting to run
Interop / interop-prep (push) Waiting to run
Interop / helia-interop (push) Blocked by required conditions
Interop / ipfs-webui (push) Blocked by required conditions
Sharness / sharness-test (push) Waiting to run
Spell Check / spellcheck (push) Waiting to run

* Update pebble db to latest format by default

If the pebble database format is not explicitly set in the config, then set it to the latest format version by default. This will ensure that the database format is sufficiently up-to-date to be compatible with a major version upgrade of pebble.
This commit is contained in:
Andrew Gillis 2025-02-17 13:32:53 -10:00 committed by GitHub
parent 40a7a388a4
commit e41dc120f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 1 deletions

View File

@ -9,6 +9,7 @@
- [RPC and CLI command changes](#rpc-and-cli-command-changes)
- [Bitswap improvements from Boxo](#bitswap-improvements-from-boxo)
- [IPFS_LOG_LEVEL deprecated](#ipfs_log_level-deprecated)
- [Pebble datastore format upgrade](#pebble_datastore_format_update)
- [👨‍👩‍👧‍👦 Contributors](#-contributors)
### Overview
@ -29,4 +30,9 @@ This release includes performance and reliability improvements and fixes for min
The variable has been deprecated. Please use [`GOLOG_LOG_LEVEL`](https://github.com/ipfs/kubo/blob/master/docs/environment-variables.md#golog_log_level) instead for configuring logging levels.
#### Pebble datastore format update
If the pebble database format is not explicitly set in the config, then automatically upgrade it to the latest format version supported by the release ob pebble used by kubo. This will ensure that the database format is sufficiently up-to-date to be compatible with a major version upgrade of pebble. This is necessary before upgrading to use pebble v2.
### 👨‍👩‍👧‍👦 Contributors

View File

@ -72,6 +72,11 @@ func (*pebbledsPlugin) DatastoreConfigParser() fsrepo.ConfigFromMap {
if err != nil {
return nil, err
}
fmv, err := getConfigInt("formatMajorVersion", params)
if err != nil {
return nil, err
}
formatMajorVersion := pebble.FormatMajorVersion(fmv)
l0CompactionThreshold, err := getConfigInt("l0CompactionThreshold", params)
if err != nil {
return nil, err
@ -105,10 +110,17 @@ func (*pebbledsPlugin) DatastoreConfigParser() fsrepo.ConfigFromMap {
return nil, err
}
if bytesPerSync != 0 || disableWAL || l0CompactionThreshold != 0 || l0StopWritesThreshold != 0 || lBaseMaxBytes != 0 || maxConcurrentCompactions != 0 || memTableSize != 0 || memTableStopWritesThreshold != 0 || walBytesPerSync != 0 || walMinSyncSec != 0 {
// Use latest version by default. This will ensure that format is
// compatible across database upgrades.
if formatMajorVersion == 0 {
formatMajorVersion = pebble.FormatNewest
}
if bytesPerSync != 0 || disableWAL || formatMajorVersion != 0 || l0CompactionThreshold != 0 || l0StopWritesThreshold != 0 || lBaseMaxBytes != 0 || maxConcurrentCompactions != 0 || memTableSize != 0 || memTableStopWritesThreshold != 0 || walBytesPerSync != 0 || walMinSyncSec != 0 {
c.pebbleOpts = &pebble.Options{
BytesPerSync: bytesPerSync,
DisableWAL: disableWAL,
FormatMajorVersion: formatMajorVersion,
L0CompactionThreshold: l0CompactionThreshold,
L0StopWritesThreshold: l0StopWritesThreshold,
LBaseMaxBytes: int64(lBaseMaxBytes),