Re: [WIP]Vertical Clustered Index (columnar store extension) - take2
Timur Magomedov <t.magomedov@postgrespro.ru>
From: Timur Magomedov <t.magomedov@postgrespro.ru>
To: Peter Smith <smithpb2250@gmail.com>
Cc: "pgsql-hackers@lists.postgresql.org"
<pgsql-hackers@lists.postgresql.org>, Tomas Vondra <tomas@vondra.me>, "Aya
Iwata (Fujitsu)" <iwata.aya@fujitsu.com>, Japin Li <japinli@hotmail.com>,
shveta malik <shveta.malik@gmail.com>
Date: 2025-09-19T14:13:51Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Mark ItemPointer arguments as const throughout
- e1ac846f3d28 19 (unreleased) cited
-
Reorganize GUC structs
- a13833c35f9e 19 (unreleased) cited
-
Eliminate XLOG_HEAP2_VISIBLE from vacuum phase III
- add323da40a6 19 (unreleased) cited
-
Update various forward declarations to use typedef
- d4d1fc527bdb 19 (unreleased) cited
-
Pathify RHS unique-ification for semijoin planning
- 24225ad9aafc 19 (unreleased) cited
-
Revert "Don't lock partitions pruned by initial pruning"
- 1722d5eb05d8 18.0 cited
-
For inplace update, send nontransactional invalidations.
- 243e9b40f1b2 18.0 cited
-
Remove nearly-unused SizeOfIptrData macro.
- 8023b5827fba 10.0 cited
Attachments
- 0001-Avoid-VCI-sort-after-non-VCI-join-in-planner.patch (text/x-patch) patch 0001
Hi Peter! > What exactly did Valgrind report? For example, you said the > VciScanState points beyond allocated memory. Do you have any more > clues, like where that happened? Did you discover where that (smaller > than it should be) memory was allocated in the first place? Doing some experiments I've faced a segfault on a query joining tables filled with some amount of data. It was flaky so I used Valgrind. There is a line in vci_scan.c, exec_custom_plan_enabling_vp(): if (!scanstate->first_fetch || (scanstate->pos.num_fetched_rows <= scanstate->pos.current_row)) Valgrind reported that line as Invalid read of size 1, 4 and 4. So all three of the values checked in this line are read from some random memory, possibly allocated and used by other objects already. When the expression in exec_custom_plan_enabling_vp() randomly evaluated to true, the following ExecClearTuple() dereferences NULL in slot->tts_ops. The memory was originally allocated in nodeHashJoin.c, in hjstate = makeNode(HashJoinState) line so it is really smaller than VciScanState. I did not use any table data for reproducer since asserts helps to catch the original problem. I also simplified the original query for a reproducer. > OK. I am not 100% certain about the asserts, but since the existing > VCI tests are passing, I have merged your patch as-is into v24-0002. > I > guess we will find out later if the bug below is due to an old code > cast problem or a new code assert problem. > Thanks for merging asserts. And looks like the problem is related to VCI join nodes. There is no VCI hash join or VCI nested loop. There is a code in VCI planner that still puts VCI Sort or VCI Aggregate nodes on top of regular join nodes which makes no sense to me. This is the cause of the problem. VCI Sort and VCI Aggregate then convert outer nodes to VCI Scan since they know there can't be anything another. This can be fixed either by implementing VCI joins either by disabling them in a deeper way. Since we already have developer GUCs for them I would rather set them to disabled by default instead of removing all useful VCI joins related code. Made a patch with a test and a simplest fix (disabling joins in GUCs). -- Regards, Timur Magomedov