Skip to content

Commit a1843a5

Browse files
committed
Styles cleanup
1 parent f776af9 commit a1843a5

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/backend/access/heap/ptrack.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <unistd.h>
1919

2020

21-
//-8
21+
/* Effective data size */
2222
#define MAPSIZE (BLCKSZ - MAXALIGN(SizeOfPageHeaderData))
2323

2424
/* Number of bits allocated for each heap block. */
@@ -49,6 +49,7 @@ static void ptrack_set(BlockNumber heapBlk, Buffer vmBuf);
4949
void SetPtrackClearLSN(bool set_invalid);
5050
Datum pg_ptrack_test(PG_FUNCTION_ARGS);
5151

52+
/* Tracking memory block inside critical zone */
5253
void
5354
ptrack_add_block(BlockNumber block_number, RelFileNode rel)
5455
{
@@ -59,10 +60,12 @@ ptrack_add_block(BlockNumber block_number, RelFileNode rel)
5960
Assert(blocks_track_count < XLR_MAX_BLOCK_ID);
6061
}
6162

62-
void ptrack_save(void)
63+
/* Save tracked memory block after end of critical zone */
64+
void
65+
ptrack_save(void)
6366
{
6467
Buffer pbuf = InvalidBuffer;
65-
int i;
68+
unsigned int i;
6669

6770
for (i = 0; i < blocks_track_count; i++)
6871
{
@@ -88,11 +91,9 @@ void ptrack_save(void)
8891
blocks_track_count = 0;
8992
}
9093

94+
/* Set one bit to buffer */
9195
void
92-
ptrack_set(
93-
BlockNumber heapBlk,
94-
Buffer vmBuf
95-
)
96+
ptrack_set(BlockNumber heapBlk, Buffer vmBuf)
9697
{
9798
BlockNumber mapBlock = HEAPBLK_TO_MAPBLOCK(heapBlk);
9899
uint32 mapByte = HEAPBLK_TO_MAPBYTE(heapBlk);
@@ -109,6 +110,7 @@ ptrack_set(
109110

110111
if (!(map[mapByte] & (1 << mapBit)))
111112
{
113+
/* Bad luck. Take an exclusive lock now after unlock share.*/
112114
LockBuffer(vmBuf, BUFFER_LOCK_UNLOCK);
113115
LockBuffer(vmBuf, BUFFER_LOCK_EXCLUSIVE);
114116
if (!(map[mapByte] & (1 << mapBit)))
@@ -133,7 +135,7 @@ ptrack_readbuf(RelFileNode rnode, BlockNumber blkno, bool extend)
133135
SMgrRelation smgr = smgropen(rnode, InvalidBackendId);
134136

135137
/*
136-
* If we haven't cached the size of the visibility map fork yet, check it
138+
* If we haven't cached the size of the ptrack map fork yet, check it
137139
* first.
138140
*/
139141
if (smgr->smgr_ptrack_nblocks == InvalidBlockNumber)
@@ -214,7 +216,9 @@ ptrack_extend(SMgrRelation smgr, BlockNumber vm_nblocks)
214216
UnlockSmgrForExtension(smgr, ExclusiveLock);
215217
}
216218

217-
void ptrack_clear(void)
219+
/* Clear all ptrack files */
220+
void
221+
ptrack_clear(void)
218222
{
219223
HeapTuple tuple;
220224
Relation catalog = heap_open(RelationRelationId, AccessShareLock);
@@ -308,6 +312,7 @@ SetPtrackClearLSN(bool set_invalid)
308312
//LWLockRelease(ControlFileLock);
309313
}
310314

315+
/* Test ptrack file */
311316
Datum
312317
pg_ptrack_test(PG_FUNCTION_ARGS)
313318
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy