-
-
Notifications
You must be signed in to change notification settings - Fork 204
fix(exporter): reduce mutex hold time in process pending events #5134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kodiakhq
merged 17 commits into
thomaspoignant:main
from
hugehoo:perf/reduce-mutex-hold-time-in-process-pending-events
Apr 30, 2026
+275
−23
Merged
Changes from 6 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
382e2a2
perf: shorten event store lock duration
hugehoo 6daa6eb
fix: serialize concurrent exporter flushes
hugehoo 67a4e54
docs: fix typo in exporter stop comment
hugehoo b0419e5
fix: serialize event store processing per consumer
hugehoo 5ba1427
test: fix unused context parameter in event store test
hugehoo 6b3302e
test: satisfy linter in event store concurrency test
hugehoo 7adf54e
fix(exporter): move flush synchronization into event store
hugehoo 3c02665
test(exporter): fix unused context parameter
hugehoo 56b926f
test(exporter): fix unused callback parameter
hugehoo a1e45cd
test(exporter): avoid unparam in queued flush test
hugehoo d08e46d
fix: method signature in subsequent methods in ProcessPendingEvents
hugehoo 8bd2fae
Update exporter/event_store.go
hugehoo 5181041
fix: fmt lint
hugehoo 04dc8a1
Merge branch 'main' into perf/reduce-mutex-hold-time-in-process-pendi…
thomaspoignant 654bb9a
Apply suggestion from @thomaspoignant
thomaspoignant 19cbcb3
Merge branch 'main' into perf/reduce-mutex-hold-time-in-process-pendi…
thomaspoignant b20ade2
Merge branch 'main' into perf/reduce-mutex-hold-time-in-process-pendi…
thomaspoignant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
flushMumutex indataExporterImplis redundant. TheeventStore.ProcessPendingEventsmethod now implements internal per-consumer synchronization usingcurrentConsumer.mutex. Since eachDataExporterinstance is associated with a specificconsumerID, the event store already ensures that concurrent flushes for the same consumer are serialized. Removing this lock reduces unnecessary overhead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hugehoo as Gemini is saying this mutex is not needed here.
Can you guide me why you want to add one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added flushMu as a defensive guard because, ProcessPendingEvents() released the store lock before export and only updated the consumer offset afterward. That made concurrent Flush() calls for the same consumer look risky, so I serialized them at the DataExporter layer.
but after saw what Gemini said, I agree this is not the right place to keep that guarantee. The atomicity should live in EventStore, not in DataExporter.