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

Commit4331a11

Browse files
committed
Remove incorrect Asserts in buffile.c
Both BufFileSize() and BufFileAppend() contained Asserts to ensure thegiven BufFile(s) had a valid fileset. A valid fileset isn't required ineither of these functions, so remove the Asserts and adjust thecomments accordingly.This was noticed while work was being done on a new patch to callBufFileSize() on a BufFile without a valid fileset. It seems there'scurrently no code in the tree which could trigger these Asserts, so noneed to backpatch this, for now.Reviewed-by: Peter Geoghegan, Matthias van de Meent, Tom LaneDiscussion:https://postgr.es/m/CAApHDvofgZT0VzydhyGH5MMb-XZzNDqqAbzf1eBZV5HDm3%2BosQ%40mail.gmail.com
1 parent2329cad commit4331a11

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

‎src/backend/storage/file/buffile.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -857,18 +857,16 @@ BufFileSeekBlock(BufFile *file, int64 blknum)
857857
}
858858

859859
/*
860-
*Return thecurrent fileset basedBufFile size.
860+
*Returns theamount of data in the givenBufFile, in bytes.
861861
*
862-
*Countsany holes left behind by BufFileAppend as part of the size.
862+
*Returned value includes the size ofany holes left behind by BufFileAppend.
863863
* ereport()s on failure.
864864
*/
865865
int64
866866
BufFileSize(BufFile*file)
867867
{
868868
int64lastFileSize;
869869

870-
Assert(file->fileset!=NULL);
871-
872870
/* Get the size of the last physical file. */
873871
lastFileSize=FileSize(file->files[file->numFiles-1]);
874872
if (lastFileSize<0)
@@ -883,8 +881,7 @@ BufFileSize(BufFile *file)
883881
}
884882

885883
/*
886-
* Append the contents of source file (managed within fileset) to
887-
* end of target file (managed within same fileset).
884+
* Append the contents of the source file to the end of the target file.
888885
*
889886
* Note that operation subsumes ownership of underlying resources from
890887
* "source". Caller should never call BufFileClose against source having
@@ -908,10 +905,8 @@ BufFileAppend(BufFile *target, BufFile *source)
908905
intnewNumFiles=target->numFiles+source->numFiles;
909906
inti;
910907

911-
Assert(target->fileset!=NULL);
912908
Assert(source->readOnly);
913909
Assert(!source->dirty);
914-
Assert(source->fileset!=NULL);
915910

916911
if (target->resowner!=source->resowner)
917912
elog(ERROR,"could not append BufFile with non-matching resource owner");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp