mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-30 11:30:37 +00:00
Use GetXLogReplayRecPtr only for replicas
This commit is contained in:
@@ -113,9 +113,9 @@ static bool (*old_redo_read_buffer_filter) (XLogReaderState *record, uint8 block
|
||||
#define MAX_LSN ((XLogRecPtr)~0)
|
||||
|
||||
static XLogRecPtr
|
||||
neon_get_horizon(bool latest)
|
||||
neon_get_horizon(XLogRecPtr lsn, bool latest)
|
||||
{
|
||||
return latest ? MAX_LSN : GetXLogReplayRecPtr(NULL);
|
||||
return latest ? MAX_LSN : RecoveryInProgress() ? GetXLogReplayRecPtr(NULL) : lsn;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -735,7 +735,7 @@ prefetch_do_request(PrefetchRequest *slot, bool *force_latest, XLogRecPtr *force
|
||||
prefetch_lsn = Max(prefetch_lsn, lsn);
|
||||
slot->effective_request_lsn = prefetch_lsn;
|
||||
}
|
||||
request.req.horizon = neon_get_horizon(latest);
|
||||
request.req.horizon = neon_get_horizon(request.req.lsn, latest);
|
||||
|
||||
Assert(slot->response == NULL);
|
||||
Assert(slot->my_ring_index == MyPState->ring_unused);
|
||||
@@ -1664,7 +1664,7 @@ neon_exists(SMgrRelation reln, ForkNumber forkNum)
|
||||
{
|
||||
NeonExistsRequest request = {
|
||||
.req.tag = T_NeonExistsRequest,
|
||||
.req.horizon = neon_get_horizon(latest),
|
||||
.req.horizon = neon_get_horizon(request_lsn, latest),
|
||||
.req.lsn = request_lsn,
|
||||
.rinfo = InfoFromSMgrRel(reln),
|
||||
.forknum = forkNum};
|
||||
@@ -2473,7 +2473,7 @@ neon_nblocks(SMgrRelation reln, ForkNumber forknum)
|
||||
{
|
||||
NeonNblocksRequest request = {
|
||||
.req.tag = T_NeonNblocksRequest,
|
||||
.req.horizon = neon_get_horizon(latest),
|
||||
.req.horizon = neon_get_horizon(request_lsn, latest),
|
||||
.req.lsn = request_lsn,
|
||||
.rinfo = InfoFromSMgrRel(reln),
|
||||
.forknum = forknum,
|
||||
@@ -2530,7 +2530,7 @@ neon_dbsize(Oid dbNode)
|
||||
{
|
||||
NeonDbSizeRequest request = {
|
||||
.req.tag = T_NeonDbSizeRequest,
|
||||
.req.horizon = neon_get_horizon(latest),
|
||||
.req.horizon = neon_get_horizon(request_lsn, latest),
|
||||
.req.lsn = request_lsn,
|
||||
.dbNode = dbNode,
|
||||
};
|
||||
@@ -2979,7 +2979,7 @@ neon_extend_rel_size(NRelFileInfo rinfo, ForkNumber forknum, BlockNumber blkno,
|
||||
NeonNblocksRequest request = {
|
||||
.req = (NeonRequest) {
|
||||
.lsn = end_recptr,
|
||||
.horizon = neon_get_horizon(false),
|
||||
.horizon = neon_get_horizon(end_recptr, false),
|
||||
.tag = T_NeonNblocksRequest,
|
||||
},
|
||||
.rinfo = rinfo,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import threading
|
||||
import time
|
||||
|
||||
from fixtures.log_helper import log
|
||||
from fixtures.neon_fixtures import NeonEnv, PgBin
|
||||
@@ -34,7 +33,6 @@ def test_replication_lag(neon_simple_env: NeonEnv, pg_bin: PgBin):
|
||||
t.start()
|
||||
|
||||
with env.endpoints.new_replica_start(origin=primary, endpoint_id="secondary") as secondary:
|
||||
time.sleep(10)
|
||||
for _ in range(1, n_iterations):
|
||||
primary_lsn = primary.safe_psql_scalar(
|
||||
"SELECT pg_current_wal_flush_lsn()::text", log_query=False
|
||||
|
||||
Reference in New Issue
Block a user