grafana/pkg/infra
Sofia Papagiannaki 7b70e7db2d
AuthProxy: Optimistic lock pattern for remote cache Set (#17485)
* Implementation of optimistic lock pattern

Try to insert the remote cache key and handle integrity error

* Remove transaction

Integrity error inside a transaction results in deadlock

* Remove check for existing remote cache key

Is no longer needed since integrity constrain violations are handled

* Add check for integrity constrain violation

Do not update the row if the insert statement fails
for other than an integrity constrain violation

* Handle failing inserts because of deadlocks

If the insert statement fails because of a deadlock
try to update the row

* Add utility function for returning SQL error code

Useful for debugging

* Add logging for failing expired cache key deletion

Do not shallow it completely

* Revert "Add utility function for returning SQL error code"

This reverts commit 8e0b82c79633e7d8bc350823cbbab2ac7a58c0a5.

* Better log for failing deletion of expired cache key

* Add some comments

* Remove check for existing cache key

Attempt to insert the key without checking if it's already there
and handle the error situations

* Do not propagate deadlocks created during update

Most probably somebody else is trying to insert/update
the key at the same time so it is safe enough to ignore it
2019-06-13 15:36:09 +02:00
..
localcache codestyle: moves cache to infra (#17519) 2019-06-13 10:55:38 +02:00
log move log package to /infra (#17023) 2019-05-13 08:45:54 +02:00
metrics metrics: expose stats about roles as metrics (#17469) 2019-06-06 16:39:35 +02:00
remotecache AuthProxy: Optimistic lock pattern for remote cache Set (#17485) 2019-06-13 15:36:09 +02:00
serverlock serverlock: run tests async should be more linear time wise (#17059) 2019-05-14 15:38:18 +02:00
tracing Tracing: allow propagation with Zipkin headers (#17009) 2019-06-05 13:12:05 +02:00
usagestats metrics: expose stats about roles as metrics (#17469) 2019-06-06 16:39:35 +02:00