Skip to content

DD: config-driven bounded-time rollback of shard-encoded location metadata - #13752

Open
saintstack wants to merge 2 commits into
apple:mainfrom
saintstack:rollback
Open

DD: config-driven bounded-time rollback of shard-encoded location metadata#13752
saintstack wants to merge 2 commits into
apple:mainfrom
saintstack:rollback

Conversation

@saintstack

@saintstack saintstack commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

(Rewrite of the description after a request to move this PR to be totally configuration based which makes the PR better but meant more change. Intent is to backport this to 7.4.)

Rolling SHARD_ENCODE_LOCATION_METADATA true->false could not reach
audit_storage metadata_encoding ROLLBACK COMPLETE in bounded time:
converged and "safe to downgrade binary" was unverifiable short of a
storage wiggle (hours-to-days). This adds an opt-in, bounded-time DD-init
rewrite that converges existing keyServers AND serverKeys back to old
format and clears DataMoveMetaData, driven by two new DatabaseConfiguration
options:

configure shard_metadata_format = original | encoded (target format)
configure shard_metadata_migration = enabled | disabled (run rewrite)

Config is the source of truth for DD's encoding target, resolved once at
init as shard_metadata_format ?? SHARD_ENCODE_LOCATION_METADATA (the knob
is only the fallback when the config is UNSET) and used across all DD
write/move paths -- so a rollback is driven by configure shard_metadata_format=original with no knob flip and no process restart
(the configure triggers a recovery that re-inits DD). Deploying the binary
is a byte-identical no-op until an operator opts in. A completion sentinel
records ROLLBACK COMPLETE and fast-paths later inits. serverKeys are
rewritten serially per storage server, so rewrite time scales with cluster
size (minutes typically); progress is visible via DDShardEncode* trace
events and the audit.

Caveats (details in design/shard-encode-location-metadata.md and
documentation/sphinx/source/command-line-interface.rst):

  • Binary downgrade: a pre-config binary reads only the knob, so downgrade
    is safe only at ROLLBACK COMPLETE with the target binary deployed
    SHARD_ENCODE_LOCATION_METADATA=false.
  • Known limitation: large teams (ddLargeTeamEnabled) and physical shard
    (ENABLE_DD_PHYSICAL_SHARD), mutually exclusive with shard encoding, still
    read the raw knob, not the config. Once shard_metadata_format is set,
    don't move the knob except for a downgrade.

Tested: sim tests/fast/ShardEncodeRollback.toml (knob-fallback path) and
tests/fast/ShardEncodeRollbackConfig.toml (config-only, no knob flip), each
passing a 100,000-run joshua ensemble; plus a live-cluster
forward->rollback->re-forward under mako load with DD-pod kills
(test_shardencode_rollover_load, fdb-kubernetes-tests).

Builds on #13310 (SHARD_ENCODE_LOCATION_METADATA audit + rollback support).
Depends on #13670 (audit_storage counting fix, merged) to observe ROLLBACK
COMPLETE.

Here are two test runs. The first is just exercising the new test. The second is all joshua tests:

  20260724-183324-stack-pr2-shardencode-rollb-24db56d8fdb29f9d compressed=True data_size=38355992 duration=16719145 ended=100000 fail_fast=10 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=1:19:43 sanity=False started=100000 stopped=20260724-195307 submitted=20260724-183324 timeout=5400 username=stack-pr2-shardencode-rollback-rewrite-single
  20260724-183332-stack-pr2-shardencode-rollb-1ff9ed3b7402c6ee compressed=True data_size=38345170 duration=3530901 ended=100000 fail_fast=10 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=0:35:21 sanity=False started=100000 stopped=20260724-190853 submitted=20260724-183332 timeout=5400 username=stack-pr2-shardencode-rollback-rewrite-all

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@gxglass gxglass left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial review attached. Haven't looked closely here, probably should since there is a lot going on

pr-13752-review.md

shard-location metadata (``\xff/keyServers/`` and ``\xff/serverKeys/``)
between the legacy tag-based encoding and the newer UID+dataMoveId
encoding introduced with ``SHARD_ENCODE_LOCATION_METADATA``. The pair
mirrors the ``storage_engine`` + ``perpetual_storage_wiggle`` pattern.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the mirrored pattern is storage_engine + storage_migration_type

---------

The ``configure`` command changes the database configuration. Its syntax is ``configure [new|tss] [single|double|triple|three_data_hall|three_datacenter] [ssd|memory] [grv_proxies=<N>] [commit_proxies=<N>] [resolvers=<N>] [logs=<N>] [count=<TSS_COUNT>] [perpetual_storage_wiggle=<WIGGLE_SPEED>] [perpetual_storage_wiggle_locality=<<LOCALITY_KEY>:<LOCALITY_VALUE>|0>] [perpetual_storage_wiggle_engine=<ENGINE>] [storage_migration_type={disabled|aggressive|gradual}]``.
The ``configure`` command changes the database configuration. Its syntax is ``configure [new|tss] [single|double|triple|three_data_hall|three_datacenter] [ssd|memory] [grv_proxies=<N>] [commit_proxies=<N>] [resolvers=<N>] [logs=<N>] [count=<TSS_COUNT>] [perpetual_storage_wiggle=<WIGGLE_SPEED>] [perpetual_storage_wiggle_locality=<<LOCALITY_KEY>:<LOCALITY_VALUE>|0>] [perpetual_storage_wiggle_engine=<ENGINE>] [storage_migration_type={disabled|aggressive|gradual}] [shard_metadata_format={old_format|new_format}] [shard_metadata_migration={enabled|disabled}]``.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the format should have a more qualified name like {tag-based-format | uuid-based-format}

the next DD does a full scan and converges.

The rollback procedure (with active rewrite):
1. Set `SHARD_ENCODE_LOCATION_METADATA=false` and restart the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping this knob around makes this logic brittle. Knob rollouts are not synchronous and different processes can have different values for knobs during the rollout. I think this feature is better to be controlled only by config variables.

@saintstack saintstack Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nod. In this case I think we'd be fine since its just the DD that is the reader.

Offline, you argued we should leave the knob behind and move it all over to a configuration instead. The commit message has my reasoning on why I avoided making this transition in a point release (fatter patch with changes in core read/write path) but let me put up a patch that is pure configuration. No harm.

Thanks for the review B

@saintstack

saintstack commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

pr-13752-review.md

@gxglass Does the link work for you (404 for me)? Maybe wait and regen after I put up next patch because a bunch of change after chat w/ Bala #13752 (comment) (Thanks for review)

@saintstack saintstack changed the title DD: bounded-time rollback of shard-encoded location metadata DD: config-driven bounded-time rollback of shard-encoded location metadata Jul 25, 2026
@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

michael stack added 2 commits August 14, 2026 09:01
…adata

Rolling SHARD_ENCODE_LOCATION_METADATA true->false could not reach
`audit_storage metadata_encoding` ROLLBACK COMPLETE in bounded time:
converged and "safe to downgrade binary" was unverifiable short of a
storage wiggle (hours-to-days). This adds an opt-in, bounded-time DD-init
rewrite that converges existing keyServers AND serverKeys back to old
format and clears DataMoveMetaData, driven by two new DatabaseConfiguration
options:

  configure shard_metadata_format    = original | encoded   (target format)
  configure shard_metadata_migration = enabled | disabled   (run rewrite)

Config is the source of truth for DD's encoding target, resolved once at
init as `shard_metadata_format ?? SHARD_ENCODE_LOCATION_METADATA` (the knob
is only the fallback when the config is UNSET) and used across all DD
write/move paths -- so a rollback is driven by `configure
shard_metadata_format=original` with no knob flip and no process restart
(the configure triggers a recovery that re-inits DD). Deploying the binary
is a byte-identical no-op until an operator opts in. A completion sentinel
records ROLLBACK COMPLETE and fast-paths later inits. serverKeys are
rewritten serially per storage server, so rewrite time scales with cluster
size (minutes typically); progress is visible via DDShardEncode* trace
events and the audit.

Caveats (details in design/shard-encode-location-metadata.md and
documentation/sphinx/source/command-line-interface.rst):
- Binary downgrade: a pre-config binary reads only the knob, so downgrade
  is safe only at ROLLBACK COMPLETE with the target binary deployed
  SHARD_ENCODE_LOCATION_METADATA=false.
- Known limitation: large teams (ddLargeTeamEnabled) and physical shard
  (ENABLE_DD_PHYSICAL_SHARD), mutually exclusive with shard encoding, still
  read the raw knob, not the config. Once shard_metadata_format is set,
  don't move the knob except for a downgrade.

Tested: sim tests/fast/ShardEncodeRollback.toml (knob-fallback path) and
tests/fast/ShardEncodeRollbackConfig.toml (config-only, no knob flip), each
passing a 100,000-run joshua ensemble; plus a live-cluster
forward->rollback->re-forward under mako load with DD-pod kills
(test_shardencode_rollover_load, fdb-kubernetes-tests).

Builds on apple#13310 (SHARD_ENCODE_LOCATION_METADATA audit + rollback support).
Depends on apple#13670 (audit_storage counting fix, merged) to observe ROLLBACK
COMPLETE.
@saintstack

Copy link
Copy Markdown
Contributor Author

Rebase. Reran joshua: 20260814-162701-stack_rebase-d082f3fbaf691bb5 compressed=True data_size=38650374 duration=3696370 ended=100000 fail_fast=10 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=0:32:49 sanity=False started=100000 stopped=20260814-165950 submitted=20260814-162701 timeout=5400 username=stack_rebase

@bnamasivayam bnamasivayam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user facing commands part of this PR looks good to me.

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-arm on Linux RHEL 9

  • Commit ID: 3c1a0ef
  • Duration 0:46:47
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-ide on Linux RHEL 9

  • Commit ID: 3c1a0ef
  • Duration 0:52:53
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr on Linux RHEL 9

  • Commit ID: 3c1a0ef
  • Duration 1:15:19
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux RHEL 9

  • Commit ID: 3c1a0ef
  • Duration 1:26:41
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-cluster-tests on Linux RHEL 9

  • Commit ID: 3c1a0ef
  • Duration 1:31:24
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos-m1 on macOS 14.x

  • Commit ID: 3c1a0ef
  • Duration 2:18:42
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos on macOS 14.x

  • Commit ID: 3c1a0ef
  • Duration 4:54:36
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

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.

4 participants