Skip to content

Database Performance Optimizations#8

Draft
ShashankFC wants to merge 1 commit into
db-cleanup-baselinefrom
db-cleanup-optimized
Draft

Database Performance Optimizations#8
ShashankFC wants to merge 1 commit into
db-cleanup-baselinefrom
db-cleanup-optimized

Conversation

@ShashankFC

Copy link
Copy Markdown
Collaborator

Test 7nnn## Summary by CodeRabbitnn* Bug Fixesn * Improved annotation cleanup reliability by implementing a batching mechanism to prevent deadlocks during bulk deletion operations.nn* Choresn * Increased cleanup task frequency from 10-minute to 1-minute intervals for faster maintenance of stale annotations.nn✏️ Tip: You can customize this high-level summary in your review settings.nnn---nReplicated from ai-code-review-evaluation/grafana-coderabbit#7

… deadlocks on MySQL (#80329)

* Split subquery when cleaning annotations

* update comment

* Raise batch size, now that we pay attention to it

* Iterate in batches

* Separate cancellable batch implementation to allow for multi-statement callbacks, add overload for single-statement use

* Use split-out utility in outer batching loop so it respects context cancellation

* guard against empty queries

* Use SQL parameters

* Use same approach for tags

* drop unused function

* Work around parameter limit on sqlite for large batches

* Bulk insert test data in DB

* Refactor test to customise test data creation

* Add test for catching SQLITE_MAX_VARIABLE_NUMBER limit

* Turn annotation cleanup test to integration tests

* lint

---------

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
@ShashankFC

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jan 12, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jan 12, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@ShashankFC has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 11 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between f84c8f6 and 81c45bf.

📒 Files selected for processing (3)
  • pkg/services/annotations/annotationsimpl/cleanup_test.go
  • pkg/services/annotations/annotationsimpl/xorm_store.go
  • pkg/services/cleanup/cleanup.go

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 2 weeks if no further activity occurs. Please feel free to give a status update or ping for review. Thank you for your contributions!

@github-actions github-actions Bot added the stale label Feb 12, 2026
@ShashankFC

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@github-actions github-actions Bot removed the stale label Feb 24, 2026
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.

2 participants