Skip to content

Commit e41dc12

Browse files
authored
Update pebble db to latest format by default (#10720)
* 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.
1 parent 40a7a38 commit e41dc12

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

docs/changelogs/v0.34.md

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- [RPC and CLI command changes](#rpc-and-cli-command-changes)
1010
- [Bitswap improvements from Boxo](#bitswap-improvements-from-boxo)
1111
- [IPFS_LOG_LEVEL deprecated](#ipfs_log_level-deprecated)
12+
- [Pebble datastore format upgrade](#pebble_datastore_format_update)
1213
- [👨‍👩‍👧‍👦 Contributors](#-contributors)
1314

1415
### Overview
@@ -29,4 +30,9 @@ This release includes performance and reliability improvements and fixes for min
2930

3031
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.
3132

33+
#### Pebble datastore format update
34+
35+
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.
36+
37+
3238
### 👨‍👩‍👧‍👦 Contributors

plugin/plugins/pebbleds/pebbleds.go

+13-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ func (*pebbledsPlugin) DatastoreConfigParser() fsrepo.ConfigFromMap {
7272
if err != nil {
7373
return nil, err
7474
}
75+
fmv, err := getConfigInt("formatMajorVersion", params)
76+
if err != nil {
77+
return nil, err
78+
}
79+
formatMajorVersion := pebble.FormatMajorVersion(fmv)
7580
l0CompactionThreshold, err := getConfigInt("l0CompactionThreshold", params)
7681
if err != nil {
7782
return nil, err
@@ -105,10 +110,17 @@ func (*pebbledsPlugin) DatastoreConfigParser() fsrepo.ConfigFromMap {
105110
return nil, err
106111
}
107112

108-
if bytesPerSync != 0 || disableWAL || l0CompactionThreshold != 0 || l0StopWritesThreshold != 0 || lBaseMaxBytes != 0 || maxConcurrentCompactions != 0 || memTableSize != 0 || memTableStopWritesThreshold != 0 || walBytesPerSync != 0 || walMinSyncSec != 0 {
113+
// Use latest version by default. This will ensure that format is
114+
// compatible across database upgrades.
115+
if formatMajorVersion == 0 {
116+
formatMajorVersion = pebble.FormatNewest
117+
}
118+
119+
if bytesPerSync != 0 || disableWAL || formatMajorVersion != 0 || l0CompactionThreshold != 0 || l0StopWritesThreshold != 0 || lBaseMaxBytes != 0 || maxConcurrentCompactions != 0 || memTableSize != 0 || memTableStopWritesThreshold != 0 || walBytesPerSync != 0 || walMinSyncSec != 0 {
109120
c.pebbleOpts = &pebble.Options{
110121
BytesPerSync: bytesPerSync,
111122
DisableWAL: disableWAL,
123+
FormatMajorVersion: formatMajorVersion,
112124
L0CompactionThreshold: l0CompactionThreshold,
113125
L0StopWritesThreshold: l0StopWritesThreshold,
114126
LBaseMaxBytes: int64(lBaseMaxBytes),

0 commit comments

Comments
 (0)