Skip to content
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

[chore][exporter] Consolidate merge splitting for the case where maxLimit is set and the case it's not #12104

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sfc-gh-sili
Copy link
Contributor

@sfc-gh-sili sfc-gh-sili commented Jan 16, 2025

This PR consolidates merge splitting for the case where maxLimit is set and the case it's not. This should not have any effect from users' perspective.

Description

Link to tracking issue

Fixes #

Testing

Documentation

@sfc-gh-sili sfc-gh-sili requested review from bogdandrutu, dmitryax and a team as code owners January 16, 2025 01:59
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.69%. Comparing base (42b83a7) to head (c9eee19).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12104      +/-   ##
==========================================
- Coverage   91.71%   91.69%   -0.03%     
==========================================
  Files         463      463              
  Lines       24803    24774      -29     
==========================================
- Hits        22749    22717      -32     
- Misses       1672     1674       +2     
- Partials      382      383       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sfc-gh-sili sfc-gh-sili force-pushed the sili-consolidate branch 3 times, most recently from d08401e to 3cbe092 Compare January 20, 2025 23:32
qb.currentBatchMu.Unlock()
continue
}
if mergeSplitErr != nil || reqList == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure you want to do anything if error, unless I am missing something.

qb.currentBatchMu.Unlock()
continue
}
if mergeSplitErr != nil || reqList == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A slice never compare to nil, you must most likely compare len to 0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm. In Go a slice can be nil and the comparison is valid. Note however that nil != []type{}.
https://go.dev/tour/moretypes/12

qb.currentBatch = &batch{
req: reqList[0],
// If there was a split, we flush everything immediately.
if reqList[0].ItemsCount() >= qb.batchCfg.MinSizeItems || len(reqList) > 1 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if len is 0, get a segfault here?

@jmacd
Copy link
Contributor

jmacd commented Jan 23, 2025

I tried to understand this PR, but I found myself with background-level questions as in #12118, would love to see package-level documentation on the new relationship between the queue sender and batch sender, so that I can keep track of timeout and cancellation-related topics. Thank you @sfc-gh-sili for leading this effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants