Skip to content

PG15: NEON: Finish Zenith->Neon rename #670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/backend/access/brin/brin_xlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ brin_xlog_insert_update(XLogReaderState *record,
}

/* need this page's blkno to store in revmap */
//ZENITH XXX Don't use BufferGetBlockNumber because wal-redo doesn't pin buffer.
//NEON XXX Don't use BufferGetBlockNumber because wal-redo doesn't pin buffer.
XLogRecGetBlockTag(record, 0, NULL, NULL, &regpgno);

/* insert the index item into the page */
Expand Down
2 changes: 1 addition & 1 deletion src/backend/access/heap/visibilitymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ vm_extend(Relation rel, BlockNumber vm_nblocks)
while (vm_nblocks_now < vm_nblocks)
{
/*
* ZENITH: Initialize VM pages through buffer cache to prevent loading
* NEON: Initialize VM pages through buffer cache to prevent loading
* them from pageserver.
*/
Buffer buffer = ReadBufferExtended(rel, VISIBILITYMAP_FORKNUM, P_NEW,
Expand Down
50 changes: 25 additions & 25 deletions src/backend/access/transam/xlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,11 +653,11 @@ static MemoryContext walDebugCxt = NULL;


/*
* Variables read from 'zenith.signal' file.
* Variables read from 'neon.signal' file.
*/
bool ZenithRecoveryRequested = false;
XLogRecPtr zenithLastRec = InvalidXLogRecPtr;
bool zenithWriteOk = false;
bool NeonRecoveryRequested = false;
XLogRecPtr neonLastRec = InvalidXLogRecPtr;
bool neonWriteOk = false;


static void CleanupAfterArchiveRecovery(TimeLineID EndOfLogTLI,
Expand Down Expand Up @@ -4916,42 +4916,42 @@ CheckRequiredParameterValues(void)
}

static void
readZenithSignalFile(void)
readNeonSignalFile(void)
{
int fd;

fd = BasicOpenFile(ZENITH_SIGNAL_FILE, O_RDONLY | PG_BINARY);
fd = BasicOpenFile(NEON_SIGNAL_FILE, O_RDONLY | PG_BINARY);
if (fd >= 0)
{
struct stat statbuf;
char *content;
char prev_lsn_str[20];

/* Slurp the file into a string */
if (stat(ZENITH_SIGNAL_FILE, &statbuf) != 0)
if (stat(NEON_SIGNAL_FILE, &statbuf) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not stat file \"%s\": %m",
ZENITH_SIGNAL_FILE)));
NEON_SIGNAL_FILE)));
content = palloc(statbuf.st_size + 1);
if (read(fd, content, statbuf.st_size) != statbuf.st_size)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not read file \"%s\": %m",
ZENITH_SIGNAL_FILE)));
NEON_SIGNAL_FILE)));
content[statbuf.st_size] = '\0';

/* Parse it */
if (sscanf(content, "PREV LSN: %19s", prev_lsn_str) != 1)
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("invalid data in file \"%s\"", ZENITH_SIGNAL_FILE)));
errmsg("invalid data in file \"%s\"", NEON_SIGNAL_FILE)));

if (strcmp(prev_lsn_str, "invalid") == 0)
{
/* No prev LSN. Forbid starting up in read-write mode */
zenithLastRec = InvalidXLogRecPtr;
zenithWriteOk = false;
neonLastRec = InvalidXLogRecPtr;
neonWriteOk = false;
}
else if (strcmp(prev_lsn_str, "none") == 0)
{
Expand All @@ -4960,8 +4960,8 @@ readZenithSignalFile(void)
* to start without it. This happens when you start the compute
* node for the first time on a new branch.
*/
zenithLastRec = InvalidXLogRecPtr;
zenithWriteOk = true;
neonLastRec = InvalidXLogRecPtr;
neonWriteOk = true;
}
else
{
Expand All @@ -4971,22 +4971,22 @@ readZenithSignalFile(void)
if (sscanf(prev_lsn_str, "%X/%X", &hi, &lo) != 2)
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("invalid data in file \"%s\"", ZENITH_SIGNAL_FILE)));
zenithLastRec = ((uint64) hi) << 32 | lo;
errmsg("invalid data in file \"%s\"", NEON_SIGNAL_FILE)));
neonLastRec = ((uint64) hi) << 32 | lo;

/* If prev LSN is given, it better be valid */
if (zenithLastRec == InvalidXLogRecPtr)
if (neonLastRec == InvalidXLogRecPtr)
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("invalid prev-LSN in file \"%s\"", ZENITH_SIGNAL_FILE)));
zenithWriteOk = true;
errmsg("invalid prev-LSN in file \"%s\"", NEON_SIGNAL_FILE)));
neonWriteOk = true;
}
ZenithRecoveryRequested = true;
NeonRecoveryRequested = true;
close(fd);

elog(LOG,
"[ZENITH] found 'zenith.signal' file. setting prev LSN to %X/%X",
LSN_FORMAT_ARGS(zenithLastRec));
"[NEON] found 'neon.signal' file. setting prev LSN to %X/%X",
LSN_FORMAT_ARGS(neonLastRec));
}
}

Expand Down Expand Up @@ -5022,14 +5022,14 @@ StartupXLOG(void)
CurrentResourceOwner = AuxProcessResourceOwner;

/*
* Read zenith.signal before anything else.
* Read neon.signal before anything else.
*/
readZenithSignalFile();
readNeonSignalFile();

/*
* Check that contents look valid.
*/
if (!XRecOffIsValid(ControlFile->checkPoint) && !ZenithRecoveryRequested)
if (!XRecOffIsValid(ControlFile->checkPoint) && !NeonRecoveryRequested)
ereport(FATAL,
(errmsg("control file contains invalid checkpoint location")));

Expand Down
34 changes: 17 additions & 17 deletions src/backend/access/transam/xlogrecovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,9 +623,9 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
else if (recoveryTarget == RECOVERY_TARGET_IMMEDIATE)
ereport(LOG,
(errmsg("starting point-in-time recovery to earliest consistent point")));
else if (ZenithRecoveryRequested)
else if (NeonRecoveryRequested)
ereport(LOG,
(errmsg("starting zenith recovery")));
(errmsg("starting neon recovery")));
else
ereport(LOG,
(errmsg("starting archive recovery")));
Expand Down Expand Up @@ -782,18 +782,18 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
/* tell the caller to delete it later */
haveBackupLabel = true;
}
else if (ZenithRecoveryRequested)
else if (NeonRecoveryRequested)
{
/*
* Zenith hacks to spawn compute node without WAL. Pretend that we
* just finished reading the record that started at 'zenithLastRec'
* Neon hacks to spawn compute node without WAL. Pretend that we
* just finished reading the record that started at 'neonLastRec'
* and ended at checkpoint.redo
*/
elog(LOG, "starting with zenith basebackup at LSN %X/%X, prev %X/%X",
elog(LOG, "starting with neon basebackup at LSN %X/%X, prev %X/%X",
LSN_FORMAT_ARGS(ControlFile->checkPointCopy.redo),
LSN_FORMAT_ARGS(zenithLastRec));
LSN_FORMAT_ARGS(neonLastRec));

CheckPointLoc = zenithLastRec;
CheckPointLoc = neonLastRec;
CheckPointTLI = ControlFile->checkPointCopy.ThisTimeLineID;
RedoStartLSN = ControlFile->checkPointCopy.redo;
// FIXME needs review. rebase of ff41b709abea6a9c42100a4fcb0ff434b2c846c9
Expand Down Expand Up @@ -993,7 +993,7 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
(errmsg("invalid next transaction ID")));

/* sanity check */
if (checkPoint.redo > CheckPointLoc && !ZenithRecoveryRequested)
if (checkPoint.redo > CheckPointLoc && !NeonRecoveryRequested)
ereport(PANIC,
(errmsg("invalid redo in checkpoint record")));

Expand Down Expand Up @@ -1592,7 +1592,7 @@ FinishWalRecovery(void)
lastRecTLI = XLogRecoveryCtl->lastReplayedTLI;
}

if (!ZenithRecoveryRequested)
if (!NeonRecoveryRequested)
{
XLogPrefetcherBeginRead(xlogprefetcher, lastRec);
(void) ReadRecord(xlogprefetcher, PANIC, false, lastRecTLI);
Expand Down Expand Up @@ -1635,13 +1635,13 @@ FinishWalRecovery(void)
* buffer for appending new WAL.
*/
/*
* When starting from a zenith base backup, we don't have WAL. Initialize
* When starting from a neon base backup, we don't have WAL. Initialize
* the WAL page where we will start writing new records from scratch,
* instead.
*/
if (ZenithRecoveryRequested)
if (NeonRecoveryRequested)
{
if (!zenithWriteOk)
if (!neonWriteOk)
{
/*
* We cannot start generating new WAL if we don't have a valid prev-LSN
Expand Down Expand Up @@ -1687,7 +1687,7 @@ FinishWalRecovery(void)
result->lastPage = page;
elog(LOG, "Continue writing WAL at %X/%X", LSN_FORMAT_ARGS(xlogreader->EndRecPtr));

// FIXME: should we unlink zenith.signal?
// FIXME: should we unlink neon.signal?
}
}
else if (endOfLog % XLOG_BLCKSZ != 0)
Expand Down Expand Up @@ -1742,7 +1742,7 @@ ShutdownWalRecovery(void)
char recoveryPath[MAXPGPATH];

/* Final update of pg_stat_recovery_prefetch. */
if (!ZenithRecoveryRequested)
if (!NeonRecoveryRequested)
{
XLogPrefetcherComputeStats(xlogprefetcher);
}
Expand All @@ -1755,7 +1755,7 @@ ShutdownWalRecovery(void)
}
XLogReaderFree(xlogreader);

if (!ZenithRecoveryRequested)
if (!NeonRecoveryRequested)
{
XLogPrefetcherFree(xlogprefetcher);
}
Expand Down Expand Up @@ -1848,7 +1848,7 @@ PerformWalRecovery(void)
else
{
/* just have to read next record after CheckPoint */
if (ZenithRecoveryRequested)
if (NeonRecoveryRequested)
xlogreader->ReadRecPtr = CheckPointLoc;
else
Assert(xlogreader->ReadRecPtr == CheckPointLoc);
Expand Down
2 changes: 1 addition & 1 deletion src/backend/commands/sequence.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
* so we pre-log a few fetches in advance. In the event of
* crash we can lose (skip over) as many values as we pre-logged.
*/
/* Zenith XXX: to ensure sequence order of sequence in Zenith we need to WAL log each sequence update. */
/* Neon XXX: to ensure sequence order of sequence in Neon we need to WAL log each sequence update. */
/* #define SEQ_LOG_VALS 32 */
#define SEQ_LOG_VALS 0

Expand Down
2 changes: 1 addition & 1 deletion src/backend/replication/walsender.c
Original file line number Diff line number Diff line change
Expand Up @@ -3167,7 +3167,7 @@ WalSndDone(WalSndSendDataCallback send_data)
* flush location if valid, write otherwise. Tools like pg_receivewal will
* usually (unless in synchronous mode) return an invalid flush location.
*/
// XXX Zenith uses flush_lsn to pass extra payload, so use write_lsn here
// XXX Neon uses flush_lsn to pass extra payload, so use write_lsn here
replicatedPtr = MyWalSnd->write;

if (WalSndCaughtUp && sentPtr == replicatedPtr &&
Expand Down
8 changes: 4 additions & 4 deletions src/backend/storage/buffer/bufmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ int bgwriter_flush_after = 0;
int backend_flush_after = 0;

/* Evict unpinned pages (for better test coverage) */
bool zenith_test_evict = false;
bool neon_test_evict = false;

/* local state for StartBufferIO and related functions */
static BufferDesc *InProgressBuf = NULL;
Expand Down Expand Up @@ -944,7 +944,7 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
bufBlock = isLocalBuf ? LocalBufHdrGetBlock(bufHdr) : BufHdrGetBlock(bufHdr);
if (!PageIsNew((Page) bufBlock))
{
// XXX-ZENITH
// XXX-NEON
MemSet((char *) bufBlock, 0, BLCKSZ);
ereport(DEBUG1,
(errmsg("unexpected data beyond EOF in block %u of relation %s",
Expand Down Expand Up @@ -1583,7 +1583,7 @@ InvalidateBuffer(BufferDesc *buf)
}

/*
* NEON: Backported this from v16, to support zenith_test_evict mode. Not
* NEON: Backported this from v16, to support neon_test_evict mode. Not
* used in production.
*
* Needs to be called on a buffer with a valid tag, pinned, but without the
Expand Down Expand Up @@ -2018,7 +2018,7 @@ UnpinBuffer(BufferDesc *buf, bool fixOwner)
}
ForgetPrivateRefCountEntry(ref);

if (zenith_test_evict && !InRecovery)
if (neon_test_evict && !InRecovery)
{
buf_state = LockBufHdr(buf);
if ((buf_state & BM_VALID) && BUF_STATE_GET_REFCOUNT(buf_state) == 0)
Expand Down
4 changes: 2 additions & 2 deletions src/backend/storage/buffer/localbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "utils/memutils.h"
#include "utils/resowner_private.h"

/* ZENITH: prevent eviction of the buffer of target page */
/* NEON: prevent eviction of the buffer of target page */
extern Buffer wal_redo_buffer;

/*#define LBDEBUG*/
Expand Down Expand Up @@ -187,7 +187,7 @@ LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum,
{
if (-b - 1 == wal_redo_buffer)
{
/* ZENITH: Prevent eviction of the buffer with target wal redo page */
/* NEON: Prevent eviction of the buffer with target wal redo page */
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/backend/storage/freespace/freespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ fsm_extend(Relation rel, BlockNumber fsm_nblocks)
while (fsm_nblocks_now < fsm_nblocks)
{
/*
* ZENITH: Initialize FSM pages through buffer cache to prevent loading
* NEON: Initialize FSM pages through buffer cache to prevent loading
* them from pageserver.
*/
Buffer buffer = ReadBufferExtended(rel, FSM_FORKNUM, P_NEW, RBM_ZERO_AND_LOCK, NULL);
Expand Down
6 changes: 3 additions & 3 deletions src/backend/storage/smgr/smgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ smgrinit(void)
(*smgr_init_hook)();

/*
* ZENITH XXX
* NEON XXX
* This doesn't work with inmem_smgr, so temporarily disable.
* Anyway, we don't have any real smgrshutdown function.
*/
// /* register the shutdown proc */
// on_proc_exit(smgrshutdown, 0);
}

//ZENITH XXX See comment above. Silence compiler warning.
//NEON XXX See comment above. Silence compiler warning.
// /*
// * on_proc_exit hook for smgr cleanup during backend shutdown
// */
Expand Down Expand Up @@ -749,7 +749,7 @@ smgrimmedsync(SMgrRelation reln, ForkNumber forknum)
}

/*
* Zenith-added functions to mark the phases of an unlogged index build.
* Neon-added functions to mark the phases of an unlogged index build.
*/
void
smgr_start_unlogged_build(SMgrRelation reln)
Expand Down
2 changes: 1 addition & 1 deletion src/backend/utils/misc/guc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2209,7 +2209,7 @@ static struct config_bool ConfigureNamesBool[] =
{"neon_test_evict", PGC_POSTMASTER, UNGROUPED,
gettext_noop("Evict unpinned pages (for better test coverage)"),
},
&zenith_test_evict,
&neon_test_evict,
false,
NULL, NULL, NULL
},
Expand Down
8 changes: 4 additions & 4 deletions src/include/access/xlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ extern PGDLLIMPORT XLogRecPtr XactLastCommitEnd;
*/
#define REL_METADATA_PSEUDO_BLOCKNO InvalidBlockNumber

extern bool ZenithRecoveryRequested;
extern XLogRecPtr zenithLastRec;
extern bool zenithWriteOk;
extern bool NeonRecoveryRequested;
extern XLogRecPtr neonLastRec;
extern bool neonWriteOk;

/* these variables are GUC parameters related to XLOG */
extern PGDLLIMPORT int wal_segment_size;
Expand Down Expand Up @@ -332,7 +332,7 @@ extern restore_running_xacts_callback_t restore_running_xacts_callback;
#define TABLESPACE_MAP "tablespace_map"
#define TABLESPACE_MAP_OLD "tablespace_map.old"

#define ZENITH_SIGNAL_FILE "zenith.signal"
#define NEON_SIGNAL_FILE "neon.signal"

/* files to signal promotion to primary */
#define PROMOTE_SIGNAL_FILE "promote"
Expand Down
Loading