grafana/pkg/services/annotations
Alexander Weaver 81c45bfe44
Annotations: Split cleanup into separate queries and deletes to avoid 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>
2024-01-12 14:05:04 -06:00
..
accesscontrol RBAC: Change annotation filter to use dashboard based annotation scopes (#78635) 2023-11-29 05:34:44 -05:00
annotationsimpl Annotations: Split cleanup into separate queries and deletes to avoid deadlocks on MySQL (#80329) 2024-01-12 14:05:04 -06:00
annotationstest Rename Id to ID for annotation models (#62886) 2023-02-03 17:23:09 +01:00
testutil Annotations: Lift parts of RBAC from xorm store into auth service (#76967) 2023-11-14 18:11:01 -05:00
annotations_repository_mock.go Alerting: Persist annotations from multidimensional rules in batches (#56575) 2022-11-04 10:39:26 -05:00
annotations.go Chore: Add errutils helpers (#73577) 2023-08-22 12:52:24 +02:00
models.go Annotations/Alerting: Add Loki historian store stub (#78363) 2023-12-12 17:43:09 -05:00