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

[Bug] REINDEX DATABASE CONCURRENTLY breaks temporary PAX tables created with ON COMMIT DELETE ROWS

Đang mở
#2,134 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 3 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
32/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ệ
c, postgresql, sql
Lĩnh vực
databases

Hướng nghiên cứu

Start with the reproduction in the issue, then read how the aux table is created in pax_aux_table.cc and how ON COMMIT DELETE ROWS truncation reaches heap_truncate_one_rel through CPaxNontransactionalTruncateTable. FindAuxIndexOid and the check at pax_manifest.cc:753 explain why the leftover _ccnew index breaks later inserts. Done means REINDEX DATABASE CONCURRENTLY leaves the temporary PAX table usable, with a regression test covering it.

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

Mô tả

type: Bug
Apache Cloudberry version

main

What happened

Reproduce:

CREATE TEMP TABLE p(a int) USING pax ON COMMIT DELETE ROWS DISTRIBUTED BY (a);
REINDEX DATABASE CONCURRENTLY <current_database>;
-- ERROR:  index "pg_pax_blocks_<oid>_idx_ccnew" already contains data (nbtsort.c:327)

INSERT INTO p VALUES (1);
-- ERROR:  .../pax_manifest.cc:753 C ERROR detail: (PG message: unexpected number of index of aux table: 2)
After this, every INSERT into p fails for the rest of the session.

Expected: REINDEX succeeds and the table stays usable, as it does with a non-concurrent REINDEX DATABASE, a plain PAX table, a temporary PAX table without ON COMMIT DELETE ROWS, or a heap table with ON COMMIT
DELETE ROWS.

Cause (from reading the code):

  • The aux table of a temporary PAX table is created as permanent (pax_aux_table.cc). PostgreSQL's rule of never reindexing temporary relations concurrently therefore doesn't apply, and the aux index is rebuilt
    concurrently.
  • Between the concurrent reindex's transactions, the ON COMMIT DELETE ROWS truncation (CPaxNontransactionalTruncateTable, which calls heap_truncate_one_rel) re-initializes every index on the aux table,
    including the unbuilt _ccnew index. The build step then fails.
  • The failed reindex leaves _ccnew behind. FindAuxIndexOid counts invalid indexes too, so every later write fails.
What you think should happen instead

No response

How to reproduce
CREATE TEMP TABLE p(a int) USING pax ON COMMIT DELETE ROWS DISTRIBUTED BY (a);
REINDEX DATABASE CONCURRENTLY <current_database>;
-- ERROR:  index "pg_pax_blocks_<oid>_idx_ccnew" already contains data (nbtsort.c:327)

INSERT INTO p VALUES (1);
-- ERROR:  .../pax_manifest.cc:753 C ERROR detail: (PG message: unexpected number of index of aux table: 2)
After this, every INSERT into p fails for the rest of the session.
Operating System

any

Anything else

No response

Are you willing to submit PR?
  • Yes, I am willing to submit a PR!
Code of Conduct
Ngôn ngữ chính
C
Star
1.4k
Fork
260
Merge trung bình
4 ngày 19 giờ
Pull request đã merge (30 ngày)
54

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 apache/cloudberry

Tất cả issue của apache/cloudberry

Issue tương tự

Thêm issue về C

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.