CancelRequest always decode message as PROTOCO 3.2 version

Đang mở
#440 1 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
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
postgresql, rust

Hướng nghiên cứu

Start by reading CancelHandler.on_cancel_request and the startup protocol negotiation path to trace how SecretKey is decoded in each flow. Compare the CancelRequest wire layouts described in the issue with the existing SecretKey variants. Done means startup and cancel handling use compatible secret keys; the issue does not name specific test files.

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

Mô tả

https://www.postgresql.org/docs/current/protocol-flow.html#PROTOCOL-FLOW-CANCELING-REQUESTS describes that cancel protocol has different flow that standard connection ie. it sends CancelRequest instead StartupMessage, so no protocol_negotiation on startup is called and default protocol (3.2) is applied.

As result all cancel_request in CancelHandler.on_cancel_request come as SecretKey::Bytes. This bring some inconsistency when on startup we can use protocol 3.0 SecretKey::I32, but in CancelHandler.on_cancel_request always get protocol 3.2 SecretKey::Bytes, so without additional normalization secret_key in startup and on_cancel_request will not match.

As I understand pgwire has no decision about CancelRequest decoding, and it fully rely what client send.

Potentially there are no reason to have SecretKey enum at all and always use bytes for secret_key.

pub enum SecretKey {
    I32(i32),
    Bytes(Bytes),
}

Moreover CancelRequest protocol 3.2 looks binary compatible with 3.0:

CancelRequest (F)
  Int32
  Int32(80877102)
  Int32
  Byten

vs

CancelRequest (F)
  Int32(16)
  Int32(80877102)
  Int32
  Int32
Ngôn ngữ chính
Rust
Star
805
Fork
88
Merge trung bình
1 ngày 7 giờ
Pull request đã merge (30 ngày)
10

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 sunng87/pgwire

Tất cả issue của sunng87/pgwire

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.