Skip to content

Update pebble db to latest format by default #10720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/changelogs/v0.34.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
14 changes: 13 additions & 1 deletion plugin/plugins/pebbleds/pebbleds.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down
Loading