-
Notifications
You must be signed in to change notification settings - Fork 279
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
[enhancement] logtail: make table subscription async #16879
Conversation
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Reviewer Guide 🔍
|
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Code Suggestions ✨
|
c829349
to
c89549c
Compare
User description
What type of PR is this?
Which issue(s) this PR fixes:
issue #13724
What this PR does / why we need it:
A table subscription takes long time if the table has much data
which need flushed, and it will block the logtail update of other
tables because they work in the same goroutine.
So we put the table subscription into a independent goroutine,
thus the logtails of other tables could be pushed to cn servers
without being blocked. And when the first phase of pulling table
data finishes, put it into the same goroutine with pushing-job,
and pull the data again for the second phase. At last, send the
whole data that are merged together to cn servers.
After the PR, the table subscription will not block pushing-jobs.
There are 50 parallel pulling jobs at the same time at most by
defalt to avoid OOM and other risks.
PR Type
Enhancement, Tests
Description
logtailMerger
to merge multipleLogtailPhase
instances into a singleTableLogtail
.logtailMerger
to ensure correct merging and callback execution.LogtailPhase
struct to represent logtail information for different phases of subscription.LogtailServer
to handle asynchronous table subscription, including new channels and worker functions.Changes walkthrough 📝
merger.go
Introduce `logtailMerger` for merging multiple logtail phases
pkg/vm/engine/tae/logtail/service/merger.go
logtailMerger
struct to merge multipleLogtailPhase
instances.
Merge
function to merge logtails and return a combinedTableLogtail
and a callback function.response.go
Add `LogtailPhase` struct for subscription phases
pkg/vm/engine/tae/logtail/service/response.go
LogtailPhase
struct to represent logtail information forsubscription phases.
server.go
Refactor `LogtailServer` for asynchronous table subscription
pkg/vm/engine/tae/logtail/service/server.go
LogtailServer
to handle asynchronous table subscription.subReqChan
andsubTailChan
for managing subscriptionrequests and logtail phases.
logtailPullWorker
andpullLogtailsPhase1
for asynchronouslogtail pulling.
logtailSender
to handle the second phase of logtailcollection.
merger_test.go
Add unit tests for `logtailMerger` functionality
pkg/vm/engine/tae/logtail/service/merger_test.go
logtailMerger
functionality.