From 353c725b0c76cc82b15af21d8360d03391dc6814 Mon Sep 17 00:00:00 2001 From: Matthias van de Meent Date: Fri, 11 Jul 2025 14:39:47 +0200 Subject: [PATCH] NEON: Finish Zenith->Neon rename Even though we're now part of Databricks, let's at least make this part consistent. --- src/backend/access/transam/xlog.c | 50 +++++++++++------------ src/backend/access/transam/xlogrecovery.c | 34 +++++++-------- src/backend/commands/sequence.c | 2 +- src/backend/replication/walsender.c | 2 +- src/backend/storage/buffer/bufmgr.c | 4 +- src/backend/storage/buffer/localbuf.c | 2 +- src/backend/utils/misc/guc_tables.c | 2 +- src/include/access/xlog.h | 8 ++-- src/include/storage/bufmgr.h | 2 +- 9 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index e80fed8c067..78ac3f17e12 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -679,11 +679,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, @@ -5439,11 +5439,11 @@ 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; @@ -5451,30 +5451,30 @@ readZenithSignalFile(void) 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) { @@ -5483,8 +5483,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 { @@ -5494,22 +5494,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)); } } @@ -5545,14 +5545,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, (errcode(ERRCODE_DATA_CORRUPTED), errmsg("control file contains invalid checkpoint location"))); diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c index e1027b137b9..62dd768fed4 100644 --- a/src/backend/access/transam/xlogrecovery.c +++ b/src/backend/access/transam/xlogrecovery.c @@ -762,18 +762,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 @@ -935,9 +935,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"))); @@ -1008,7 +1008,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"))); @@ -1635,7 +1635,7 @@ FinishWalRecovery(void) lastRecTLI = XLogRecoveryCtl->lastReplayedTLI; } - if (!ZenithRecoveryRequested) + if (!NeonRecoveryRequested) { XLogPrefetcherBeginRead(xlogprefetcher, lastRec); (void) ReadRecord(xlogprefetcher, PANIC, false, lastRecTLI); @@ -1675,13 +1675,13 @@ FinishWalRecovery(void) } /* - * 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 @@ -1727,7 +1727,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? } } @@ -1787,7 +1787,7 @@ ShutdownWalRecovery(void) char recoveryPath[MAXPGPATH]; /* Final update of pg_stat_recovery_prefetch. */ - if (!ZenithRecoveryRequested) + if (!NeonRecoveryRequested) { XLogPrefetcherComputeStats(xlogprefetcher); } @@ -1800,7 +1800,7 @@ ShutdownWalRecovery(void) } XLogReaderFree(xlogreader); - if (!ZenithRecoveryRequested) + if (!NeonRecoveryRequested) { XLogPrefetcherFree(xlogprefetcher); } @@ -1904,7 +1904,7 @@ PerformWalRecovery(void) else { /* just have to read next record after CheckPoint */ - if (ZenithRecoveryRequested) + if (NeonRecoveryRequested) xlogreader->ReadRecPtr = CheckPointLoc; else Assert(xlogreader->ReadRecPtr == CheckPointLoc); diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index a29550ccad8..c38a499ada9 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -55,7 +55,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. */ -/* NEON 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 diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 421341aacb1..75887416a21 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -3540,7 +3540,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 && diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index a85e4e839e5..972922506be 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -173,7 +173,7 @@ int bgwriter_flush_after = DEFAULT_BGWRITER_FLUSH_AFTER; int backend_flush_after = DEFAULT_BACKEND_FLUSH_AFTER; /* Evict unpinned pages (for better test coverage) */ -bool zenith_test_evict = false; +bool neon_test_evict = false; /* local state for LockBufferForCleanup */ @@ -2892,7 +2892,7 @@ UnpinBufferNoOwner(BufferDesc *buf) } 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) diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c index 78518a15bb6..70be4ef9cad 100644 --- a/src/backend/storage/buffer/localbuf.c +++ b/src/backend/storage/buffer/localbuf.c @@ -205,7 +205,7 @@ GetLocalVictimBuffer(void) { if (-victim_bufid - 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; } diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index 5ec8d12570d..ec9aa3c9e9f 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -2062,7 +2062,7 @@ 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 }, diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index eb1ebf4101d..d743d817ad9 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -41,9 +41,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; @@ -341,7 +341,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" diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h index ec0ac495666..939c5a955d4 100644 --- a/src/include/storage/bufmgr.h +++ b/src/include/storage/bufmgr.h @@ -173,7 +173,7 @@ extern PGDLLIMPORT int checkpoint_flush_after; extern PGDLLIMPORT int backend_flush_after; extern PGDLLIMPORT int bgwriter_flush_after; -extern bool zenith_test_evict; +extern bool neon_test_evict; /* in buf_init.c */ extern PGDLLIMPORT char *BufferBlocks;