aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/pgstatfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-11-07 11:36:45 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2022-11-07 11:36:45 -0500
commit0e758ae89a20f233bb1c20a0f52ac7c81b2ef1b8 (patch)
treebec1e51709b38db24e9b9667cfd6e27c4eaa2485 /src/backend/utils/adt/pgstatfuncs.c
parenta1a7bb8f16cd5529d76850c85625039ad7aa348a (diff)
downloadpostgresql-0e758ae89a20f233bb1c20a0f52ac7c81b2ef1b8.tar.gz
postgresql-0e758ae89a20f233bb1c20a0f52ac7c81b2ef1b8.zip
Fix failure to remove non-first segments of temporary tables.
Commit 4ab5dae94 broke mdunlinkfork's logic for removing additional segments of a multi-gigabyte table, because it neglected to advance "segno" after unlinking the first segment, in the code path where it chooses to unlink that one immediately. Then the main remove loop gets ENOENT at segment zero and figures it's done, so we never remove whatever additional segments might exist. The main problem here is with large temporary tables, but WAL replay of a drop of a large regular table would also fail to remove extra segments. The third case where this path is taken is for non-main forks; but I doubt it matters for those since they probably never exceed 1GB. The simplest fix is just to increment segno after that unlink(). (Probably this logic could do with a more thorough rethink, but not with mere hours to go before 15.1 wraps.) While here, also fix an incautious assumption that register_forget_request cannot change errno. I don't think that that has any really bad consequences, as we'd end up trying to unlink the zero'th segment either way, but it greatly complicates reasoning about what could happen here. Also make a couple of other cosmetic fixes. Per bug #17679 from Balazs Szilfai. Back-patch into v15, as the faulty patch was. Discussion: https://postgr.es/m/17679-1095d04450cf6a6e@postgresql.org
Diffstat (limited to 'src/backend/utils/adt/pgstatfuncs.c')
0 files changed, 0 insertions, 0 deletions