mirror of
https://github.com/postgres/postgres.git
synced 2026-04-15 22:10:45 -04:00
Reduce the scope of volatile qualifiers
Commitc66a7d75e6introduced a new "cast discards ‘volatile’" warning (-Wcast-qual) in vac_truncate_clog(). Instead of making use of unvolatize(), remove the warning by reducing the scope of the volatile qualifier (added in commit2d2e40e3be) to only 2 fields. Also do the same for vac_update_datfrozenxid(), since the intent of commitf65ab862e3was to prevent the same kind of race condition that commit2d2e40e3bewas fixing. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Suggested-by: Peter Eisentraut <peter@eisentraut.org> Reviewed-by: Nathan Bossart <nathandbossart@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/aZ3a%2BV82uSfEjDmD%40ip-10-97-1-34.eu-west-3.compute.internal
This commit is contained in:
parent
2a525cc97e
commit
f2d7570cdd
1 changed files with 10 additions and 6 deletions
|
|
@ -1665,9 +1665,11 @@ vac_update_datfrozenxid(void)
|
|||
|
||||
while ((classTup = systable_getnext(scan)) != NULL)
|
||||
{
|
||||
volatile FormData_pg_class *classForm = (Form_pg_class) GETSTRUCT(classTup);
|
||||
TransactionId relfrozenxid = classForm->relfrozenxid;
|
||||
TransactionId relminmxid = classForm->relminmxid;
|
||||
Form_pg_class classForm = (Form_pg_class) GETSTRUCT(classTup);
|
||||
volatile TransactionId *relfrozenxid_p = &classForm->relfrozenxid;
|
||||
volatile TransactionId *relminmxid_p = &classForm->relminmxid;
|
||||
TransactionId relfrozenxid = *relfrozenxid_p;
|
||||
TransactionId relminmxid = *relminmxid_p;
|
||||
|
||||
/*
|
||||
* Only consider relations able to hold unfrozen XIDs (anything else
|
||||
|
|
@ -1869,9 +1871,11 @@ vac_truncate_clog(TransactionId frozenXID,
|
|||
|
||||
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
|
||||
{
|
||||
volatile FormData_pg_database *dbform = (Form_pg_database) GETSTRUCT(tuple);
|
||||
TransactionId datfrozenxid = dbform->datfrozenxid;
|
||||
TransactionId datminmxid = dbform->datminmxid;
|
||||
Form_pg_database dbform = (Form_pg_database) GETSTRUCT(tuple);
|
||||
volatile TransactionId *datfrozenxid_p = &dbform->datfrozenxid;
|
||||
volatile TransactionId *datminmxid_p = &dbform->datminmxid;
|
||||
TransactionId datfrozenxid = *datfrozenxid_p;
|
||||
TransactionId datminmxid = *datminmxid_p;
|
||||
|
||||
Assert(TransactionIdIsNormal(datfrozenxid));
|
||||
Assert(MultiXactIdIsValid(datminmxid));
|
||||
|
|
|
|||
Loading…
Reference in a new issue