Initialize index stats during parallel VACUUM.
authorPeter Geoghegan <[email protected]>
Fri, 19 Aug 2022 00:34:14 +0000 (17:34 -0700)
committerPeter Geoghegan <[email protected]>
Fri, 19 Aug 2022 00:34:14 +0000 (17:34 -0700)
Initialize shared memory allocated for index stats to avoid a hard
crash.  This was possible when parallel VACUUM became confused about the
current phase of index processing.

Oversight in commit 8e1fae1938, which refactored parallel VACUUM.

Author: Masahiko Sawada <[email protected]>
Reported-By: Justin Pryzby <[email protected]>
Discussion: https://postgr.es/m/20220818133406[email protected]
Backpatch: 15-, the first version with the refactoring commit.

src/backend/commands/vacuumparallel.c

index 1753da6c83085a45cabbc9740d0efd4123193fae..5c6f646eff916bf5d8408478dd4da168cea93ffa 100644 (file)
@@ -317,6 +317,7 @@ parallel_vacuum_init(Relation rel, Relation *indrels, int nindexes,
 
    /* Prepare index vacuum stats */
    indstats = (PVIndStats *) shm_toc_allocate(pcxt->toc, est_indstats_len);
+   MemSet(indstats, 0, est_indstats_len);
    for (int i = 0; i < nindexes; i++)
    {
        Relation    indrel = indrels[i];