Postgres: TIMESTAMP WITHOUT TIME ZONE + java.sql.Timestamp stores JVM-local time; mixed-TZ fleets/DST corrupt ordering, lag, purge
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Kotlin
- Stelle
- 14
- Fork
- 0
- Merge medio
- 9h 54m
- PR unite (30g)
- 11
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di softwaremill/okapi
-
bug
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
softwaremill/okapi#141 ·
I maintainer di solito rispondono entro 1 giorno
-
OutboxProcessorListener events are emitted before the transaction commits; metrics over-count on commit failureForse già presa @rawo l’ha presa oggi. Apertabreaking-change bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
softwaremill/okapi#137 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 4/5 1-2 giorni Idoneità per principianti 42/100
softwaremill/okapi#136 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 Mezza giornata Idoneità per principianti 62/100
softwaremill/okapi#134 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 22/100
softwaremill/okapi#133 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di softwaremill/okapi
Issue simili
-
autoteam community connectors/destination/mssql connectors/source/hubspot team/use
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
airbytehq/airbyte#91201 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug javascript
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Source: c7 Type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
2.23
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
ankidroid/Anki-Android#23042 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Submission] AI通话助手Apertasubmit-adaption submit-adaption-pre
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
BetterAndroid/android-notification-icon-project#828 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno