pglite-socket: keep an extended-query batch on one connection until Sync

Đang mở
#1,192 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 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
54/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ệ
node.js, postgresql, typescript
Lĩnh vực
backend, databases

Hướng nghiên cứu

Start by reading the @electric-sql/pglite-socket 0.2.17 source for QueryQueueManager and processQueue, then inspect the related work in issues #1046 and #977. Reproduce the interleaving and queue-stall cases with concurrent pg pools, and check how the proposed batch handling affects disconnect cleanup and transaction ownership. Done means a regression test covers the reported failures and the maintainers have chosen an approach.

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

Mô tả

This is a fix proposal for #1046. The problem is still present in @electric-sql/pglite-socket 0.2.17.

  1. QueryQueueManager gives the backend to another handler after each message. Two clients that send Parse/Bind/Execute batches can interleave, which gives 08P01 (protocol violation) and 34000 (invalid cursor).
  2. When processQueue throws, it returns without clearing processing, so the queue stops for good.

Change we run locally (patched 0.1.5 since 2026-10-26):

  • A handler keeps the backend until its batch reaches Sync. Transaction ownership stays as it is.
  • On disconnect, the cleanup syncs an unfinished batch, rolls back its transaction, and releases queued connections.
  • processing is cleared in finally.

This fixed concurrent HTTP 500s with 08P01 and 34000 from pg pools in our test suite. The simple-query COPY limitation is unchanged. #977 covers part of this. Which approach do you want? We can port the change to the 0.2.17 source and add a regression test with two concurrent pg pools.

Ngôn ngữ chính
TypeScript
Star
16.3k
Fork
474
Merge trung bình
23 giờ 53 phút
Pull request đã merge (30 ngày)
53

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

  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 electric-sql/pglite

Tất cả issue của electric-sql/pglite

Issue tương tự

Thêm issue về TypeScript

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.