Repository navigation
Conversation
Text index rebuilds can produce hundreds of small files whose combined inline data exceeds the 16 MiB manifest limit. Count inline bytes from the final paths and store the largest added or replaced files as blobs until the manifest fits. Include unchanged base entries in the budget when updating a published part. Use the existing precommit and blob upload path for spilled files. Share their payload across upload requests and independent readers. Co-authored-by: Codex (GPT-6) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
Text index files can outgrow the 1 MiB per-file inline limit while a merge is still writing them. Keeping the entire file in memory until finalize makes the peak allocation grow with the file size. Once a write crosses the limit, pass the buffered prefix and subsequent blocks to the local staging writer. Release the prefix allocation after the transfer. At finalize, register the staged file for publication through the existing precommit and blob upload path. Co-authored-by: Codex (GPT-6) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
Stream new part files to the configured local or S3 staging backend. Keep the size, content hash and staging handle when a writer closes. At commit, read the files selected for inline placement and publish the remaining blobs from staging. Hardlinks, moves and open readers retain the source until their last reference is released. Exercise the manifest budget with 100 rows and 20 temporary text index segments in both a merge and a mutation. Cover multipart staging and cleanup on RustFS after a successful insert or an injected failure. Co-authored-by: Codex (GPT-6) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
This reverts commit 6430520. Co-authored-by: Codex (GPT-6) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
An inline candidate written in chunks can retain substantially more memory than its payload when the transaction takes ownership. Request a smaller allocation before moving the finalized string into the manifest entry. Co-authored-by: Codex (GPT-6) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
Pin LZ4 for the text index rebuild so randomized server codecs cannot make the segment dictionaries fit below the manifest limit. Generate 100 rows across 20 segments and check that both the merge and mutation still select entries for blob placement. Exclude the memory measurement at compile time under sanitizers, where the allocation tracker cannot support the assertion. This avoids Clang's unreachable-code diagnostic after `GTEST_SKIP`. Co-authored-by: Codex (GPT-6) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
…limit Randomized dictionary settings can make the 100-row fixture fit within the manifest budget. Keep the dictionary settings stable and report the segment and blob-placement checks separately for the merge and mutation. Use the same per-file inline limit in the writer and the manifest validator. Include the namespace and ref in the retained-entry limit error and document staging, the placement counter and failed commits. CI: https://altinity-build-artifacts.s3.amazonaws.com/json.html?PR=2969&sha=a2b90dc739fc9e8169a4784148258164f8b191de&name_0=PR PR: #2969 Co-authored-by: Codex (GPT-6) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
Share payload reservations across writers in a disk transaction. When a writer cannot grow its reservation, spill the file to local staging and keep it eligible for inline placement at commit. Co-authored-by: Codex (GPT-6) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
Cover the last available byte and its reuse, hardlinks from published parts under memory pressure, and placement when the same dictionary files spill to local staging in different orders. Check that an open reader keeps its S3 staging object through commit or abort. Co-authored-by: Codex (GPT-6) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
Once the manifest entry owns the file bytes, erase its path from the transaction's staging map. This lets unshared payloads release their memory before manifest encoding. An open reader or a hardlink can still hold the source independently. Check all three lifetimes during publication, including a hardlink whose destination needs the same bytes for blob placement. Co-authored-by: Codex (GPT-6) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A CAS disk transaction can finalize dozens of files smaller than 1 MiB before it publishes a part manifest. Limiting inline bytes at commit still leaves the transaction holding every writer's payload in RAM until then.
This change gives the inline file writers in one disk transaction a shared 16 MiB budget across open writers and finalized files. A writer that cannot reserve space for its next allocation transfers its buffered bytes to a local temporary file and continues writing there. At commit, the manifest budget still determines which files are stored inline. Once an inline entry owns its bytes, its path releases the staging source. An open reader or hardlink can keep that source alive independently. The writer budget covers new payload allocations. Manifest encoding and inline entries copied from an already published manifest can consume additional memory. Writer implementation · Release after inline placement
Merge #2969 first. Its changes are currently included in the release-branch diff. Review only the three follow-up commits.
Memory held before commit. One transaction wrote and finalized
0.idxthrough63.idxsequentially, 600 KiB each, on local storage. Values are medians of six paired runs. The timer covered writing and finalizing all files and stopped before commit. Before the transaction budget · With the transaction budgetThe writer retained 23.09 MiB less before commit and staged 39 of the 64 files locally. This workload measures the effects of spilling on the writer.
Peak memory while rebuilding a text index. Test
05815runsOPTIMIZE TABLE … FINAL DEDUPLICATEon two 50-row parts andMATERIALIZE INDEX idx_son a separate 100-row part. Both operations write temporary dictionary files ending in.dct.idx. The table reports the operation peak fromsystem.part_log.peak_memory_usagein MiB. “Before budget” is one reference run per cell on the #2969 implementation. “Budget” and “Budget + early release” are medians of four paired runs per storage configuration, with alternating run order. Time issystem.part_log.duration_msfor those same pairs. 05815 workload · Early release commitEarly release saved 12.97 MiB in every paired comparison. Against the separate pre-budget reference, the final peaks were about 1.9 MiB lower for merge and 0.9 MiB lower for mutation. On RustFS with S3 staging, the paired change in merge time ranged from 1.97 s faster to 2.38 s slower, so these four pairs do not establish a latency improvement.
The local allocation profile explains where the memory went. At the peak of both operations, manifest encoding previously overlapped with 16 original dictionary buffers holding 14.75 MiB. Early release left two original buffers holding 1.84 MiB for pending blob uploads. In both versions the manifest entries contained the same 14 copies from RAM, totaling 12.91 MiB.
All 64 focused CAS unit tests passed, including a reader that outlives commit and a hardlink whose destination requires blob placement. All 24 paired-series runs of
05815passed the indexed lookup andCHECK TABLE. Each merge and mutation wrote 20 temporary segments, spilled four writers under memory pressure, and selected three entries for blob placement at commit. Reader and hardlink regression testRelated: #2969
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
CAS disks use less memory when one transaction writes many small files, including during text-index rebuilds.
Documentation entry for user-facing changes
CAS automatically spills an inline candidate to local staging when its writer cannot reserve space in the transaction’s 16 MiB memory budget.
CI/CD Options
Exclude tests:
Regression jobs to run: