Postgres: TIMESTAMP WITHOUT TIME ZONE + java.sql.Timestamp stores JVM-local time; mixed-TZ fleets/DST corrupt ordering, lag, purge
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
Start with PostgresOutboxStore, which binds created_at, updated_at and last_attempt with setTimestamp and reads them back with getTimestamp, and with the Postgres schema changesets that declare these columns as TIMESTAMP. Add a migration that converts the columns to timestamptz, then switch the store to OffsetDateTime binding and reading. Done when a test passes with a non-UTC TimeZone.setDefault and the migration path for existing users is documented.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Severity: Medium · Area: okapi-postgres schema and JDBC mapping · Found in: code review of main @ e5630a1 (reasoned from pgjdbc semantics, not reproduced)
Problem
The Postgres schema declares created_at, updated_at and last_attempt as TIMESTAMP (without time zone). PostgresOutboxStore writes them with setTimestamp(Timestamp.from(instant)) and reads them with getTimestamp(...).toInstant(). pgjdbc renders a java.sql.Timestamp in the JVM default time zone, so the column stores local wall-clock time of whichever JVM wrote the row:
- Mixed-TZ fleets (e.g. one pod with
TZ=Europe/Warsaw, others UTC, or a developer laptop pointed at a shared DB):ORDER BY created_atis skewed by hours- the lag gauge (
okapi.entries.lag.seconds) is off by hours, possibly negative - the purger's
last_attempt < cutoffdeletesDELIVEREDrows hours early or keeps them hours late
- DST fall-back in a non-UTC zone: an hour of local times repeats, so two different instants map to the same stored value. Ordering and lag are wrong for that hour, and reading back can shift values by 1 h.
MySQL TIMESTAMP(6) normalizes to UTC, so this mainly affects Postgres.
Suggested fix
Migrate the columns to TIMESTAMPTZ (changeset 002 with ALTER COLUMN ... TYPE timestamptz USING ... AT TIME ZONE '<zone that wrote the data>', documented for existing users). Bind with setObject(i, instant.atOffset(ZoneOffset.UTC)) and read with getObject(col, OffsetDateTime::class.java). Add a test that runs the store with a non-UTC TimeZone.setDefault.
- Vorherrschende Sprache
- Kotlin
- Sterne
- 14
- Forks
- 0
- Ø Merge
- 9 Std. 54 Min.
- Gemergte PRs (30 T.)
- 11
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus softwaremill/okapi
-
bug
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
softwaremill/okapi#141 ·
Maintainer antworten meist innerhalb von 1 Tag
-
OutboxProcessorListener events are emitted before the transaction commits; metrics over-count on commit failureEvtl. vergeben @rawo hat das heute übernommen. Offenbreaking-change bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
softwaremill/okapi#137 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 4/5 1-2 Tage Anfängerfreundlichkeit 42/100
softwaremill/okapi#136 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 3/5 Ein halber Tag Anfängerfreundlichkeit 62/100
softwaremill/okapi#134 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 22/100
softwaremill/okapi#133 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in softwaremill/okapi
Ähnliche Issues
-
autoteam community connectors/destination/mssql connectors/source/hubspot team/use
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
airbytehq/airbyte#91201 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug javascript
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Source: c7 Type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
2.23
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
ankidroid/Anki-Android#23042 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag