Skip to content

Commit c9b0a56

Browse files
hlinnakaMMeent
authored andcommitted
Misc cleanup, mostly to reduce unnecessary differences with upstream.
Fix indentation, remove unused definitions, resolve some FIXMEs.
1 parent f665c42 commit c9b0a56

File tree

15 files changed

+39
-48
lines changed

15 files changed

+39
-48
lines changed

src/backend/access/spgist/spginsert.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ spgbuild(Relation heap, Relation index, IndexInfo *indexInfo)
107107
SpGistInitBuffer(nullbuffer, SPGIST_LEAF | SPGIST_NULLS);
108108
MarkBufferDirty(nullbuffer);
109109

110+
110111
END_CRIT_SECTION();
111112

112113
UnlockReleaseBuffer(metabuffer);

src/backend/access/transam/xlog.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4740,7 +4740,6 @@ BootStrapXLOG(void)
47404740
ReadControlFile();
47414741
}
47424742

4743-
47444743
static char *
47454744
str_time(pg_time_t tnow)
47464745
{
@@ -6486,7 +6485,7 @@ LogCheckpointEnd(bool restartpoint)
64866485
average_sync_time = 0;
64876486
if (CheckpointStats.ckpt_sync_rels > 0)
64886487
average_sync_time = CheckpointStats.ckpt_agg_sync_time /
6489-
CheckpointStats.ckpt_sync_rels;
6488+
CheckpointStats.ckpt_sync_rels;
64906489
average_msecs = (long) ((average_sync_time + 999) / 1000);
64916490

64926491
if (restartpoint)

src/backend/access/transam/xloginsert.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,6 @@ static XLogRecData *XLogRecordAssemble(RmgrId rmid, uint8 info,
149149
static bool XLogCompressBackupBlock(char *page, uint16 hole_offset,
150150
uint16 hole_length, char *dest, uint16 *dlen);
151151

152-
/* Timeout in milliseconds for delaying WAL inserts to avoid WAL overflow */
153-
#define MB ((XLogRecPtr)1024*1024)
154-
155152
/*
156153
* Begin constructing a WAL record. This must be called before the
157154
* XLogRegister* functions and XLogInsert().

src/backend/access/transam/xlogprefetcher.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,8 +720,9 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
720720
* We could try to have a fast path for repeated references to the
721721
* same relation (with some scheme to handle invalidations
722722
* safely), but for now we'll call smgropen() every time.
723+
*
724+
* Only permanent relations are WAL-logged, so RELPERSISTENCE_PERMANENT.
723725
*/
724-
//FIXME what relpersistence should we use here?
725726
reln = smgropen(block->rnode, InvalidBackendId, RELPERSISTENCE_PERMANENT);
726727

727728
/*

src/backend/access/transam/xlogreader.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,6 @@ DecodeXLogRecord(XLogReaderState *state,
18461846
}
18471847
else
18481848
blk->hole_length = BLCKSZ - blk->bimg_len;
1849-
18501849
datatotal += blk->bimg_len;
18511850

18521851
/*
@@ -1992,7 +1991,6 @@ DecodeXLogRecord(XLogReaderState *state,
19921991

19931992
/* Report the actual size we used. */
19941993
decoded->size = MAXALIGN(out - (char *) decoded);
1995-
19961994
Assert(DecodeXLogRecordRequiredSpace(record->xl_tot_len) >=
19971995
decoded->size);
19981996

src/backend/access/transam/xlogrecovery.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,8 +1471,6 @@ FinishWalRecovery(void)
14711471
* An important side-effect of this is to load the last page into
14721472
* xlogreader. The caller uses it to initialize the WAL for writing.
14731473
*/
1474-
1475-
14761474
if (!InRecovery)
14771475
{
14781476
lastRec = CheckPointLoc;

src/backend/access/transam/xlogutils.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ XLogReadBufferForRedoExtended(XLogReaderState *record,
378378
{
379379
if (mode == RBM_ZERO_AND_LOCK || mode == RBM_ZERO_AND_CLEANUP_LOCK)
380380
{
381-
//FIXME assume relpersistence permanent. Is it always true?
382381
*buf = ReadBufferWithoutRelcache(rnode, forknum,
383382
blkno, mode, NULL, true);
384383
return BLK_DONE;

src/backend/replication/walsender.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2879,7 +2879,7 @@ XLogSendPhysical(void)
28792879
*
28802880
* In theory we could make XLogFlush() record a time in shmem whenever WAL
28812881
* is flushed and we could get that time as well as the LSN when we call
2882-
* GetFlushRecPtr(NULL) above (and likewise for the cascading standby
2882+
* GetFlushRecPtr() above (and likewise for the cascading standby
28832883
* equivalent), but rather than putting any new code into the hot WAL path
28842884
* it seems good enough to capture the time here. We should reach this
28852885
* after XLogFlush() runs WalSndWakeupProcessRequests(), and although that
@@ -2974,8 +2974,8 @@ XLogSendPhysical(void)
29742974
Assert(nbytes <= MAX_SEND_SIZE);
29752975

29762976
/*
2977-
* OK to read and send the slice.
2978-
*/
2977+
* OK to read and send the slice.
2978+
*/
29792979
if (output_message.data)
29802980
resetStringInfo(&output_message);
29812981
else
@@ -2987,32 +2987,32 @@ XLogSendPhysical(void)
29872987
pq_sendint64(&output_message, 0); /* sendtime, filled in last */
29882988

29892989
/*
2990-
* Read the log directly into the output buffer to avoid extra memcpy
2991-
* calls.
2992-
*/
2990+
* Read the log directly into the output buffer to avoid extra memcpy
2991+
* calls.
2992+
*/
29932993
enlargeStringInfo(&output_message, nbytes);
29942994

29952995
retry:
29962996
if (!WALRead(xlogreader,
2997-
&output_message.data[output_message.len],
2998-
startptr,
2999-
nbytes,
3000-
xlogreader->seg.ws_tli, /* Pass the current TLI because
3001-
* only WalSndSegmentOpen controls
3002-
* whether new TLI is needed. */
3003-
&errinfo))
2997+
&output_message.data[output_message.len],
2998+
startptr,
2999+
nbytes,
3000+
xlogreader->seg.ws_tli, /* Pass the current TLI because
3001+
* only WalSndSegmentOpen controls
3002+
* whether new TLI is needed. */
3003+
&errinfo))
30043004
WALReadRaiseError(&errinfo);
30053005

30063006
/* See logical_read_xlog_page(). */
30073007
XLByteToSeg(startptr, segno, xlogreader->segcxt.ws_segsize);
30083008
CheckXLogRemoved(segno, xlogreader->seg.ws_tli);
30093009

30103010
/*
3011-
* During recovery, the currently-open WAL file might be replaced with the
3012-
* file of the same name retrieved from archive. So we always need to
3013-
* check what we read was valid after reading into the buffer. If it's
3014-
* invalid, we try to open and read the file again.
3015-
*/
3011+
* During recovery, the currently-open WAL file might be replaced with the
3012+
* file of the same name retrieved from archive. So we always need to
3013+
* check what we read was valid after reading into the buffer. If it's
3014+
* invalid, we try to open and read the file again.
3015+
*/
30163016
if (am_cascading_walsender)
30173017
{
30183018
WalSnd *walsnd = MyWalSnd;
@@ -3035,12 +3035,12 @@ XLogSendPhysical(void)
30353035
output_message.data[output_message.len] = '\0';
30363036

30373037
/*
3038-
* Fill the send timestamp last, so that it is taken as late as possible.
3039-
*/
3038+
* Fill the send timestamp last, so that it is taken as late as possible.
3039+
*/
30403040
resetStringInfo(&tmpbuf);
30413041
pq_sendint64(&tmpbuf, GetCurrentTimestamp());
30423042
memcpy(&output_message.data[1 + sizeof(int64) + sizeof(int64)],
3043-
tmpbuf.data, sizeof(int64));
3043+
tmpbuf.data, sizeof(int64));
30443044

30453045
pq_putmessage_noblock('d', output_message.data, output_message.len);
30463046

@@ -3078,7 +3078,7 @@ XLogSendLogical(void)
30783078
/*
30793079
* We'll use the current flush point to determine whether we've caught up.
30803080
* This variable is static in order to cache it across calls. Caching is
3081-
* helpful because GetFlushRecPtr(NULL) needs to acquire a heavily-contended
3081+
* helpful because GetFlushRecPtr() needs to acquire a heavily-contended
30823082
* spinlock.
30833083
*/
30843084
static XLogRecPtr flushPtr = InvalidXLogRecPtr;

src/backend/storage/buffer/bufmgr.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include "utils/timestamp.h"
5959
#include "replication/walsender.h"
6060

61+
6162
/* Note: these two macros only work on shared buffers, not local ones! */
6263
#define BufHdrGetBlock(bufHdr) ((Block) (BufferBlocks + ((Size) (bufHdr)->buf_id) * BLCKSZ))
6364
#define BufferGetLSN(bufHdr) (PageGetLSN(BufHdrGetBlock(bufHdr)))
@@ -806,13 +807,14 @@ ReadBufferWithoutRelcache(RelFileNode rnode, ForkNumber forkNum,
806807
bool hit;
807808

808809
SMgrRelation smgr = smgropen(rnode, InvalidBackendId,
809-
RELPERSISTENCE_PERMANENT);
810+
RELPERSISTENCE_PERMANENT);
810811

811812
return ReadBuffer_common(smgr, permanent ? RELPERSISTENCE_PERMANENT :
812813
RELPERSISTENCE_UNLOGGED, forkNum, blockNum,
813814
mode, strategy, &hit);
814815
}
815816

817+
816818
/*
817819
* ReadBuffer_common -- common logic for all ReadBuffer variants
818820
*

src/backend/storage/page/bufpage.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ PageRestoreTempPage(Page tempPage, Page oldPage)
427427

428428
pageSize = PageGetPageSize(tempPage);
429429
memcpy((char *) oldPage, (char *) tempPage, pageSize);
430+
430431
pfree(tempPage);
431432
}
432433

src/backend/utils/misc/guc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ static int syslog_facility = 0;
193193
static void assign_syslog_facility(int newval, void *extra);
194194
static void assign_syslog_ident(const char *newval, void *extra);
195195
static void assign_session_replication_role(int newval, void *extra);
196-
197196
static bool check_temp_buffers(int *newval, void **extra, GucSource source);
198197
static bool check_bonjour(bool *newval, void **extra, GucSource source);
199198
static bool check_ssl(bool *newval, void **extra, GucSource source);
@@ -12309,7 +12308,6 @@ assign_session_replication_role(int newval, void *extra)
1230912308
ResetPlanCache();
1231012309
}
1231112310

12312-
1231312311
static bool
1231412312
check_temp_buffers(int *newval, void **extra, GucSource source)
1231512313
{

src/include/access/xlog.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@
2626
#define SYNC_METHOD_OPEN_DSYNC 4 /* for O_DSYNC */
2727
extern PGDLLIMPORT int sync_method;
2828

29-
3029
extern PGDLLIMPORT XLogRecPtr ProcLastRecPtr;
3130
extern PGDLLIMPORT XLogRecPtr XactLastRecEnd;
32-
3331
extern PGDLLIMPORT XLogRecPtr XactLastCommitEnd;
3432

3533
/*

src/include/access/xlogreader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ struct XLogReaderState
216216
/* Set when XLP_FIRST_IS_OVERWRITE_CONTRECORD is found */
217217
XLogRecPtr overwrittenRecPtr;
218218

219-
/* Disable validation to allow dumpng corrupt WAL */
219+
/* Disable validation to allow dumping corrupt WAL */
220220
bool skip_page_validation;
221221
bool skip_invalid_records;
222222
bool skip_lsn_checks;

src/include/replication/walsender.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ extern void WalSndRqstFileReload(void);
5151

5252
/*
5353
* Hook to check for WAL receiving backpressure.
54-
* Return value in microseconds */
54+
* Return value in microseconds
55+
*/
5556
extern uint64 (*delay_backend_us)(void);
5657

5758
/* expose these so that they can be reused by the neon walproposer extension */
@@ -60,12 +61,12 @@ extern TimeOffset LagTrackerRead(int head, XLogRecPtr lsn, TimestampTz now);
6061
extern void ProcessStandbyReply(XLogRecPtr writePtr, XLogRecPtr flushPtr,
6162
XLogRecPtr applyPtr, TimestampTz replyTime,
6263
bool replyRequested);
63-
void PhysicalConfirmReceivedLocation(XLogRecPtr lsn);
64-
void ProcessStandbyHSFeedback(TimestampTz replyTime,
65-
TransactionId feedbackXmin,
66-
uint32 feedbackEpoch,
67-
TransactionId feedbackCatalogXmin,
68-
uint32 feedbackCatalogEpoch);
64+
extern void PhysicalConfirmReceivedLocation(XLogRecPtr lsn);
65+
extern void ProcessStandbyHSFeedback(TimestampTz replyTime,
66+
TransactionId feedbackXmin,
67+
uint32 feedbackEpoch,
68+
TransactionId feedbackCatalogXmin,
69+
uint32 feedbackCatalogEpoch);
6970

7071
/*
7172
* Remember that we want to wakeup walsenders later

src/include/storage/bufmgr.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,6 @@ extern void BufferGetTag(Buffer buffer, RelFileNode *rnode,
230230

231231
extern void MarkBufferDirtyHint(Buffer buffer, bool buffer_std);
232232

233-
extern void MarkBufferPermanent(Buffer buffer);
234-
235233
extern void UnlockBuffers(void);
236234
extern void LockBuffer(Buffer buffer, int mode);
237235
extern bool ConditionalLockBuffer(Buffer buffer);

0 commit comments

Comments
 (0)