Add Flush(context.Context) to BulkIndexer; replace channel with ring … - #930
Open
LeeFred3042U wants to merge 1 commit into
Open
Add Flush(context.Context) to BulkIndexer; replace channel with ring …#930LeeFred3042U wants to merge 1 commit into
LeeFred3042U wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #930 +/- ##
==========================================
+ Coverage 48.70% 48.75% +0.05%
==========================================
Files 637 637
Lines 61404 61459 +55
==========================================
+ Hits 29904 29963 +59
+ Misses 29749 29746 -3
+ Partials 1751 1750 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
LeeFred3042U
force-pushed
the
flushFunction
branch
3 times, most recently
from
July 8, 2026 23:09
041055e to
eb37abb
Compare
…buffer Signed-off-by: LeeFred3042U <109694901+LeeFred3042U@users.noreply.github.com> Fix golangci-lint v2 warnings (gosec and modernize) Signed-off-by: LeeFred3042U <109694901+LeeFred3042U@users.noreply.github.com> Add Flush(context.Context) to BulkIndexer; replace channel with ring buffer
LeeFred3042U
force-pushed
the
flushFunction
branch
from
July 8, 2026 23:10
eb37abb to
1458208
Compare
LeeFred3042U
marked this pull request as ready for review
July 9, 2026 09:14
LeeFred3042U
requested review from
Jakob3xD,
VachaShah,
VijayanB and
sean-
as code owners
July 9, 2026 09:14
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.
Description
This PR implements a
Flush(context.Context) errormethod on theBulkIndexerinterface to allow callers to drain all submitted items without closing the indexer.These were replaced:
bi.queue) was replaced with a lock-free ring buffer backed by three monotonic watermark counters (claimSeq,publishSeq,commitSeq).worker.run) were removed in favor of a single, ordered sequencer goroutine.Here's what changed:
Close()now sets an atomicclosingflag and delegates directly toFlush(ctx)rather than closing a channel. This eliminates the "send on closed channel" panic ifAdd()is called afterClose().Add()now safely checks theclosingflag and returns an error on a closed indexer, rather than panicking.Close()andAdd()have been preserved and made fully deterministic.here was what was added:
QueueSizefield toBulkIndexerConfig(to size the underlying ring buffer, internally rounding up to the next power of two).bulk_indexer_internal_test.goto verify concurrent flushing, reuse, and context cancellations.Flushrelease note entry toCHANGELOG.md.Issues Resolved
Closes [#336]
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.