Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make backups openable as read-only DBs #8142

Closed
wants to merge 5 commits into from

Commits on Apr 1, 2021

  1. Make backups openable as read-only DBs

    Summary: A current limitation of backups is that you don't know the
    exact database state of when the backup was taken. With this new
    feature, you can at least inspect the backup's DB state without
    restoring it by opening it as a read-only DB.
    
    Rather than add something like OpenAsReadOnlyDB to the BackupEngine API,
    which would inhibit opening stackable DB implementations read-only
    (if/when their APIs support it), we instead provide a DB name and Env
    that can be used to open as a read-only DB.
    
    Possible follow-up work:
    
    * Add a version of GetBackupInfo for a single backup.
    * Let CreateNewBackup return the BackupID of the newly-created backup.
    
    Implementation details:
    
    Refactored ChrootFileSystem to split off new base class RemapFileSystem,
    which allows more general remapping of files. We use this base class to
    implement BackupEngineImpl::RemapSharedFileSystem.
    
    To minimize API impact, I decided to just add these fields name_for_open
    and env_for_open to those set by GetBackupInfo when
    include_file_details=true. Creating the RemapSharedFileSystem adds a bit
    to the memory consumption, perhaps unnecessarily in some cases, but this
    has been mitigated by (a) only initialize the RemapSharedFileSystem
    lazily when GetBackupInfo with include_file_details=true is called, and
    (b) using the existing shared_ptr<FileInfo> objects to hold most of the
    mapping data.
    
    To enhance API safety, RemapSharedFileSystem is wrapped by new
    ReadOnlyFileSystem which rejects any attempts to write. This uncovered a
    couple of places in which DB::OpenForReadOnly would write to the
    filesystem, so I fixed these. Added a release note because this affects
    logging.
    
    Additional minor refactoring in backupable_db.cc to support the new
    functionality.
    
    Test Plan: new test (run with ASAN and UBSAN), added to stress test and
    ran it for a while with amplified backup_one_in
    pdillinger committed Apr 1, 2021
    Configuration menu
    Copy the full SHA
    5453846 View commit details
    Browse the repository at this point in the history
  2. oops

    pdillinger committed Apr 1, 2021
    Configuration menu
    Copy the full SHA
    5f6221e View commit details
    Browse the repository at this point in the history

Commits on Apr 2, 2021

  1. Fix ASC

    pdillinger committed Apr 2, 2021
    Configuration menu
    Copy the full SHA
    7555667 View commit details
    Browse the repository at this point in the history

Commits on Apr 6, 2021

  1. Configuration menu
    Copy the full SHA
    adb1511 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3324c92 View commit details
    Browse the repository at this point in the history