filestream: encode bridging raw header only for dedup winners#51914
filestream: encode bridging raw header only for dedup winners#51914orestisfl wants to merge 2 commits into
Conversation
🤖 GitHub commentsJust comment with:
|
In growing-fingerprint mode, fileScanner.toFileDescriptor hex-encoded the raw fingerprint window for every complete file on every scan. The completedFingerprints suppression set is rebuilt by fileWatcher.watch from the post-dedup result only, so dedup losers can never enter it. Every duplicate therefore re-read and re-encoded its ~2*length-byte raw header on every scan forever, even though its descriptor is discarded immediately at the dedup check. Move the bridging-raw encode out of toFileDescriptor into a new attachBridgingRaw helper that GetFiles calls only after the dedup-winner decision. Duplicates never pay the encode, not even on their first scan. Behavior for the winner is byte-identical to before: dedup uses FileID() and every consumer of Fingerprint.Raw on a complete descriptor only ever sees post-dedup descriptors. The bridging header is still attached on the scan a file crosses the threshold, so rename/growth prefix matching is unchanged.
baa8608 to
bbb66d3
Compare
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
|
Tick the box to add this pull request to the merge queue (same as
|
TL;DRThe Buildkite job failed with one unidentified Go integration-test failure after 2,884 tests. The available job log does not include the failing test assertion or stack trace; it only records the final teardown of Remediation
Investigation detailsRoot CauseThe root cause is inconclusive because the provided Buildkite log contains no failing test name, assertion, or stack trace. The only identifiable test artifact is Evidence
Verification
Follow-upOnce the test artifact is available, check whether the failure is the 3-minute document polling in What is this? | From workflow: PR Buildkite Detective Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not. |
Proposed commit message
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesstresstest.shscript to run them under stress conditions and race detector to verify their stability.I have added an entry in./changelog/fragmentsusing the changelog tool.Disruptive User Impact
None.
How to test this PR locally
Unit tests and benchmark:
End-to-end reproduction with
filebeat:filebeat.yml:allocsprofiles ~45s apart:Expected: all 9,999 duplicates dedup to the single winner (
files_uniquestays 1). Onmain, the ~45s window allocates ~2.5 GB withencoding/hex.EncodeToStringaccounting for ~1.8 GB (71%), all attributed totoFileDescriptor. With this PR the window drops to ~0.8 GB,hex.EncodeToStringfalls to ~66 MB (only the 64-char SHA-256Sumfor all files), andattachBridgingRawdoes not appear in the diff because only the single winner encodes its raw header.Logs
alloc_spacediff over a ~45s window, before vs after (10,000 identical files,check_interval: 1s):BenchmarkGetFilesWithFingerprintGrowing/duplicates(1,000 identical files,-benchmem), before vs after the encode move: