diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-11-22 14:02:47 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-11-22 14:49:43 +0300 |
commit | d4d26c44d1372b799946021cb9cbaca9ae84f548 (patch) | |
tree | 86072d525a87c6a2a8e2c730c797a02aafcc2862 | |
parent | 313d9f851237a2236660c9a36a256acda85a2f2f (diff) |
datastore: Revert use of materialized views
Revert the introduction of materialized views for `valid_primaries`. As
it turns out, the changes cause incompatibilities with Postgres 11,
which is still actively in use. Furthermore, the performance issues we
have seen have not been fully fixed with this change, and we do not yet
fully understand the root cause for this.
Changelog: fixed
-rw-r--r-- | internal/praefect/datastore/collector.go | 5 | ||||
-rw-r--r-- | internal/praefect/datastore/repository_store.go | 4 |
2 files changed, 0 insertions, 9 deletions
diff --git a/internal/praefect/datastore/collector.go b/internal/praefect/datastore/collector.go index 40390b47a..c0184d17f 100644 --- a/internal/praefect/datastore/collector.go +++ b/internal/praefect/datastore/collector.go @@ -78,11 +78,6 @@ func (c *RepositoryStoreCollector) Collect(ch chan<- prometheus.Metric) { // they are either unhealthy or out of date. func (c *RepositoryStoreCollector) queryMetrics(ctx context.Context) (map[string]int, error) { rows, err := c.db.QueryContext(ctx, ` -WITH valid_primaries AS MATERIALIZED ( - SELECT virtual_storage, relative_path - FROM valid_primaries -) - SELECT virtual_storage, COUNT(*) FROM repositories WHERE NOT EXISTS ( diff --git a/internal/praefect/datastore/repository_store.go b/internal/praefect/datastore/repository_store.go index beffaa2af..c8616d348 100644 --- a/internal/praefect/datastore/repository_store.go +++ b/internal/praefect/datastore/repository_store.go @@ -615,10 +615,6 @@ func (rs *PostgresRepositoryStore) GetPartiallyAvailableRepositories(ctx context // than the assigned ones. // rows, err := rs.db.QueryContext(ctx, ` -WITH valid_primaries AS MATERIALIZED ( - SELECT * FROM valid_primaries -) - SELECT json_build_object ( 'RelativePath', relative_path, |