DD: config-driven bounded-time rollback of shard-encoded location metadata - #13752
DD: config-driven bounded-time rollback of shard-encoded location metadata#13752saintstack wants to merge 2 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
gxglass
left a comment
There was a problem hiding this comment.
Initial review attached. Haven't looked closely here, probably should since there is a lot going on
| 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. |
There was a problem hiding this comment.
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}]``. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
|
@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) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…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.
|
Rebase. Reran joshua: |
bnamasivayam
left a comment
There was a problem hiding this comment.
The user facing commands part of this PR looks good to me.
Result of foundationdb-pr-clang-arm on Linux RHEL 9
|
Result of foundationdb-pr-clang-ide on Linux RHEL 9
|
Result of foundationdb-pr on Linux RHEL 9
|
Result of foundationdb-pr-clang on Linux RHEL 9
|
Result of foundationdb-pr-cluster-tests on Linux RHEL 9
|
Result of foundationdb-pr-macos-m1 on macOS 14.x
|
Result of foundationdb-pr-macos on macOS 14.x
|
(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_encodingROLLBACK 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 knobis 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=originalwith 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):
is safe only at ROLLBACK COMPLETE with the target binary deployed
SHARD_ENCODE_LOCATION_METADATA=false.
(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: