apple / apple/foundationdb

Remove legacy fdbbackup behavior regarding local directory destinations

Open
#2,470 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
16.7k
Forks
1.6k
Avg merge
1d 20h
Merged PRs (30d)
126

Description

The original fdbbackup tool was meant to take a destination directory which would contain many backups, and to that end it would automatically add a suffix of `/backup-` to whatever destination directory was passed. To keep happy any tests or automation that relied on this behavior, it was not changed. The current backup logic will

a) assume a prefix of `file://` on a backup URL if it begins with a `/`

b) If the (resolved) prefix is `file://` for a backup operation, then a suffix of `/backup-` will be appended.

This has led to confusion for users because it results in a URL used for backup being not the same as the URL required for restore if the prefix is `file://`.

I think we should remove both of these legacy behaviors.

For a), any tool relying on the auto file prefix will immediately fail with an error.
For b), it is a bit trickier, as a backup can be written to any directory but if we add a check to make sure the destination backup container is empty upon start it will at least prevent a second backup from being written to the same directory because of the missing auto-added suffix.

The (somewhat hidden) code which adds the suffix begins here:
https://github.com/apple/foundationdb/blob/master/fdbclient/FileBackupAgent.actor.cpp#L3588

Contributor guide

Open the contributing guide

Research direction

Start at FileBackupAgent.actor.cpp around line 3588 and trace how fdbbackup resolves local destinations and appends the backup-timestamp suffix. Remove the legacy file-prefix and suffix behavior, add the proposed empty-destination safeguard, and verify that backup and restore use the same URL without allowing a second backup in the same directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
databases
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.