diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2020-10-02 18:47:43 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2020-10-02 18:47:43 +0300 |
commit | b9dd1f6d4868f8463f689cf74f438e0108691af2 (patch) | |
tree | e223460f5a250d9a5fe28785835314d2b487a846 /go.mod | |
parent | d76d10b540d474d950103aa3303a89a9aad9dd88 (diff) |
PostgreSQL notifications listener
Praefect strongly depends on the state of tha PostgreSQL database.
Usually we execute a query to get the latest infornation about the
state. But it doesn't scale well in case query is heavy or there are
too many round trips to the database. To address it the data could be
cached locally in the memory, so we can reduce amount of trips to the
database. The downside of this approach is that we should invalidate
local cache when data in database changes.
To address this we decided to allow Praefect to have a direct connection
to the PostgeSQL database and benefit from LISTEN/NOTIFY functionality of
it. Implemented listener triggers passed in callback function with payload
it receives from the database. In order to prevent stale state if connection
was lost and it can't be re-establish for 3 attempts in period of 1 min the
listener will return with error.
Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/3053
Diffstat (limited to 'go.mod')
-rw-r--r-- | go.mod | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -15,6 +15,7 @@ require ( github.com/olekukonko/tablewriter v0.0.2 github.com/opentracing/opentracing-go v1.0.2 github.com/prometheus/client_golang v1.0.0 + github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 github.com/prometheus/procfs v0.0.3 // indirect github.com/rubenv/sql-migrate v0.0.0-20191213152630-06338513c237 github.com/sirupsen/logrus v1.6.0 |