Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#2,134 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
32/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
c, postgresql, sql
領域
databases

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
C
スター
1.4k
フォーク
262
平均マージ
4日 20時間
マージ済み PR(30日)
57

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/cloudberry のほかの issue

apache/cloudberry の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。