Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb8b94ea

Browse files
committed
Fix slot type issue for fuzzy distance index scan over out-of-core table AM.
For amcanreorderby scans the nodeIndexscan.c's reorder queue holdsheap tuples, but the underlying table likely does not. Before this fixwe'd return different types of slots, depending on whether the tuplecame from the reorder queue, or from the index + table.While that could be fixed by signalling that the node doesn't return afixed type of slot, it seems better to instead remove the separateslot for the reorder queue, and use ExecForceStoreHeapTuple() to storetuples from the queue. It's not particularly common to needreordering, after all.This reverts most of the iss_ReorderQueueSlot related changes tonodeIndexscan.c made in1a0586d, except that nowExecForceStoreHeapTuple() is used instead of ExecStoreHeapTuple().Noticed when testing zheap against the in-core version of tableam.Author: Andres Freund
1 parent88e6ad3 commitb8b94ea

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

‎src/backend/executor/nodeIndexscan.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ IndexNextWithReorder(IndexScanState *node)
196196

197197
scandesc=node->iss_ScanDesc;
198198
econtext=node->ss.ps.ps_ExprContext;
199+
slot=node->ss.ss_ScanTupleSlot;
200+
199201
if (scandesc==NULL)
200202
{
201203
/*
@@ -231,7 +233,6 @@ IndexNextWithReorder(IndexScanState *node)
231233
*/
232234
if (!pairingheap_is_empty(node->iss_ReorderQueue))
233235
{
234-
slot=node->iss_ReorderQueueSlot;
235236
topmost= (ReorderTuple*)pairingheap_first(node->iss_ReorderQueue);
236237

237238
if (node->iss_ReachedEnd||
@@ -246,22 +247,20 @@ IndexNextWithReorder(IndexScanState *node)
246247
tuple=reorderqueue_pop(node);
247248

248249
/* Pass 'true', as the tuple in the queue is a palloc'd copy */
249-
ExecStoreHeapTuple(tuple,slot, true);
250+
ExecForceStoreHeapTuple(tuple,slot, true);
250251
returnslot;
251252
}
252253
}
253254
elseif (node->iss_ReachedEnd)
254255
{
255256
/* Queue is empty, and no more tuples from index. We're done. */
256-
ExecClearTuple(node->iss_ReorderQueueSlot);
257-
returnExecClearTuple(node->ss.ss_ScanTupleSlot);
257+
returnExecClearTuple(slot);
258258
}
259259

260260
/*
261261
* Fetch next tuple from the index.
262262
*/
263263
next_indextuple:
264-
slot=node->ss.ss_ScanTupleSlot;
265264
if (!index_getnext_slot(scandesc,ForwardScanDirection,slot))
266265
{
267266
/*
@@ -354,8 +353,7 @@ IndexNextWithReorder(IndexScanState *node)
354353
* if we get here it means the index scan failed so we are at the end of
355354
* the scan..
356355
*/
357-
ExecClearTuple(node->iss_ReorderQueueSlot);
358-
returnExecClearTuple(node->ss.ss_ScanTupleSlot);
356+
returnExecClearTuple(slot);
359357
}
360358

361359
/*
@@ -807,8 +805,6 @@ ExecEndIndexScan(IndexScanState *node)
807805
*/
808806
if (node->ss.ps.ps_ResultTupleSlot)
809807
ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
810-
if (node->iss_ReorderQueueSlot)
811-
ExecClearTuple(node->iss_ReorderQueueSlot);
812808
ExecClearTuple(node->ss.ss_ScanTupleSlot);
813809

814810
/*
@@ -1055,13 +1051,9 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
10551051
indexstate->iss_OrderByNulls= (bool*)
10561052
palloc(numOrderByKeys*sizeof(bool));
10571053

1058-
/* and initialize the reorder queueand the corresponding slot*/
1054+
/* and initialize the reorder queue */
10591055
indexstate->iss_ReorderQueue=pairingheap_allocate(reorderqueue_cmp,
10601056
indexstate);
1061-
indexstate->iss_ReorderQueueSlot=
1062-
ExecAllocTableSlot(&estate->es_tupleTable,
1063-
RelationGetDescr(currentRelation),
1064-
&TTSOpsHeapTuple);
10651057
}
10661058

10671059
/*

‎src/include/nodes/execnodes.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,6 @@ typedef struct IndexScanState
13871387
bool*iss_OrderByTypByVals;
13881388
int16*iss_OrderByTypLens;
13891389
Sizeiss_PscanLen;
1390-
TupleTableSlot*iss_ReorderQueueSlot;
13911390
}IndexScanState;
13921391

13931392
/* ----------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp