timescale / prometheus-postgresql-adapter

Use PostgreSQL as a remote storage database for Prometheus
Apache License 2.0
335 stars 66 forks source link

Add reccuring Postgres connection check for advisory lock #91

Closed antekresic closed 4 years ago

antekresic commented 5 years ago

In a disaster or failover scenario, advisory lock that was previously acquired would be lost by the leader instance. In this case, we need to double check that the connection is down and release the application-side lock to avoid having a state with multiple leaders.

codecov[bot] commented 4 years ago

Codecov Report

Merging #91 into master will decrease coverage by 0.23%. The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #91      +/-   ##
=========================================
- Coverage   14.04%   13.8%   -0.24%     
=========================================
  Files           4       4              
  Lines         584     594      +10     
=========================================
  Hits           82      82              
- Misses        487     497      +10     
  Partials       15      15
Impacted Files Coverage Δ
pkg/util/election.go 25.37% <0%> (ø) :arrow_up:
pkg/util/lock.go 0% <0%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e98e2a0...8d78f4a. Read the comment docs.