Skip to content

Conversation

@hlinnaka
Copy link
Contributor

If no page has been evicted from page cache yet, use the latest flushed
LSN.

Commit 153dee9, "Request special lsn during bootstrap", changed this
but it is not clear to me why. As far as I can see, this isn't related
to bootstrapping, and using the latest flushed LSN should always work.

While we're at it, rearrange the code slightly for readability, and add
comments.

@hlinnaka
Copy link
Contributor Author

@lubennikovaav, can you take a look at this please? I didn't understand the changes in commit 153dee9

Copy link

@lubennikovaav lubennikovaav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit 153dee9 was introduced to fix a race when we were requesting a page before walreceiver started. To avoid eternal waiting, we simply request page with a special (invalid) LSN and pageserver just returns the latest version of the page.

see https://github.com/zenithdb/zenith/blob/main/pageserver/src/page_cache.rs#L873

Looks like this is not needed anymore, since we decided to handle shared relations and non-rels locally after initial setup.


/* The record should've been flushed already, since it was evicted, but let's be safe */
if (lsn > flushlsn)
XLogFlush(lsn);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My first thought was how is it even legal, let's use Assert instead.
But it seems to be a normal situation. Let's explain it in the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Is it legal? I can't think of a legit scenario either

If no page has been evicted from page cache yet, use the latest flushed
LSN.

Commit 153dee9, "Request special lsn during bootstrap", changed this
but it is not clear to me why. As far as I can see, this isn't related
to bootstrapping, and using the latest flushed LSN should always work.

While we're at it, rearrange the code slightly for readability, and add
comments.
@hlinnaka hlinnaka force-pushed the fix-getpage-lsn-when-nothing-evicted-yet branch from 7ac02d9 to 65b907b Compare May 4, 2021 18:52
@hlinnaka hlinnaka merged commit 65b907b into main May 4, 2021
@MMeent MMeent deleted the fix-getpage-lsn-when-nothing-evicted-yet branch September 23, 2024 14:16
dimitri pushed a commit that referenced this pull request Jul 24, 2025
primary_conninfo string is too long with password. 

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
dimitri pushed a commit that referenced this pull request Aug 5, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
dimitri pushed a commit that referenced this pull request Aug 5, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
dimitri pushed a commit that referenced this pull request Aug 5, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
dimitri pushed a commit that referenced this pull request Aug 5, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
dimitri pushed a commit that referenced this pull request Aug 6, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
dimitri pushed a commit that referenced this pull request Aug 7, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
dimitri pushed a commit that referenced this pull request Aug 7, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
dimitri pushed a commit that referenced this pull request Aug 7, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
dimitri pushed a commit that referenced this pull request Aug 7, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
dimitri pushed a commit that referenced this pull request Aug 8, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
dimitri pushed a commit that referenced this pull request Aug 8, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
dimitri pushed a commit that referenced this pull request Aug 8, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
dimitri pushed a commit that referenced this pull request Aug 8, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
tristan957 pushed a commit that referenced this pull request Aug 11, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
tristan957 pushed a commit that referenced this pull request Aug 11, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
tristan957 pushed a commit that referenced this pull request Aug 11, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
tristan957 pushed a commit that referenced this pull request Aug 11, 2025
primary_conninfo string is too long with password.

Wal receiver reads the password from NEON_AUTH_TOKEN instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants