Skip to content

[filebeat][fix] include ESStorageExtension identity in state store cache key #49729

Open
barkhayot wants to merge 2 commits intoelastic:mainfrom
barkhayot:fix/include-key-storage-extension
Open

[filebeat][fix] include ESStorageExtension identity in state store cache key #49729
barkhayot wants to merge 2 commits intoelastic:mainfrom
barkhayot:fix/include-key-storage-extension

Conversation

@barkhayot
Copy link
Copy Markdown

@barkhayot barkhayot commented Mar 27, 2026

  • issue [bug-hunter] Filebeat state store cache key ignores storage extension and mixes receiver state #49656
  • when openStateStore is called with different ESStorageExtension instances but the same backend/path, the global registry cache (globalStores) was keyed only by backend://path. The second caller would reuse the first caller's esRegistry, causing cross-receiver state leakage
  • append the extension's pointer address (%p) to the cache key when ESStorageExtension is non-nil, ensuring each distinct extension gets its own sharedRegistries entry
  • add suggested test in issue

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Mar 27, 2026
@cla-checker-service
Copy link
Copy Markdown

cla-checker-service bot commented Mar 27, 2026

💚 CLA has been signed

@github-actions
Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 27, 2026

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @barkhayot? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@barkhayot barkhayot marked this pull request as ready for review March 27, 2026 05:45
@barkhayot barkhayot requested a review from a team as a code owner March 27, 2026 05:45
@barkhayot barkhayot requested review from belimawr and rdner March 27, 2026 05:45
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f3e613b4-391c-4002-9ac7-394857a8c6ee

📥 Commits

Reviewing files that changed from the base of the PR and between dd39290 and f916f64.

📒 Files selected for processing (2)
  • filebeat/beater/store.go
  • filebeat/beater/store_test.go
✅ Files skipped from review due to trivial changes (1)
  • filebeat/beater/store_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • filebeat/beater/store.go

📝 Walkthrough

Walkthrough

The changes modify storeKey to include the Elasticsearch storage extension identity when non-nil, appending an |esext:%p segment to the generated key. openStateStore now passes cfg.ESStorageExtension into storeKey, so global store reuse/splitting also depends on the specific ES storage extension instance. A test was added that opens two stores with identical configs except for different ESStorageExtension instances and verifies that state written to one is not visible from the other.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • 🛠️ Update Documentation: Commit on current branch
  • 🛠️ Update Documentation: Create PR

Comment @coderabbitai help to get the list of available commands and usage tips.

@cmacknz cmacknz requested a review from VihasMakwana March 27, 2026 17:02
@cmacknz cmacknz added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Mar 27, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug-hunter] Filebeat state store cache key ignores storage extension and mixes receiver state

3 participants