mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
Avoid dangling shared memory pointers in parallel vacuum.
When a parallel vacuum failed, the leader's VacuumSharedCostBalance and VacuumActiveNWorkers kept pointing into the parallel vacuum's DSM segment, which is gone after the abort, until the next vacuum in the same process reset them. Nothing in the current code reads them in the meantime, but it's better not to leave them dangling. Reset them at the end of vacuum(), as we already do at its start. No backpatch, as this doesn't fix any live problem. Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Discussion: https://postgr.es/m/CALj2ACW3OY7Ex-2-aits7yhRciH20r12DHcCNf+exuweR1FcMw@mail.gmail.com
This commit is contained in:
@@ -684,6 +684,9 @@ vacuum(List *relations, const VacuumParams *params, BufferAccessStrategy bstrate
|
||||
VacuumCostActive = false;
|
||||
VacuumFailsafeActive = false;
|
||||
VacuumCostBalance = 0;
|
||||
VacuumCostBalanceLocal = 0;
|
||||
VacuumSharedCostBalance = NULL;
|
||||
VacuumActiveNWorkers = NULL;
|
||||
}
|
||||
PG_END_TRY();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user