Skip to content

[refactor] Migrate persistent queue to consolidated metadata format #13126

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

malus2077
Copy link
Contributor

This PR updates the persistence strategy to consolidate all relevant queue information (start, stop, in-progress, size) under a single key for each write operation.

Copy link

codecov bot commented Jun 2, 2025

Codecov Report

Attention: Patch coverage is 75.36232% with 34 lines in your changes missing coverage. Please review.

Project coverage is 91.25%. Comparing base (1921e21) to head (1284e18).

Files with missing lines Patch % Lines
.../exporterhelper/internal/queue/persistent_queue.go 75.36% 22 Missing and 12 partials ⚠️

❌ Your patch check has failed because the patch coverage (75.36%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13126      +/-   ##
==========================================
- Coverage   91.27%   91.25%   -0.03%     
==========================================
  Files         514      514              
  Lines       28857    28943      +86     
==========================================
+ Hits        26340    26411      +71     
- Misses       1998     2001       +3     
- Partials      519      531      +12     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bogdandrutu
Copy link
Member

Please use changes from #13125

@bogdandrutu
Copy link
Member

Hey… something is wrong here

@malus2077 malus2077 force-pushed the malus2077/refactor-12890 branch from 250d434 to 4aa8773 Compare June 3, 2025 13:13
@malus2077
Copy link
Contributor Author

Hey… something is wrong here

It's done! Apologies, I'm still getting comfortable with git rebase operations.

@github-actions github-actions bot requested a review from bogdandrutu June 4, 2025 12:21
github-merge-queue bot pushed a commit that referenced this pull request Jun 4, 2025
Embed QueueMetadata directly into persistentQueue, replacing the
scattered metadata fields.

1. Add QueueMetadata as a member of persistentQueue.
2. Delete redundant fields (queueSize, readIdx, writeIdx, …).

Relates to #13126
@bogdandrutu
Copy link
Member

Please rebase with latest changes

@malus2077 malus2077 requested a review from codeboten as a code owner June 5, 2025 00:47
malus2077 added a commit to malus2077/opentelemetry-collector that referenced this pull request Jun 5, 2025
…ry#13140)

Embed QueueMetadata directly into persistentQueue, replacing the
scattered metadata fields.

1. Add QueueMetadata as a member of persistentQueue.
2. Delete redundant fields (queueSize, readIdx, writeIdx, …).

Relates to open-telemetry#13126
@malus2077 malus2077 force-pushed the malus2077/refactor-12890 branch from 7d0eef9 to 1acbafc Compare June 5, 2025 01:59
@malus2077 malus2077 changed the title refactor: migrate persistent queue to consolidated metadata format [chore] Migrate persistent queue to consolidated metadata format Jun 5, 2025
@malus2077 malus2077 changed the title [chore] Migrate persistent queue to consolidated metadata format [refactor] Migrate persistent queue to consolidated metadata format Jun 5, 2025
return err
}

if metadataSizerType != pq.set.sizerType {
Copy link
Member

Choose a reason for hiding this comment

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

Let's add support for this in a followup PR, for the moment in this case return error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not returning an error directly here for now. Please see my previous comment.

@github-actions github-actions bot requested a review from bogdandrutu June 6, 2025 12:27
@malus2077
Copy link
Contributor Author

Thanks for the review, @bogdandrutu! Changes are ready.

@malus2077
Copy link
Contributor Author

malus2077 commented Jun 9, 2025

Thanks again for your patience and thorough feedback!

I’d really like to accelerate finalizing this PR, and I’m fully open to splitting it into smaller pieces if that helps us move faster. Please let me know how you’d prefer to proceed—I’m more than happy to accommodate your workflow to get this wrapped up efficiently.

}

if metadataSizerType != pq.set.sizerType {
pq.logger.Warn("Sizer type mismatch in stored metadata")
Copy link
Member

Choose a reason for hiding this comment

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

Does it have to be a warning?

Copy link
Member

@dmitryax dmitryax Jun 13, 2025

Choose a reason for hiding this comment

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

Probably this can be a warning, but I think we need to add some wording that the incoming requests are blocked until the queue is drained

Copy link
Member

@dmitryax dmitryax Jun 13, 2025

Choose a reason for hiding this comment

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

Do we actually have to force draining when sizer changes? I imagine it'll be a significant delay to upgrade the collectors that accumulated a huge queue for any reason.

Can we maintain and store different metadata instances per each sizer type instead of having only one under qmv0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When users change the sizerType, the current "force full drain" mechanism ensures consistency in queueSize and capacity calculations.

Implementing separate metadata instances per sizer type would create challenges:

  1. Item Storage Overlap: Queue items use keys like "0", "1", "2". Different metadata instances would reference the same indices, requiring coordination.
  2. Complex Capacity Management: Multiple metadata instances would complicate queue capacity handling.

While blocking during full drain causes delays for large queues, a non-blocking approach would significantly increase implementation complexity. We need to weigh the benefits against higher maintenance costs.

Do you think it would be better to work on enhancing the current force full drain?

Probably this can be a warning, but I think we need to add some wording that the incoming requests are blocked until the queue is drained

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would value your opinion on this. Please let me know if you see any room for improvement or have a different approach in mind. I'm happy to collaborate on a solution to ensure this issue #12890 is resolved properly.

@dmitryax

@malus2077 malus2077 force-pushed the malus2077/refactor-12890 branch from f5bded2 to 1284e18 Compare June 14, 2025 04:03
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.

[exporterhelper] Refactor persistent storage size backup
3 participants