mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-26 01:20:38 +00:00
## Problem See https://neondb.slack.com/archives/C04DGM6SMTM/p1741594233757489 Consider the following scenario: 1. Backend A wants to prefetch some block B 2. Backend A checks that block B is not present in shared buffer 3. Backend A registers new prefetch request and calls prefetch_do_request 4. prefetch_do_request calls neon_get_request_lsns 5. neon_get_request_lsns obtains LwLSN for block B 6. Backend B downloads B, updates and wallogs it (let say to Lsn1) 7. Block B is once again thrown from shared buffers, its LwLSN is set to Lsn1 8. Backend A obtains current flush LSN, let's say that it is Lsn1 9. Backend A stores Lsn1 as effective_lsn in prefetch slot. 10. Backend A reads page B with LwLSN=Lsn1 11. Backend A finds in prefetch ring response for prefetch request for block B with effective_lsn=Lsn1, so that it satisfies neon_prefetch_response_usable condition 12. Backend A uses deteriorated version of the page! ## Summary of changes Use `not_modified_since` as `effective_lsn`. It should not cause some degrade of performance because we store LwLSN when it was not found in LwLSN hash, so if page is not changed till prefetch response is arrived, then LwLSN should not be changed. --------- Co-authored-by: Konstantin Knizhnik <knizhnik@neon.tech>
neon extension consists of several parts:
shared preload library neon.so
-
implements storage manager API and network communications with remote page server.
-
walproposer: implements broadcast protocol between postgres and WAL safekeepers.
-
control plane connector: Captures updates to roles/databases using ProcessUtility_hook and sends them to the control ProcessUtility_hook.
-
remote extension server: Request compute_ctl to download extension files.
-
file_cache: Local file cache is used to temporary store relations pages in local file system for better performance.
-
relsize_cache: Relation size cache for better neon performance.
SQL functions in neon--*.sql
Utility functions to expose neon specific information to user and metrics collection. This extension is created in all databases in the cluster by default.