Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-10-06 12:19:41 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-10-06 12:25:43 +0300
commit4f0368b6b6f0f00729736cdb3d8fa50848c8b677 (patch)
tree6e4fb7845ecf67a6d759b0315c37403bc40e1084
parentcd94be7ff514fd2e3e84910c42a46995c444b70a (diff)
datastore: Fix storage cleanup's handling of timezones
Timestamps in the `storage_cleanups` table are stored without timezones, but our timezone handling in `AcquireNextStorage()` is inconsistent: we typically just use `NOW()` to get the current timestamp, but in one case we use `NOW() AT TIME ZONE 'UTC'`. In some setups, this leads to time stamps which cannot be correctly compared with each other. Fix the bug by consistently storing time stamps without time zones. This bug is similar to 4a2ac0ed4 (datastore: Fix acknowledgement of stale jobs considering timezones, 2021-08-20). Changelog: fixed
-rw-r--r--internal/praefect/datastore/storage_cleanup.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/praefect/datastore/storage_cleanup.go b/internal/praefect/datastore/storage_cleanup.go
index 2c50f2aac..adc43401b 100644
--- a/internal/praefect/datastore/storage_cleanup.go
+++ b/internal/praefect/datastore/storage_cleanup.go
@@ -71,7 +71,7 @@ func (ss *StorageCleanup) AcquireNextStorage(ctx context.Context, inactive, upda
if err := ss.db.QueryRowContext(
ctx,
`UPDATE storage_cleanups
- SET triggered_at = (NOW() AT TIME ZONE 'UTC')
+ SET triggered_at = NOW()
WHERE (virtual_storage, storage) IN (
SELECT virtual_storage, storage
FROM storage_cleanups