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

Commit480bc6e

Browse files
Remove unneeded nbtree array preprocessing assert.
Certain cases involving the use of cursors had assertion failures within_bt_preprocess_keys's recently added no-op return path. The assertionin question made the faulty assumption that a second or third call to_bt_preprocess_keys (within the same btrescan) could only happen whenanother scheduled primitive index scan was just about to begin.It would be possible to address the problem by only allowing scans thathave array keys to take the new no-op path, forcing affected cases toperform redundant preprocessing work. It seems simpler to just removethe assertion, and reframe the no-op path as a more general mechanism.Take this simpler approach.The important underlying principle is that we only need to performpreprocessing once per btrescan (at most). This is expected regardlessof whether or not the scan happens to have array keys.Oversight in commit1b134ca, which enhanced nbtree ScalarArrayOpexecution.Reported-By: Alexander Lakhin <exclusion@gmail.com>Discussion:https://postgr.es/m/ef0f7c8b-a6fa-362e-6fd6-054950f947ca@gmail.com
1 parent7e44ac3 commit480bc6e

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

‎src/backend/access/nbtree/nbtutils.c‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2572,19 +2572,16 @@ _bt_preprocess_keys(IndexScanDesc scan)
25722572
int*keyDataMap=NULL;
25732573
intarrayidx=0;
25742574

2575-
/*
2576-
* We're called at the start of each primitive index scan during scans
2577-
* that use equality array keys. We can just reuse the scan keys that
2578-
* were output at the start of the scan's first primitive index scan.
2579-
*/
25802575
if (so->numberOfKeys>0)
25812576
{
25822577
/*
2583-
* An earlier call to _bt_advance_array_keys already set everything up
2584-
* already. Just assert that the scan's existing output scan keys are
2585-
* consistent with its current array elements.
2578+
* Only need to do preprocessing once per btrescan, at most. All
2579+
* calls after the first are handled as no-ops.
2580+
*
2581+
* If there are array scan keys in so->keyData[], then the now-current
2582+
* array elements must already be present in each array's scan key.
2583+
* Verify that that happened using an assertion.
25862584
*/
2587-
Assert(so->numArrayKeys);
25882585
Assert(_bt_verify_keys_with_arraykeys(scan));
25892586
return;
25902587
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp