10000 Revert "DEBUG: make _bt_advance_array_keys invariant violations into … · petergeoghegan/postgres@a82aca4 · GitHub
[go: up one dir, main page]

Skip to content

Commit a82aca4

Browse files
Revert "DEBUG: make _bt_advance_array_keys invariant violations into errors"
This reverts commit 54b6a65f59b4f1188739c8db42e87af42d6975d6.
1 parent 570bc15 commit a82aca4

File tree

4 files changed

+5
-65
lines changed

4 files changed

+5
-65
lines changed

src/backend/access/nbtree/nbtree.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ btbeginscan(Relation rel, int nkeys, int norderbys)
399399
else
400400
so->keyData = NULL;
401401

402-
so->bmsPages = NULL;
403402
so->skipScan = false;
404403
so->needPrimScan = false;
405404
so->scanBehind = false;
@@ -462,8 +461,6 @@ btrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys,
462461
_bt_killitems(scan);
463462
BTScanPosUnpinIfPinned(so->currPos);
464463
BTScanPosInvalidate(so->currPos);
465-
bms_free(so->bmsPages);
466-
so->bmsPages = NULL;
467464
if (so->log_btree_verbosity)
468465
appendStringInfo(&so->debugstr, "btrescan: BTScanPosInvalidate() called for currPos\n");
469466
}
@@ -679,8 +676,6 @@ btrestrpos(IndexScanDesc scan)
679676
{
680677
_bt_start_array_keys(scan, so->currPos.dir);
681678
so->needPrimScan = false;
682-
bms_free(so->bmsPages);
683-
so->bmsPages = NULL;
684679
}
685680
}
686681
else

src/backend/access/nbtree/nbtsearch.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,8 +1204,6 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
12041204

12051205
Assert(!BTScanPosIsValid(so->currPos));
12061206

1207-
CHECK_FOR_INTERRUPTS();
1208-
12091207
/*
12101208
* Examine the scan keys and eliminate any redundant keys; also mark the
12111209
* keys that must be matched to continue the scan.
@@ -2048,17 +2046,6 @@ _bt_readpage(IndexScanDesc scan, ScanDirection dir, OffsetNumber offnum,
20482046

20492047
so->npages++;
20502048

2051-
if (so->arrayKeys)
2052-
{
2053-
int pageNum = (int) so->currPos.currPage;
2054-
2055-
if ((ScanDirectionIsForward(dir) || offnum >= minoff) &&
2056-
bms_is_member(pageNum, so->bmsPages))
2057-
elog(ERROR, "pageNum %d already visited\n\n%s", pageNum,
2058-
so->debugstr.data);
2059-
so->bmsPages = bms_add_member(so->bmsPages, pageNum);
2060-
}
2061-
20622049
if (ScanDirectionIsForward(dir))
20632050
{
20642051
/* SK_SEARCHARRAY forward scans must provide high key up front */
@@ -2841,19 +2828,8 @@ _bt_steppage(IndexScanDesc scan, ScanDirection dir)
28412828
* keys as-is, since the next _bt_readpage will advance them.)
28422829
*/
28432830
if (so->currPos.dir != dir)
2844-
{
28452831
so->needPrimScan = false;
28462832

2847-
/*
2848-
* Have to forget every block we've read so far when scan direction
2849-
* changes. Cannot just delete previously read block (that we're
2850-
* about to read once more), since there might also be blocks beyond
2851-
* that one that were read way earlier on.
2852-
*/
2853-
bms_free(so->bmsPages);
2854-
so->bmsPages = NULL;
2855-
}
2856-
28572833
return _bt_readnextpage(scan, blkno, lastcurrblkno, dir, false);
28582834
}
28592835

@@ -3005,11 +2981,6 @@ _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno,
30052981
/* most recent _bt_readpage call (for lastcurrblkno) ended scan */
30062982
Assert(so->currPos.currPage == lastcurrblkno && !seized);
30072983
BTScanPosInvalidate(so->currPos);
3008-
if (!so->needPrimScan)
3009-
{
3010-
bms_free(so->bmsPages);
3011-
so->bmsPages = NULL;
3012-
}
30132984
_bt_parallel_done(scan); /* iff !so->needPrimScan */
30142985
return false;
30152986
}
@@ -3022,8 +2993,6 @@ _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno,
30222993
{
30232994
/* whole scan is now done (or another primitive scan required) */
30242995
BTScanPosInvalidate(so->currPos);
3025-
bms_free(so->bmsPages);
3026-
so->bmsPages = NULL;
30272996
return false;
30282997
}
30292998

@@ -3042,8 +3011,6 @@ _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno,
30423011
{
30433012
/* must have been a concurrent deletion of leftmost page */
30443013
BTScanPosInvalidate(so->currPos);
3045-
bms_free(so->bmsPages);
3046-
so->bmsPages = NULL;
30473014
_bt_parallel_done(scan);
30483015
return false;
30493016
}

src/backend/access/nbtree/nbtutils.c

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,19 +1542,8 @@ _bt_advance_array_keys(IndexScanDesc scan, BTReadPageState *pstate,
15421542
/*
15431543
* Precondition array state assertion
15441544
*/
1545-
if (!(!_bt_tuple_before_array_skeys(scan, dir, tuple, tupdesc,
1546-
tupnatts, false, 0, NULL)))
1547-
{
1548-
char *pitup;
1549-
1550-
pitup = _nbtree_print_itup(tuple, rel);
1551-
1552-
elog(ERROR, "pitup: %s\n\n %s", pitup, so->debugstr.data);
1553-
1554-
if (pitup)
1555-
pfree(pitup);
1556-
1557-
}
1545+
Assert(!_bt_tuple_before_array_skeys(scan, dir, tuple, tupdesc,
1546+
tupnatts, false, 0, NULL));
15581547

15591548
/*
15601549
* Once we return we'll have a new set of required array keys, so
@@ -2037,19 +2026,9 @@ _bt_advance_array_keys(IndexScanDesc scan, BTReadPageState *pstate,
20372026
* scan keys required in the opposite direction only; those aren't tracked
20382027
* by all_required_satisfied.
20392028
*/
2040-
if (!(_bt_tuple_before_array_skeys(scan, dir, tuple, tupdesc, tupnatts,
2041-
false, 0,
2042-
NULL) == !all_required_satisfied))
2043-
{
2044-
char *pitup;
2045-
2046-
pitup = _nbtree_print_itup(tuple, rel);
2047-
2048-
elog(ERROR, "later pitup: %s\n\n %s", pitup, so->debugstr.data);
2049-
2050-
if (pitup)
2051-
pfree(pitup);
2052-
}
2029+
Assert(_bt_tuple_before_array_skeys(scan, dir, tuple, tupdesc, tupnatts,
2030+
false, 0, NULL) ==
2031+
!all_required_satisfied);
20532032

20542033
/*
20552034
* We generally permit primitive index scans to continue onto the next

src/include/access/nbtree.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,6 @@ typedef struct BTScanOpaqueData
10561056
bool qual_ok; /* false if qual can never be satisfied */
10571057
int numberOfKeys; /* number of preprocessed scan keys */
10581058
ScanKey keyData; /* array of preprocessed scan keys */
1059-
Bitmapset *bmsPages;
10601059

10611060
/* workspace for SK_SEARCHARRAY support */
10621061
int numArrayKeys; /* number of equality-type array keys */

0 commit comments

Comments
 (0)
0