Skip to content

Fix read and write side overflow for large snapshot manifests for Backup and Restore - #13820

Merged
akankshamahajan15 merged 3 commits into
apple:release-7.4from
akankshamahajan15:release-7.4.port
Aug 7, 2026
Merged

akankshamahajan15 merged 3 commits into
apple:release-7.4from
akankshamahajan15:release-7.4.port

Conversation

@akankshamahajan15

@akankshamahajan15 akankshamahajan15 commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Cherrypicked:
#13349 Fix overflow bug for large json documents in writeKeyspaceSnapshotFile
#13691 Fix read-side overflow and simplify append API for large snapshot manifests

100k completed
20260807-174026-ak_bk7.4-4ef0a8cfd3888796 compressed=True data_size=41358864 duration=3716394 ended=100000 fail_fast=10 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=0:47:41 sanity=False started=100000 stopped=20260807-182807 submitted=20260807-174026 timeout=5400 username=ak_bk7.4

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

apple#13349)

* Fix overflow bug for large json documents in writeKeyspaceSnapshotFile

* Move chunked append into non-virtual overload to fix the same overflow issue for all append calls and add additional test case
@akankshamahajan15 akankshamahajan15 changed the title Fix read and write side overflow and simplify append API for large snapshot manifests Fix read and write side overflow for large snapshot manifests for Backup and Restore Aug 7, 2026
@akankshamahajan15
akankshamahajan15 marked this pull request as ready for review August 7, 2026 18:41
spraza
spraza previously approved these changes Aug 7, 2026
@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.

…ifests (apple#13691)

* Fix read-side overflow and simplify append API for large snapshot manifests

  Follow-up to apple#13349, which fixed the write-side overflow when a snapshot manifest exceeds ~2 GB but left the read side and the API untidy. This PR addresses both.

  ### Changes

  **Simpler append API**
  There were two `append()` methods — one taking `int`, one `size_t` — and which ran depended on the argument type, which is easy to get wrong. Replaced with a single
  public `append()` that safely chunks any size, plus a clearly-named backend hook `appendImpl()` that each storage backend implements. No more overload ambiguity.

  **Read side fix**
  `readKeyspaceSnapshot` read the manifest into a buffer whose length is an `int`, so a manifest larger than 2 GB could truncate and crash on restore. It now reads into a
  `std::string` (which can exceed 2 GB) in chunks, matching the write side, and drops a redundant full copy of the manifest.

  **Knob rename**
  `BACKUP_MANIFEST_WRITE_CHUNK_SIZE` → `BACKUP_MANIFEST_CHUNK_SIZE`, since it now controls chunk size for both reads and writes.

  **Test**
  Added a unit test that reads a manifest back in many small chunks and verifies all range files and key ranges round-trip correctly.

  ### Notes
  - Range and log files are unaffected — they're already streamed in small blocks on both read and write.

* Addressed comments

* Fix clang tidy errors
@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-clang-arm on Linux RHEL 9

  • Commit ID: c222e8e
  • Duration 0:48:00
  • 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

This comment has been minimized.

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos-m1 on macOS 14.x

  • Commit ID: c222e8e
  • Duration 0:50:42
  • 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

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux RHEL 9

  • Commit ID: c222e8e
  • Duration 1:13:25
  • 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: c222e8e
  • Duration 1:14:23
  • 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

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-cluster-tests on Linux RHEL 9

  • Commit ID: c222e8e
  • Duration 1:36:09
  • 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)

@akankshamahajan15
akankshamahajan15 merged commit c768cde into apple:release-7.4 Aug 7, 2026
1 check passed
@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 on macOS 14.x

  • Commit ID: c222e8e
  • Duration 4:42:21
  • 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)

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.

5 participants