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

Commitf04d1c1

Browse files
committed
Improve assertion in mdwritev()
The assertion used at the beginning of mdwritev(), that is not enabledexcept by defining -DCHECK_WRITE_VS_EXTEND as mdnblocks() is costly,forgot about the total number of blocks to write at location specifiedby the caller. The calculation is fixed to count for that, and usescasts to uint64 to ensure a proper check should the number of blocksoverflow.Using a cast is a suggestion from Tom Lane.Oversight in4908c58.Author: Xing GuoDiscussion:https://postgr.es/m/CACpMh+BM-VgKeO7suPG-VHTtpzJ+zsbDPwVHu42PLp-iTk0z+A@mail.gmail.com
1 parent4ebe51a commitf04d1c1

File tree

1 file changed

+1
-1
lines changed
  • src/backend/storage/smgr

1 file changed

+1
-1
lines changed

‎src/backend/storage/smgr/md.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ mdwritev(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
930930
{
931931
/* This assert is too expensive to have on normally ... */
932932
#ifdefCHECK_WRITE_VS_EXTEND
933-
Assert(blocknum<mdnblocks(reln,forknum));
933+
Assert((uint64)blocknum+ (uint64)nblocks <= (uint64)mdnblocks(reln,forknum));
934934
#endif
935935

936936
while (nblocks>0)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp