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

Commit8d42b6b

Browse files
authored
Merge pull request#10 from funny-falcon/patch-1
Remove erroneous cast to size_t in BID_HASH_FUNC
2 parents68e0644 +7d3b7f6 commit8d42b6b

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

‎engine.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ ptrack_mark_block(RelFileNodeBackend smgr_rnode,
654654
ForkNumberforknum,BlockNumberblocknum)
655655
{
656656
PtBlockIdbid;
657-
size_thash;
657+
uint64hash;
658658
size_tslot1;
659659
size_tslot2;
660660
XLogRecPtrnew_lsn;
@@ -676,8 +676,8 @@ ptrack_mark_block(RelFileNodeBackend smgr_rnode,
676676
bid.blocknum=blocknum;
677677

678678
hash=BID_HASH_FUNC(bid);
679-
slot1=hash %PtrackContentNblocks;
680-
slot2= ((hash <<32) | (hash >>32)) %PtrackContentNblocks;
679+
slot1=(size_t)(hash %PtrackContentNblocks);
680+
slot2= (size_t)(((hash <<32) | (hash >>32)) %PtrackContentNblocks);
681681

682682
if (RecoveryInProgress())
683683
new_lsn=GetXLogReplayRecPtr(NULL);

‎engine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ typedef PtrackMapHdr * PtrackMap;
8686
/* Block address 'bid' to hash. To get slot position in map should be divided
8787
* with '% PtrackContentNblocks' */
8888
#defineBID_HASH_FUNC(bid) \
89-
(size_t)(DatumGetUInt64(hash_any_extended((unsigned char *)&bid, sizeof(bid), 0)))
89+
(DatumGetUInt64(hash_any_extended((unsigned char *)&bid, sizeof(bid), 0)))
9090

9191
/*
9292
* Per process pointer to shared ptrack_map

‎ptrack.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ ptrack_get_pagemapset(PG_FUNCTION_ARGS)
487487

488488
while (true)
489489
{
490-
size_thash;
490+
uint64hash;
491491
size_tslot1;
492492
size_tslot2;
493493
XLogRecPtrupdate_lsn1;
@@ -535,7 +535,7 @@ ptrack_get_pagemapset(PG_FUNCTION_ARGS)
535535
}
536536

537537
hash=BID_HASH_FUNC(ctx->bid);
538-
slot1=hash %PtrackContentNblocks;
538+
slot1=(size_t)(hash %PtrackContentNblocks);
539539

540540
update_lsn1=pg_atomic_read_u64(&ptrack_map->entries[slot1]);
541541

@@ -547,7 +547,7 @@ ptrack_get_pagemapset(PG_FUNCTION_ARGS)
547547
/* Only probe the second slot if the first one is marked */
548548
if (update_lsn1 >=ctx->lsn)
549549
{
550-
slot2= ((hash <<32) | (hash >>32)) %PtrackContentNblocks;
550+
slot2= (size_t)(((hash <<32) | (hash >>32)) %PtrackContentNblocks);
551551
update_lsn2=pg_atomic_read_u64(&ptrack_map->entries[slot2]);
552552

553553
if (update_lsn2!=InvalidXLogRecPtr)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp