mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-04 20:12:54 +00:00
Instead of thinking in terms of 'latest' and 'lsn' of the request, each request has two LSNs: the request LSN and 'not_modified_since' LSN. The request is nominally made at the request LSN, that determines what page version we want to see. But as a hint, we also include 'not_modified_since'. It tells the pageserver that the page has not been modified since that LSN, which allows the pageserver to skip waiting for newer WAL to arrive, and could allow more optimizations in the future. Refactor the internal functions to calculate the request LSN to calculate both LSNs. Sending two LSNs to the pageserver requires using the new protocol version 2. The previous commit added the server support for it, but we still default to the old protocol for compatibility with old pageservers. The 'neon.protocol_version' GUC can be used to use the new protocol. The new protocol addresses one cause of issue #6211, although you can still get the same error if you have a standby that is lagging behind so that the page version it needs is genuinely GC'd away.
48 lines
1.4 KiB
SQL
48 lines
1.4 KiB
SQL
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
|
\echo Use "CREATE EXTENSION neon_test_utils" to load this file. \quit
|
|
|
|
CREATE FUNCTION test_consume_xids(nxids int)
|
|
RETURNS VOID
|
|
AS 'MODULE_PATHNAME', 'test_consume_xids'
|
|
LANGUAGE C STRICT
|
|
PARALLEL UNSAFE;
|
|
|
|
CREATE FUNCTION test_consume_cpu(seconds int)
|
|
RETURNS VOID
|
|
AS 'MODULE_PATHNAME', 'test_consume_cpu'
|
|
LANGUAGE C STRICT
|
|
PARALLEL UNSAFE;
|
|
|
|
CREATE FUNCTION test_consume_memory(megabytes int)
|
|
RETURNS VOID
|
|
AS 'MODULE_PATHNAME', 'test_consume_memory'
|
|
LANGUAGE C STRICT
|
|
PARALLEL UNSAFE;
|
|
|
|
CREATE FUNCTION test_release_memory(megabytes int DEFAULT NULL)
|
|
RETURNS VOID
|
|
AS 'MODULE_PATHNAME', 'test_release_memory'
|
|
LANGUAGE C
|
|
PARALLEL UNSAFE;
|
|
|
|
CREATE FUNCTION clear_buffer_cache()
|
|
RETURNS VOID
|
|
AS 'MODULE_PATHNAME', 'clear_buffer_cache'
|
|
LANGUAGE C STRICT
|
|
PARALLEL UNSAFE;
|
|
|
|
CREATE FUNCTION get_raw_page_at_lsn(relname text, forkname text, blocknum int8, request_lsn pg_lsn, not_modified_since pg_lsn)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'get_raw_page_at_lsn'
|
|
LANGUAGE C PARALLEL UNSAFE;
|
|
|
|
CREATE FUNCTION get_raw_page_at_lsn(tbspc oid, db oid, relfilenode oid, forknum int8, blocknum int8, request_lsn pg_lsn, not_modified_since pg_lsn)
|
|
RETURNS bytea
|
|
AS 'MODULE_PATHNAME', 'get_raw_page_at_lsn_ex'
|
|
LANGUAGE C PARALLEL UNSAFE;
|
|
|
|
CREATE FUNCTION neon_xlogflush(lsn pg_lsn)
|
|
RETURNS VOID
|
|
AS 'MODULE_PATHNAME', 'neon_xlogflush'
|
|
LANGUAGE C PARALLEL UNSAFE;
|