Commit Graph

487 Commits

Author SHA1 Message Date
Akanksha Mahajan bdcd9a292a
Design changes to pass encryption_block_size to fdbbackup command and remove knob (#13126) (#13205)
(cherry picked from commit df1c404fef)
2026-05-15 09:58:04 -07:00
neethuhaneesha 93cc06904f
Adding mutation log type configuration to backup. (#13127) 2026-05-07 12:01:01 -07:00
Michael Stack 431e7c952d
Cherrypick Add restore validation feature: restores to special keyspace allowing validating backup/restore in single cluster (space willing) (#12573) (#12648)
* Add restore validation feature: restores to special keyspace allowing validating backup/restore in single cluster (space willing) (#12573)

* Add restore validation feature with simplified backup gap fix

Implements restore validation using audit_storage to verify backup/restore
correctness. Includes a minimal fix for the backup gap bug.

Key components:
- ValidateRestore audit type: compares source keys against restored keys
  at \xff\x02/rlog/ prefix in storage server
- DD audit fixes: propagate validation errors, handle DD failover correctly
- RestoreValidation and BackupAndRestoreValidation workloads for testing
- Simplified backup gap fix: prevent snapshot from finishing in the same
  iteration it dispatches the last tasks (single flag + one check)

* No faultInjection in 7.4

* Make it so no encryption when the restore validation test runs

* Add error_code_audit_storage_task_outdated to bypass list rather than do special-case handling

---------

Co-authored-by: michael stack <stack@duboce.com>
2026-01-22 13:41:34 -08:00
Jingyu Zhou 0f40b5d190
Fix a restore stuck bug (#12433)
readLogData() may encounter an error but the caller is not waiting on the Future.
As a result, the caller waiting on the PromiseStream will become stuck. The fix
is to send the error to the PromiseStream.

Another fix is to call taskBucket->keepRunning() in writeMutations(), which is
part of the work in _execute().

20251009-164341-jzhou-9217f131839ff7a4
2025-10-10 09:18:27 -07:00
neethuhaneesha 61d287bec5
Decode range file interpreting keys and values bug fix. (#12420) 2025-10-05 10:35:49 -07:00
Akanksha Mahajan 4ead254b3c Add metadata for Encrypted Backups (#12354)
* Add metadata for Encrypted backups

* Format files
2025-09-24 11:25:51 -07:00
Akanksha Mahajan 0975e9cd4c Enable Backup/Restore Encryption/Decryption in Simulation Tests (#12293)
* Enable Backup Encryption in Simulation Tests

* Enable encryption in BackupNew/OldRestore test and add fix

* Enable encryption in BackupAndParallelRestoreCorrectness workload

* Enable in RestoreBackup workload

* Add additional workloads

* Fix for Snap restart where second is not able to find if first run has
encryption key or not.

* Change the encryption probability to 50% in worloads

* Format

* Disable it in test and re-enable it later
2025-09-24 11:25:51 -07:00
Jingyu Zhou b2dffde9f4
Separate backup and restore into two workloads [release-7.4] (#12172)
* Separate backup and restore into two workloads

This allows more flexible testing as well as cleaner code.

* Keep sim backup agents after the Backup workload

Otherwise, the Restore workload doesn't have agents, thus can't make progress.

100k partitioned restore tests, i.e., BackupAndRestore.toml and
BackupCorrectnessPartitioned.toml:
  20250311-200411-jzhou-9d34d22d5225d6fe

* Remove TransformPartitionedLog parameter from restore()

Instead, infer the flag from backup description.

* Add usePartitionedLog option for Backup workload

This allows us to specify old or new style of backup to be used. Added two
tests that switch between them and randomly choose one backup to restore.

20250314-034057-jzhou-c27ca23b6c69cecf

* Enable buggify in these backup tests

20250314-034541-jzhou-13ed090d0b111474

* Disable backup encryptions for two tests

Because we separate backup and restore into two workloads, they may not choose
the same encryption option, i.e., one encrypted and the other unencrypted.

20250320-013757-jzhou-12b4c8e4504ffd96

* A small refactor

20250321-222324-jzhou-fdcd6f145f3ac0f8

* Fix backup agent being randomly paused

This can cause subsequent backup and restore workload to fail.

20250322-040333-jzhou-15c32299d18f4456

100k backup tests:
20250322-040453-jzhou-2bdb4e0ddc265632

* Refactor RestoreLogDataPartitionedTaskFunc::_execute

* Batch multiple versions together when applying backup mutations

If done version by version, it is inefficient and causes the task to be
interrupted in simulation, thus never finishing the RestoreLogDataPartitionedTaskFunc.

20250324-040712-jzhou-cd8501d3890a6b56

100k backup tests:
20250324-040751-jzhou-8cec93182e6d3acb

* Correct how many log bytes are written during restore

20250326-182125-jzhou-375d243c097c3b5a
20250325-221139-jzhou-5dac71c4525d414c

100k backup tests:
20250326-162525-jzhou-f08e3fc12887a3e9

* Skip consistency check and Quiescence for backup tests

Do these checks in the last [[test]] specified in TOML file.

* Disable backup workers when no active partitioned backups

Currently, when submitting backup, backup workers will be enabled for partitioned backups.
However, we didn't clear the backup worker setting if no partitioned backup is active,
which will cause backup workers to be recruited, but doing nothing.

This PR changes the behavior so that when submitting, aborting, or discontinuing
backups, we'll disable backup workers if there is no active partitioned backup jobs.

20250517-162642-jzhou-4966348e89f1794d
20250517-044345-jzhou-f02f7defca3ea010

* Fix a test assertion failure

The continuous log end version could be less than min restorable version, when
the snapshot is a single version. I.e., min and max restorable versions are the
same.

20250519-042009-jzhou-88a2e0c67e8bed92

100k backup tests 20250519-155545-jzhou-c0aeaaf4a933cff9

* Fix tests where backup agents are not resumed

Also consolidate key updates for pausing backups.

20250520-175022-jzhou-10106ade7e0ad74f

100k backup 20250520-175208-jzhou-15255334e0c57eec
2025-07-08 12:27:53 -07:00
Jingyu Zhou deda04b845
Fix a restore bug due to a race (#12037)
Found by simulation:
seed:  -f tests/slow/ApiCorrectnessAtomicRestore.toml -s 177856328 -b on
Commit: 51ad8428e0
Compiler: clang++
Env: Rhel9 okteto

applyMutations() has processed version 801400000-803141392, and before calling sendCommitTransactionRequest(),
which was going to update apply begin version to 803141392. But DID NOT wait for the transaction commit.

Then there is an update on the apply end version to 845345760, which picks up the PREVIOUS apply begin version 801400000.
Thus started another applyMutation() with version range 801400000-845345760. Note because previous
applyMutation() has finished and didn't wait for the transaction commit, thus the starting version
is wrong. As a result, this applyMutation() re-processed version range 801400000-803141392.

The test failed during re-processing, because mutations are missing for the overlapped range.

The fix is to wait for the transaction to commit in sendCommitTransactionRequest().

This bug probably affects DR as well.

See rdar://146877552

20250317-162835-jzhou-ff4c4d6d7c51bfed
2025-03-17 16:12:33 -07:00
Jingyu Zhou 8cd90ee7d0 Holds onto temporary variables' memories
Otherwise, StringRef points to free'ed memory locations.
2025-02-10 14:45:24 -08:00
hao fu 93133c83fb address comments 2025-01-23 12:32:27 -08:00
hao fu 933b035729 Refactor backup mutation serialization 2025-01-23 08:52:18 -08:00
flowguru fe47ce24d3
New restore consolidated commit (#11901)
* New restore consolidated commit

This change adds RestoreDispatchPartitionedTaskFunc to restore
from partitioned-format backup.

* ArenaBlock::totalSize parameter pass by ref

* Fix format issues identified by CI
2025-01-22 14:54:55 -08:00
Syed Paymaan Raza 48064f6cf1
Make some codeprobes rare (#11607)
* Make BlobGranule code probes rare

* Make encryption related code probes rare

* fixup! Fix formatting
2024-08-26 22:33:38 -07:00
Syed Paymaan Raza c3e7542cda Update end year in copyright header 2024-08-02 09:40:11 -07:00
Dimitris Apostolou a88114c222
Fix typos 2024-02-07 01:16:00 +02:00
Hao Fu 9b17dd8caf
Fix backup workers stability issues (#11044)
This PR includes a few stability fixes for Backup Worker

* Fixed memory bookkeeping issue in Backup Worker. Previously
it didn't release flow lock correctly when erasing messages.

* Added TLogServer fix to return 0 from poppedVersion() for
unrecognized log router tags.
2023-11-13 15:55:25 -08:00
Hao Fu 6d9c53f8c4 Add proxy to backup agent via global var
backup agent itself does not have proxy info.
This changes adds the proxy via a global var.
2023-09-08 10:27:01 -07:00
Hui Liu 00d3062728
Initialize apply mutations map for restore to version (#10857) 2023-09-05 10:03:35 -07:00
Ata E Husain Bohra 7779c908b3
EaR: Remove usage of ENABLE_CONFIGURABLE_ENCRYPTION knob (#10570)
Description

Given Configurable encryption has been checked in and being tested via
simulation for more than a month and also to avoid penalty of accessing
KNOBS in inline commit path, patch retires the KNOB and make
ConfigurationEncryption default EaR mode for FDB.

BlobCipher still supports the old format header and encryption semantics,
will remove the dead code as a followup PR.

Testing

devRunCorrectness - 100K
2023-06-30 17:48:09 -07:00
Hui Liu af20493ad0
Move lastFlushTs to BlobGranuleBackupConfig (#10505) 2023-06-16 16:12:10 -07:00
Hui Liu 606d8db75f
Remove blobGranuleLockKeys after blob granule restore (#10477) 2023-06-14 12:41:42 -07:00
Hui Liu ef93caf344
BlobGranuleRestore - skip muations applying if restore target version is less than begin version (#10442) 2023-06-08 09:19:25 -07:00
w41ter abd23958c2 Fix restore range loss 2023-05-29 11:39:07 +08:00
Hui Liu 7ca13d8f9c
support blob restore in fdbrestore (#10248) 2023-05-19 14:45:14 -07:00
Jefferson Zhong 3760522dc2 Make stepSize configurable for preloadApplyMutationsKeyVersionMap 2023-05-19 10:57:30 -07:00
Hui Liu 53e68065e7
Support blob manifest backup for fdbbackup cmdline (#10091) 2023-05-08 16:07:22 -07:00
Steve Atherton 46cde666a5 Merge commit '9639192a88001043a104aeef0c394e99ca5d6a6e' into keybackedrangemap 2023-04-21 13:27:15 -07:00
Nim Wijetunga 021bdccc32
propogate encryption errors properly (#10012)
propogate encryption errors properly
2023-04-19 11:35:29 -07:00
Steve Atherton 53ee26d758 Changed KeyBackedTypes to an actor file. Added TypedKeySelectors for Map and Set classes and getRange() keySelector methods. Added debug macro for KeyBackedTypes. Rewrote KeyBackedRangeMap using keyselectors on KeyBackedMap. 2023-04-18 22:21:19 -07:00
Hui Liu 711e040627
RestoreConfig - use restoreRangeSet to replace restoreRanges (#9912) 2023-04-06 11:16:05 -07:00
Nim Wijetunga 6e4e6ab2f4
Revert "Revert "Refactor GetEncryptCipherKeys (#9600)"" (#9903)
* Revert "Revert "Refactor GetEncryptCipherKeys (#9600)" (#9708)"
2023-04-05 10:03:48 -07:00
A.J. Beamon 64b6a5d257 Allow boolean parameters to be nested inside of namespaces or classes 2023-03-30 15:09:59 -07:00
Ata E Husain Bohra dbcab0b1bd
Revert "Refactor GetEncryptCipherKeys (#9600)" (#9708)
This reverts commit 2702665e35.
2023-03-15 12:10:08 -07:00
Nim Wijetunga 2702665e35
Refactor GetEncryptCipherKeys (#9600)
* inital commit

* address pr comments
2023-03-08 17:05:03 -08:00
Nim Wijetunga 218ed4519f
Strengthen Snapshot Backup/Restore Asserts (#9552)
strengthen backup/restore asserts for encryption
2023-03-08 15:24:02 -08:00
Jingyu Zhou ee5154f478 Refactor decoder to read file as a whole once
To reduce the number of network requests.
2023-03-03 09:32:12 -08:00
Jingyu Zhou ad778cbe5e Merge branch 'main' of https://github.com/apple/foundationdb into fix 2023-03-02 09:56:30 -08:00
Ata E Husain Bohra 2db1da26d9
EaR: Update ApiWorkload to validate encryption at-rest guarantees (#9466)
* EaR: Update ApiWorkload to validate encryption at-rest guarantees

Description

FDB encryption data at-rest guarantees if cluster is configured with feature
enabled, all data written to persistent disks shall be "encrypted". Given FDB
maintains multiple persistent storages during lifecycle of the data, the patch
proposes a scheme to validate the invariant via "simulation testing"

Patch proposes updating ApiCorrectness workload to do the following:
1. Client supplied params and/randomly enable the validation feature.
2. Validation when enabled, allows injecting a known "marker string"
to workload generated Key and Value data patterns.
3. On shutdown, if the validation is enabled, all test files are
scanned for the known "marker" pattern.

Simulation tests are already capable of doing the following:
1. Randomly select TenantMode (disabled/optional/required)
2. Randomly select EncryptionAtRestMode (cluster_aware/domain_aware)

Hence, the updates test all possible combinations are validated. Also,
'defaultTenant' is present to cover 'domain_aware' encryption use cases.

Testing
devRunCorrectness
devRetryCorrectness - ApiCorrectness & EncryptedBackupCorrectness
2023-02-27 21:40:46 -08:00
Jingyu Zhou 1313a7fa25 Use KeyspaceSnapshotFile to filter range files 2023-02-27 19:41:08 -08:00
Vishesh Yadav dd0ea8b0cf Clang-format 2023-02-27 13:10:19 -08:00
Vishesh Yadav 3e6e31ad0b Use the RangeMapFilters 2023-02-27 13:08:55 -08:00
Jingyu Zhou dd4bc82862 Refactor code 2023-02-27 13:06:01 -08:00
Jingyu Zhou 46fce2710e Use RangeMap for backup agent filtering
This is more efficient than going through ranges one by one.
2023-02-27 12:21:52 -08:00
Nim Wijetunga 29819b0645
Change Feed Bug Fix + Encryption Asserts (#9457)
* add encryption asserts

* modify function name

* address pr comments

* address pr comments

* Trigger Build
2023-02-23 19:33:25 -08:00
Nim Wijetunga e03eca778c
Configurable Encryption Support for Backup (#9375)
Snapshot backup configurable encryption support
2023-02-16 15:03:27 -08:00
Ata E Husain Bohra 8c94b340ce
EaR: Update encryption methods to make 'cipherHeaderKey' optional (#9378)
* EaR: Update encryption methods to make 'cipherHeaderKey' optional

Description

 diff-1: Address review comments

Major changes includes:
1. Update BlobCipher Encrypt/Decrypt classes to make 'headerCipher' optional
2. Update GetEncryptionCipherKeys actor methods to make 'headerCipherKey' optional
3. Update the usage across all encryption participant methods

Testing

BlobCipherUnitTest
EnryptedBackupCorrecctness
BlobGranuleCorrectness*

devRunCorrectness - 100K
2023-02-15 08:56:11 -08:00
Yi Wu fe18c87ac6
EaR: commit proxy fetch additional cipher keys post-resolution (#9308)
Commit proxy needs to fetch additional cipher keys post-resolution, since tenant ids for raw access requests and cross-tenant clear ranges are calculated after resolution.
2023-02-14 13:05:51 -08:00
Nim Wijetunga 1cd0922ed1
Snapshot Backup Bug Fix (#9319)
snapshot restore bug fix
2023-02-07 18:44:03 -08:00
Nim Wijetunga 86f3665514
Handle EKP Tenant Not Found Errors (#9261)
handle EKP tenant not found errors
2023-02-01 19:15:38 -08:00