Skip to content

Stop successor snapshot dispatch once a discontinued backup is restorable - #14724

Open
tclinkenbeard-oai wants to merge 2 commits into
apple:mainfrom
tclinkenbeard-oai:dev/tclinkenbeard/backup-stop-restorable-039
Open

tclinkenbeard-oai wants to merge 2 commits into
apple:mainfrom
tclinkenbeard-oai:dev/tclinkenbeard/backup-stop-restorable-039

Conversation

@tclinkenbeard-oai

Copy link
Copy Markdown
Collaborator

A differential file backup queues the next snapshot as soon as it writes a manifest. If fdbbackup discontinue -w arrives while the first manifest is waiting for log coverage, the log task finishes when that snapshot becomes recoverable. The finalizer still waits for the successor to finish scanning ranges and writing a manifest. This can delay the waiting client for the rest of the snapshot interval.

At the next range dispatch, retire the successor if a stop is pending and the backup has a restore point. The check requires an explicitly stored default mutation log type, whose coverage advances after the copy batch is durable. Join the snapshot completion future to the current batch so any ranges already queued by an earlier dispatch attempt drain before the normal finalizer runs.

Regression

The test writes one key, waits for the first manifest, then overwrites the key and requests discontinue in one transaction while log coverage is pending. It waits for completion, checks that the task and future buckets are empty, restores at the transaction’s exact commit version, and reads back the changed value.

With seed 862407215 and a 120-second successor interval, the control wrote two manifests and finalized 88.16 simulated seconds after log coverage, past the successor target. The fix produced one manifest and finalized 18.06 simulated seconds after coverage. Both restored the requested value.

Validation

  • The new simulation passed with seeds 862407215, 1170476026, 578377136, 17, 52, and 302518574 on the proposed commit.
  • BackupOldAndNewRestore with seed 1170476026 and SharedDefaultBackupCorrectness with seed 578377136 passed with buggify and fault injection enabled.
  • fdbclient_test -f /backup/restore/ passed in native and simulated modes.

@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.

Avoid a GCC 13 internal compiler error when lowering the braced initializer inside the co_await expression. Move the same one-element vector into join.
@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

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos-m1 on macOS

  • Commit ID: 1d72c92
  • Duration 0:23:43
  • 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

  • Commit ID: 1d72c92
  • Duration 0:28: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: 1d72c92
  • Duration 0:29:13
  • 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-arm on Linux RHEL 9

  • Commit ID: 1d72c92
  • Duration 0:48: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 on Linux RHEL 9

  • Commit ID: 1d72c92
  • Duration 0:49:50
  • 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: 1d72c92
  • Duration 1:02: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: 1d72c92
  • Duration 1:35:54
  • 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)

@tclinkenbeard-oai tclinkenbeard-oai left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Generated by Codex.

What problem is this PR trying to solve? (ELI10)

A backup makes a picture of the data and saves a record of later changes. Sometimes it starts the next picture before the record of changes has caught up with the first one. If the user asks the backup to stop in that gap, the first picture can become usable while the backup is still waiting to finish the entire second picture. The PR reports a waiting client taking another 88 simulated seconds after the first picture was usable. Previous continuation · Reported timing

How does this PR solve the problem? (ELI10 and review walkthrough)

Once the first picture is safe to restore, stop scheduling more pieces of its successor. Finish the pieces already handed out, then let the normal completion task close the backup. In the reported run, the successor needed no manifest and the wait after coverage fell to about 18 simulated seconds.

  1. Discontinue sets a stop flag if the backup lacks a restore point. A previously completed manifest can already have scheduled another snapshot. The ordinary log dispatcher advances the log endpoint after the preceding copy batch has finished. Stop request · Successor scheduling · Log copy dependency · Publishing the log endpoint
  2. At a range dispatch, require the stop flag, a completed snapshot, an explicit default log type, and a restorable version. The range-file check requires the exclusive log end to pass the first snapshot. In combined snapshot mode the check includes both snapshot types. Guard · Range-file coverage · Combined coverage
  3. Create or recover the batch’s completion marker before returning early. The finish transaction makes snapshot completion depend on that batch, then releases the dispatcher’s own part. Previously queued ranges keep their outstanding dependencies until they finish. The finalizer waits for both the snapshot and log tasks. Recover the batch · Join and release · Join implementation · Finalizer dependency

What is it trying to do?

Reduce fdbbackup discontinue -w latency when the first manifest becomes restorable after a successor snapshot has started.

Is it correct?

Yes. The check uses durable progress for default logs and excludes missing and partitioned log modes. The finish-time flag defaults to false so an older task without the named parameter follows its existing path. The finalizer still performs its normal cleanup after the joined tasks drain. The new simulation changes the key and requests the stop atomically, restores at that commit version, and checks the value, task buckets and manifest count. Finalizer · Regression setup · Completion and restore assertions

I reviewed the code without running builds, tests or simulations. All 10 currently listed public checks passed on 1d72c920. An earlier run hit the trace-line limit in LowLatencyWithFailures at seed 1407621867. Its configured workloads exercise latency, transactions and machine failure, and the trace gives no causal link to snapshot dispatch. I classify its relevance as inconclusive. Checks at this commit · Simulation attempt

Are there bugs?

I found no correctness bugs in the default-log guard or the completion dependencies. The latency improvement starts at the next dispatch. Its existing schedule and already queued range tasks still determine how long the caller waits. Dispatch schedule

Are there omissions?

The regression disables fault injection and uses one key. It exercises the restore point and the empty-bucket outcome. A dispatcher timing out after queuing ranges, followed by a retry that takes the stop path, is the remaining concurrency case. Test settings · Recovered batch

Are there better ways of doing things?

The existing batch future is the appropriate synchronization mechanism. The dispatch currently reads all shard boundaries before checking the stop flag, so the final dispatch still pays for one metadata scan. Boundary scan

Should this CL be LGTMd?

Yes, LGTM. The public regression checks the actual restored value at the stop transaction’s version. The main residual risk is draining outstanding range tasks when the dispatch itself is retried.

@tclinkenbeard-oai
tclinkenbeard-oai marked this pull request as ready for review December 5, 2026 21:28

This branch has not been deployed

No deployments
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.

2 participants