Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

SQL backends: LSI Query orders items that share an index sort key differently from the service

Đang mở
#425 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue nà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
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
postgresql, rust, sqlite
Lĩnh vực
database

Hướng nghiên cứu

Start by reading order_by_columns in crates/storage-postgres/src/data/query_scan.rs and query_order_columns in crates/storage-sqlite/src/data/query_scan.rs, then run 366-probe.py against the service and ExtendDB. Measure LSI tie ordering for number and binary base sort keys and partitions with more than four tied items before choosing a rule. Done when forward and reverse results, page boundaries, and LastEvaluatedKey match the service.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Summary

On a local secondary index, when several items in one partition share the same index sort key value, ExtendDB orders them by the base table sort key in byte order. The service orders them differently, and two fresh tables gave the same order, so the order depends on the key values. Pages and LastEvaluatedKey follow each side's order, so a client paging an LSI partition with ties sees different page contents on ExtendDB than on the service.

Found while verifying the fix for #366, which keeps ExtendDB's current order unchanged; this is a separate, pre-existing divergence.

Measured against the service (2026-10-21, us-east-1)

Table with partition key pk, sort key sk, LSI on lsk. Partition p holds nine items; three groups share an lsk value. Insertion order of (sk, lsk): (t07,m) (t03,m) (T05,m) (t01,a) (t10,z) (t02,z) (t04,m) (_09,a) (t06,z).

Query on the LSI, pk = p, no limit, forward, shown as [lsk, sk]:

order
service (two fresh tables, identical) [a,_09] [a,t01] [m,t03] [m,t07] [m,t04] [m,T05] [z,t06] [z,t02] [z,t10]
ExtendDB, PostgreSQL and SQLite, main at ec81e9d4 [a,_09] [a,t01] [m,T05] [m,t03] [m,t04] [m,t07] [z,t02] [z,t06] [z,t10]

ScanIndexForward = false returns the exact mirror on both sides. With Limit set, page boundaries and LastEvaluatedKey ({lsk, pk, sk}) follow each side's order, so the second page of Limit 2 is [m,t03] [m,t07] on the service and [m,T05] [m,t03] on ExtendDB.

Within a group the service order is not byte order of sk (T05 t03 t04 t07) and not insertion order (t07 t03 T05 t04). Across groups the index sort key orders in byte order on both sides.

Expected

Items that share an LSI sort key value are returned in the order the service returns them, forward and reverse, with the same page boundaries.

Where

order_by_columns in crates/storage-postgres/src/data/query_scan.rs and query_order_columns in crates/storage-sqlite/src/data/query_scan.rs order an LSI query by (sk, base_sk) on main (and by (sk, base_pk, base_sk) after #366). The rule the service applies to ties has to be measured on more shapes before it can be implemented: the probe above used string base sort keys of mixed case; number and binary sort keys, and partitions with more than four tied items, have not been measured.

Probe

366-probe.py from the #366 work creates the table above and prints the forward and reverse order and the Limit 2, Limit 3 and Limit 1 page sequences; it runs against the service with no endpoint set and against an ExtendDB server with EXTENDDB_TEST_ENDPOINT set.

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ExtendDB/extenddb

Tất cả issue của ExtendDB/extenddb

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.