Jan Nidzwetzki ac97c564e2 Fix lost concurrent CAgg updates
When two CAggs on the same hypertable are refreshed at the same type, we
had a race condition on the invalidation threshold table occur.

So far, the table has been locked with a non-self-conflicting lock.
Therefore, both scanners ran at the same time, but only one was able to
lock the threshold value with a proper tuple lock. The other scanner
ignored this failing lock and just returned. Therefore, the field
computed_invalidation_threshold was never populated and still contains
0.

So, invalidation_threshold_set_or_get returns and refresh end interval
of 0. As a consequence, the `if (refresh_window.start >=
refresh_window.end)` branch in continuous_agg_refresh_internal could be
taken and we return from the refresh without doing any work.

This patch adds proper error reporting and also implements some retry
logic to avoid these problems. A self-conficting lock is not used due to
the problems discussed in #5809.
2024-01-02 12:43:16 +01:00
..
2024-01-02 12:43:16 +01:00
2024-01-02 12:43:16 +01:00

TimescaleDB TSL Library

The TimescaleDB TSL library is licensed under the Timescale License.