From c8aeaf3ab31edeedf1791e37c74bcedf61a916ed Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Tue, 15 Sep 2020 21:34:05 -0700 Subject: Change LogicalTapeSetBlocks() to use nBlocksWritten. Previously, it was based on nBlocksAllocated to account for tapes with open write buffers that may not have made it to the BufFile yet. That was unnecessary, because callers do not need to get the number of blocks while a tape has an open write buffer; and it also conflicted with the preallocation logic added for HashAgg. Reviewed-by: Peter Geoghegan Discussion: https://postgr.es/m/ce5af05900fdbd0e9185747825a7423c48501964.camel@j-davis.com Backpatch-through: 13 --- src/backend/executor/nodeAgg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/backend/executor') diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 28802e6588d..75e5bbf209d 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -2704,8 +2704,8 @@ agg_refill_hash_table(AggState *aggstate) if (spill_initialized) { - hash_agg_update_metrics(aggstate, true, spill.npartitions); hashagg_spill_finish(aggstate, &spill, batch->setno); + hash_agg_update_metrics(aggstate, true, spill.npartitions); } else hash_agg_update_metrics(aggstate, true, 0); -- cgit v1.2.3