v20240124-0002-fixup.patch
text/x-patch
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v20240124-0002
Subject: fixup
| File | + | − |
|---|---|---|
| src/backend/executor/nodeIndexonlyscan.c | 22 | 6 |
From 864f40d357cf3f6667553c6e7d312ac047e9f8ce Mon Sep 17 00:00:00 2001
From: Tomas Vondra <tomas@2ndquadrant.com>
Date: Wed, 24 Jan 2024 14:09:33 +0100
Subject: [PATCH v20240124 2/2] fixup
---
src/backend/executor/nodeIndexonlyscan.c | 28 +++++++++++++++++++-----
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/src/backend/executor/nodeIndexonlyscan.c b/src/backend/executor/nodeIndexonlyscan.c
index fce10ea6518..9f75649270f 100644
--- a/src/backend/executor/nodeIndexonlyscan.c
+++ b/src/backend/executor/nodeIndexonlyscan.c
@@ -54,6 +54,11 @@ static IndexPrefetchEntry *IndexOnlyPrefetchNext(IndexScanDesc scan,
static void IndexOnlyPrefetchCleanup(IndexScanDesc scan,
void *data);
+typedef struct IndexOnlyPrefetchInfo {
+ bool all_visible;
+ IndexTuple index_tuple;
+} IndexOnlyPrefetchInfo;
+
/* ----------------------------------------------------------------
* IndexOnlyNext
*
@@ -146,12 +151,14 @@ IndexOnlyNext(IndexOnlyScanState *node)
*/
while ((entry = IndexPrefetchNext(scandesc, prefetch, direction)) != NULL)
{
- bool *all_visible = NULL;
+ IndexOnlyPrefetchInfo *info;
bool tuple_from_heap = false;
/* unpack the entry */
tid = &entry->tid;
- all_visible = (bool *) entry->data; /* result of visibility check */
+
+ /* result of visibility check and index tuple */
+ info = (IndexOnlyPrefetchInfo *) entry->data;
CHECK_FOR_INTERRUPTS();
@@ -192,7 +199,7 @@ IndexOnlyNext(IndexOnlyScanState *node)
* XXX Skip if we already know the page is all visible from
* prefetcher.
*/
- if (!(all_visible && *all_visible) &&
+ if (!(info && info->all_visible) &&
!VM_ALL_VISIBLE(scandesc->heapRelation,
ItemPointerGetBlockNumber(tid),
&node->ioss_VMBuffer))
@@ -224,6 +231,8 @@ IndexOnlyNext(IndexOnlyScanState *node)
tuple_from_heap = true;
}
+ else if (info)
+ scandesc->xs_itup = info->index_tuple;
/*
* Fill the scan tuple slot with data from the index. This might be
@@ -782,6 +791,7 @@ IndexOnlyPrefetchNext(IndexScanDesc scan, ScanDirection direction, void *data)
if ((tid = index_getnext_tid(scan, direction)) != NULL)
{
+ IndexOnlyPrefetchInfo *info;
BlockNumber blkno = ItemPointerGetBlockNumber(tid);
bool all_visible = VM_ALL_VISIBLE(scan->heapRelation,
@@ -795,9 +805,15 @@ IndexOnlyPrefetchNext(IndexScanDesc scan, ScanDirection direction, void *data)
/* prefetch only if not all visible */
entry->prefetch = !all_visible;
- /* store the all_visible flag in the private part of the entry */
- entry->data = palloc(sizeof(bool));
- *(bool *) entry->data = all_visible;
+ /*
+ * Store the index tuple and all-visible flag in the private part
+ * of the entry.
+ */
+ info = palloc(sizeof(IndexOnlyPrefetchInfo));
+ info->all_visible = all_visible;
+ info->index_tuple = CopyIndexTuple(scan->xs_itup);
+
+ entry->data = info;
}
return entry;
--
2.43.0