Postgres: TIMESTAMP WITHOUT TIME ZONE + java.sql.Timestamp stores JVM-local time; mixed-TZ fleets/DST corrupt ordering, lag, purge
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Kotlin
- Étoiles
- 14
- Forks
- 0
- Merge moyen
- 9 h 54 min
- PR mergées (30 j)
- 11
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de softwaremill/okapi
-
bug
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
softwaremill/okapi#141 ·
Les mainteneurs répondent en général sous 1 jour
-
OutboxProcessorListener events are emitted before the transaction commits; metrics over-count on commit failurePeut-être pris @rawo l’a pris aujourd’hui. Ouvertebreaking-change bug
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
softwaremill/okapi#137 ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement
Difficulté 4/5 1-2 jours Accessibilité débutants 42/100
softwaremill/okapi#136 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 3/5 Une demi-journée Accessibilité débutants 62/100
softwaremill/okapi#134 ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 22/100
softwaremill/okapi#133 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de softwaremill/okapi
Issues similaires
-
autoteam community connectors/destination/mssql connectors/source/hubspot team/use
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
airbytehq/airbyte#91201 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
bug javascript
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
Source: c7 Type: bug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
2.23
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
ankidroid/Anki-Android#23042 · 4 commentaires ·
Les mainteneurs répondent en général sous 1 jour