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

Commitfe30365

Browse files
committed
Fix race condition in statext_store().
Must hold some lock on the pg_statistic_ext_data catalog *before*we look up the tuple we aim to replace. Otherwise a concurrentVACUUM FULL or similar operation could move it to a different TID,leaving us trying to replace the wrong tuple.Back-patch to v12 where this got broken.Credit goes to Dean Rasheed; I'm just doing the clerical work.Discussion:https://postgr.es/m/CAEZATCU0zHMDiQV0g8P2U+YSP9C1idUPrn79DajsbonwkN0xvQ@mail.gmail.com
1 parent33cd0e5 commitfe30365

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎src/backend/statistics/extended_stats.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,12 +493,14 @@ statext_store(Oid statOid,
493493
MVNDistinct*ndistinct,MVDependencies*dependencies,
494494
MCVList*mcv,VacAttrStats**stats)
495495
{
496+
Relationpg_stextdata;
496497
HeapTuplestup,
497498
oldtup;
498499
Datumvalues[Natts_pg_statistic_ext_data];
499500
boolnulls[Natts_pg_statistic_ext_data];
500501
boolreplaces[Natts_pg_statistic_ext_data];
501-
Relationpg_stextdata;
502+
503+
pg_stextdata=table_open(StatisticExtDataRelationId,RowExclusiveLock);
502504

503505
memset(nulls, true,sizeof(nulls));
504506
memset(replaces, false,sizeof(replaces));
@@ -542,8 +544,6 @@ statext_store(Oid statOid,
542544
elog(ERROR,"cache lookup failed for statistics object %u",statOid);
543545

544546
/* replace it */
545-
pg_stextdata=table_open(StatisticExtDataRelationId,RowExclusiveLock);
546-
547547
stup=heap_modify_tuple(oldtup,
548548
RelationGetDescr(pg_stextdata),
549549
values,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp