PostgreSQL GSI queue: another table's online GSI build stalled index propagation for 38 s
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 38/100
Hướng nghiên cứu
Start with crates/storage-postgres/src/gsi_queue.rs, especially partition_for, enqueue_gsi_pending, and the worker drain path. The reported cause is unconfirmed; repeat the run while sampling pg_stat_activity and counting gsi_pending rows by table to distinguish queue ordering from pool occupancy. Done means the measurements identify the cause and the resulting fix preserves per-key FIFO; the issue suggests scoping partitioning and the ready_at floor by table if queue sharing is confirmed.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
On the PostgreSQL backend, while one table was in an online GSI build, another table's GSI queue rows did not apply for 38 s. The cause is not established; the measurement and the code paths that could produce it are below.
What I measured
One server, index_propagation_delay_ms = 2000, two tables, each with one queue-maintained GSI.
Table A: 50,000 items, UpdateTable adding a GSI; the online build ran about 55 s.
Table B: 21 PutItem calls issued while table A's build was running.
Table B's 21 queue rows did not apply in any of the four partitions for 38 s. gsi_pending was sampled every 2.3 s and the per-partition counts stayed at 11, 4, 3, 3; no worker was waiting on a row lock; no lock timeout in the PostgreSQL log; no batch error in the server log. When table A's build finished, all 21 applied and table B's index equalled its table. The same 21 puts with nothing else running applied in 1.7 to 2.2 s.
Code paths that could produce this (not yet confirmed as the cause)
-
Queue partitions are shared across tables. In
crates/storage-postgres/src/gsi_queue.rs,partition_forhashes the base-table key alone (hash(base_key) % NUM_WORKERS), andenqueue_gsi_pendingfloorsready_atatMAX(ready_at)over the whole partition (WHERE worker_partition = $2, notable_id). Each worker drains its partition inidorder, 100 rows per wakeup. Any rows table A put on the queue during the window would sit ahead of table B's rows and set their earliest eligible time. Whether table A enqueued rows in this run was not recorded; the build copies items into the index directly and enqueues only repair rows for writes that predate the index. -
Connection pool occupancy. The build's copy and the queue workers share the server's PostgreSQL pool. If the build held every connection, the workers' claim queries would wait on the pool rather than on a row lock, which matches the sample (no lock wait, no timeout, nothing applied).
To settle it
Repeat the run with pg_stat_activity sampled alongside gsi_pending (count of connections by application_name and wait_event), and with table A's rows in gsi_pending counted separately from table B's. Whichever of the two shows up in the samples is the one to fix.
Per-key FIFO order needs all rows for one key in one partition; it does not need rows from different tables to share a partition or a ready_at floor, so option 1 has a fix with no ordering cost: include table_id in the partition hash and scope the floor to (table_id, worker_partition), with the drain-first restart the module comment already describes for a hash change.
Measured on the #401 head (f721d742) during its verification. The partition hash and the ready_at floor described above are on main unchanged by that PR; whether main shows the same stall was not measured.
- Ngôn ngữ chính
- Rust
- Star
- 517
- Fork
- 60
- Merge trung bình
- 2 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 25
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 ExtendDB/extenddb
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[storage.cassandra] accepts unknown keys silentlyCó thể đã có người làm @LeeroyHannigan đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
ExtendDB/extenddb#540 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của ExtendDB/extenddb
Issue tương tự
-
bug llm translation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
accounts bug decoding
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
wboayue/rust-ibapi#1088 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chmod -v: missing 'could not be accessed' line for operands that can't be stat'edCó thể đã có người làm @emirmrkaljevic đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
gtk-rs/gtk-rs-core#2068 ·
Maintainer thường phản hồi trong vòng 6 ngày