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

Commit1d6249d

Browse files
committed
Set indcheckxmin true when REINDEX fixes an invalid or not-ready index.
Per comment from Greg Stark, it's less clear that HOT chains don't conflictwith the index than it would be for a valid index. So, let's preserve theformer behavior that indcheckxmin does get set when there arepotentially-broken HOT chains in this case. This change does not cause anypg_index update that wouldn't have happened anyway, so we're notre-introducing the previous bug with pg_index updates, and surely the caseis not significant from a performance standpoint; so let's be asconservative as possible.
1 parent8a6d60f commit1d6249d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

‎src/backend/catalog/index.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2494,7 +2494,12 @@ reindex_index(Oid indexId, bool skip_constraint_checks)
24942494
*
24952495
* We can also reset indcheckxmin, because we have now done a
24962496
* non-concurrent index build, *except* in the case where index_build
2497-
* found some still-broken HOT chains.
2497+
* found some still-broken HOT chains. If it did, we normally leave
2498+
* indcheckxmin alone (note that index_build won't have changed it,
2499+
* because this is a reindex). But if the index was invalid or not ready
2500+
* and there were broken HOT chains, it seems best to force indcheckxmin
2501+
* true, because the normal argument that the HOT chains couldn't conflict
2502+
* with the index is suspect for an invalid index.
24982503
*
24992504
* Note that it is important to not update the pg_index entry if we don't
25002505
* have to, because updating it will move the index's usability horizon
@@ -2519,10 +2524,12 @@ reindex_index(Oid indexId, bool skip_constraint_checks)
25192524
if (!indexForm->indisvalid|| !indexForm->indisready||
25202525
(indexForm->indcheckxmin&& !indexInfo->ii_BrokenHotChain))
25212526
{
2522-
indexForm->indisvalid= true;
2523-
indexForm->indisready= true;
25242527
if (!indexInfo->ii_BrokenHotChain)
25252528
indexForm->indcheckxmin= false;
2529+
elseif (!indexForm->indisvalid|| !indexForm->indisready)
2530+
indexForm->indcheckxmin= true;
2531+
indexForm->indisvalid= true;
2532+
indexForm->indisready= true;
25262533
simple_heap_update(pg_index,&indexTuple->t_self,indexTuple);
25272534
CatalogUpdateIndexes(pg_index,indexTuple);
25282535
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp