Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6e146a6

Browse files
committed
Change LogicalTapeSetBlocks() to use nBlocksWritten.
Previously, it was based on nBlocksAllocated to account for tapes withopen write buffers that may not have made it to the BufFile yet.That was unnecessary, because callers do not need to get the number ofblocks while a tape has an open write buffer; and it also conflictedwith the preallocation logic added for HashAgg.Reviewed-by: Peter GeogheganDiscussion:https://postgr.es/m/ce5af05900fdbd0e9185747825a7423c48501964.camel@j-davis.comBackpatch-through: 13
1 parent42a46f5 commit6e146a6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

‎src/backend/executor/nodeAgg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2704,8 +2704,8 @@ agg_refill_hash_table(AggState *aggstate)
27042704

27052705
if (spill_initialized)
27062706
{
2707-
hash_agg_update_metrics(aggstate, true,spill.npartitions);
27082707
hashagg_spill_finish(aggstate,&spill,batch->setno);
2708+
hash_agg_update_metrics(aggstate, true,spill.npartitions);
27092709
}
27102710
else
27112711
hash_agg_update_metrics(aggstate, true,0);

‎src/backend/utils/sort/logtape.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,9 +1262,19 @@ LogicalTapeTell(LogicalTapeSet *lts, int tapenum,
12621262

12631263
/*
12641264
* Obtain total disk space currently used by a LogicalTapeSet, in blocks.
1265+
*
1266+
* This should not be called while there are open write buffers; otherwise it
1267+
* may not account for buffered data.
12651268
*/
12661269
long
12671270
LogicalTapeSetBlocks(LogicalTapeSet*lts)
12681271
{
1269-
returnlts->nBlocksAllocated-lts->nHoleBlocks;
1272+
#ifdefUSE_ASSERT_CHECKING
1273+
for (inti=0;i<lts->nTapes;i++)
1274+
{
1275+
LogicalTape*lt=&lts->tapes[i];
1276+
Assert(!lt->writing||lt->buffer==NULL);
1277+
}
1278+
#endif
1279+
returnlts->nBlocksWritten-lts->nHoleBlocks;
12701280
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp