Skip to content

docs: clearer datastore layouts and init errors - #11449

Draft
lidel wants to merge 2 commits into
masterfrom
feat/pebbleds-flatfs-profile
Draft

docs: clearer datastore layouts and init errors#11449
lidel wants to merge 2 commits into
masterfrom
feat/pebbleds-flatfs-profile

Conversation

@lidel

@lidel lidel commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Just docs, better error handling and tests, nothing interesting.

Problem

Keeping flatfs for blocks with pebble instead of leveldb meant hand-writing Datastore.Spec, and nothing said the default flatfs profile stores pins, MFS, and provider records in leveldb. Setting the flatfs shard depth had traps of its own: ipfs init accepted ipfs config show output and built a repo that panics on start, a typo in shardFunc left a half-made repo, and a hand-edited spec failed with its two values mislabeled.

Fix

  • new flatfs-pebbleds profile (plus -measure); the default layout is now flatfs-levelds, with flatfs and flatfs-measure as aliases; pebble profiles are marked experimental, -measure ones as overhead
  • ipfs init refuses a config without a private key and validates Datastore.Spec before writing; ipfs config profile apply refuses layout changes; the mismatch error is labeled correctly and says the layout is fixed at init
  • docs explain why flatfs holds only blocks1, when next-to-last/3 is worth it, and how to set it or move a repo

Defaults are unchanged. Out of scope: re-sharding an existing repo in place.

Closes #11423

Related: #11186, the badgerds migration text now points at flatfs-pebbleds; #11435, one reason the pebble profiles stay labeled experimental.

Footnotes

  1. go-ds-flatfs restrictions: content-addressed keys only, first-successful-writer-wins on concurrent writes, file-name-restricted keys.

Profile names and docs now say which store holds what: 'flatfs-levelds'
(blocks in flatfs, everything else in leveldb) is the canonical name of
the default layout, with 'flatfs' and 'flatfs-measure' kept as aliases.
'flatfs-pebbleds' and its '-measure' twin name the flatfs plus pebble
layout that otherwise needs a hand-written Datastore.Spec.

- docs: why flatfs holds only blocks, measure overhead note,
  Datastore.Spec example, profile sections
- cmd/ipfs: datastore paragraph in 'ipfs init --help'
- config: spec functions named after the profiles they back
- test/cli: layout on disk, restart, aliases, default, measure metrics
- test/sharness: profiles added to t0025

Closes #11423
The flatfs shard depth can only be set when a repo is created, by
passing a config file to 'ipfs init', and that route had traps.

- init: refuse a config without Identity.PrivKey ('ipfs config show'
  output) on both 'ipfs init <file>' and 'ipfs daemon --init', and
  validate Datastore.Spec before writing anything
- config profile apply: refuse profiles that change the on-disk layout
- fsrepo: mismatch error labels config and datastore_spec correctly
  and says the layout is fixed at init
- docs: why and when to use next-to-last/3, the config-file procedure,
  migration by moving data to a new repo
@lidel lidel mentioned this pull request Sep 3, 2026
62 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add config profile for pebbleds and flatfs datastore

1 participant