Postgres: TIMESTAMP WITHOUT TIME ZONE + java.sql.Timestamp stores JVM-local time; mixed-TZ fleets/DST corrupt ordering, lag, purge
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Kotlin
- スター
- 14
- フォーク
- 0
- 平均マージ
- 9時間 54分
- マージ済み PR(30日)
- 11
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
softwaremill/okapi のほかの issue
-
bug
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
softwaremill/okapi#141 ·
メンテナーはふだん 1 日以内に返信
-
OutboxProcessorListener events are emitted before the transaction commits; metrics over-count on commit failure対応中かも @rawo が今日担当しました。 オープンbreaking-change bug
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
softwaremill/okapi#137 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 4/5 1〜2日 初心者へのやさしさ 42/100
softwaremill/okapi#136 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 半日 初心者へのやさしさ 62/100
softwaremill/okapi#134 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 22/100
softwaremill/okapi#133 ·
メンテナーはふだん 1 日以内に返信
softwaremill/okapi の issue をすべて見る
似ている issue
-
autoteam community connectors/destination/mssql connectors/source/hubspot team/use
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
airbytehq/airbyte#91201 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug javascript
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Source: c7 Type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
2.23
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
ankidroid/Anki-Android#23042 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
[Submission] AI通话助手オープンsubmit-adaption submit-adaption-pre
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
BetterAndroid/android-notification-icon-project#828 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信