Postgres: TIMESTAMP WITHOUT TIME ZONE + java.sql.Timestamp stores JVM-local time; mixed-TZ fleets/DST corrupt ordering, lag, purge
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Kotlin
- Star
- 14
- Fork
- 0
- Merge trung bình
- 9 giờ 54 phút
- Pull request đã merge (30 ngày)
- 11
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của softwaremill/okapi
-
bug
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
softwaremill/okapi#141 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
OutboxProcessorListener events are emitted before the transaction commits; metrics over-count on commit failureCó thể đã có người làm @rawo đã nhận hôm nay. Đang mởbreaking-change bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
softwaremill/okapi#137 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 42/100
softwaremill/okapi#136 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 62/100
softwaremill/okapi#134 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 22/100
softwaremill/okapi#133 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của softwaremill/okapi
Issue tương tự
-
autoteam community connectors/destination/mssql connectors/source/hubspot team/use
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
airbytehq/airbyte#91201 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug javascript
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Source: c7 Type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
2.23
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
ankidroid/Anki-Android#23042 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Submission] AI通话助手Đang mởsubmit-adaption submit-adaption-pre
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
BetterAndroid/android-notification-icon-project#828 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày