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

Commitc8aeaf3

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 parent3bd35d4 commitc8aeaf3

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
@@ -1264,9 +1264,19 @@ LogicalTapeTell(LogicalTapeSet *lts, int tapenum,
12641264

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp