From 60ce5e1955188f7fd1e312d2c50e913319b9c5c9 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Wed, 19 Jul 2023 16:49:30 -0400 Subject: [PATCH] wal-g: Use "start_time" field, not "time" which is S3 modified-at. The `time` field is based on the file metadata in S3, which means that touching the file contents in S3 can move backups around in the list. Switch to using `start_time` as the sort key, which is based on the contents of the JSON file stored as part of the backup, so is not affected by changes in S3 metadata. --- puppet/zulip/files/postgresql/wal-g-exporter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/puppet/zulip/files/postgresql/wal-g-exporter b/puppet/zulip/files/postgresql/wal-g-exporter index d92c3c982b..7d422ad057 100755 --- a/puppet/zulip/files/postgresql/wal-g-exporter +++ b/puppet/zulip/files/postgresql/wal-g-exporter @@ -106,7 +106,7 @@ class WalGPrometheusServer(BaseHTTPRequestHandler): ) if len(data) > 0: - data.sort(key=lambda e: e["time"], reverse=True) + data.sort(key=lambda e: e["start_time"], reverse=True) latest = data[0] labels = { "host": latest["hostname"],