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

Commit6c426cd

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 parent1fd0eee commit6c426cd

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
@@ -322,12 +322,14 @@ statext_store(Oid statOid,
322322
MVNDistinct*ndistinct,MVDependencies*dependencies,
323323
MCVList*mcv,VacAttrStats**stats)
324324
{
325+
Relationpg_stextdata;
325326
HeapTuplestup,
326327
oldtup;
327328
Datumvalues[Natts_pg_statistic_ext_data];
328329
boolnulls[Natts_pg_statistic_ext_data];
329330
boolreplaces[Natts_pg_statistic_ext_data];
330-
Relationpg_stextdata;
331+
332+
pg_stextdata=table_open(StatisticExtDataRelationId,RowExclusiveLock);
331333

332334
memset(nulls, true,sizeof(nulls));
333335
memset(replaces, false,sizeof(replaces));
@@ -371,8 +373,6 @@ statext_store(Oid statOid,
371373
elog(ERROR,"cache lookup failed for statistics object %u",statOid);
372374

373375
/* replace it */
374-
pg_stextdata=table_open(StatisticExtDataRelationId,RowExclusiveLock);
375-
376376
stup=heap_modify_tuple(oldtup,
377377
RelationGetDescr(pg_stextdata),
378378
values,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp