Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libpqwp_async_read should PQgetCopyData before PQconsumeInput #6055

Closed
arssher opened this issue Dec 6, 2023 · 0 comments
Closed

libpqwp_async_read should PQgetCopyData before PQconsumeInput #6055

arssher opened this issue Dec 6, 2023 · 0 comments
Labels
c/storage/safekeeper Component: storage: safekeeper

Comments

@arssher
Copy link
Contributor

arssher commented Dec 6, 2023

Like libpqrcv_receive. Otherwise we bloat input buffer and make it slow by constant memmoves if walproposer is slow to consume WAL stream; can be tested by setting low MAX_SEND_SIZE buf on rust size and running recovery. Found while testing
#5948
e.g.
time pytest --capture=no -k "test_late_init[debug-pg16"
with insert size increases in this test.

@arssher arssher added the c/storage/safekeeper Component: storage: safekeeper label Dec 6, 2023
arssher added a commit that referenced this issue Dec 9, 2023
It is similar to XLogReader, but when either requested segment is missing
locally or requested LSN is before basebackup_lsn NeonWALReader asynchronously
fetches WAL from one of safekeepers.

Patch includes walproposer switch to NeonWALReader, splitting wouldn't make much
sense as it is hard to test otherwise. This finally removes risk of pg_wal
explosion (as well as slow start time) when one safekeeper is lagging, at the
same time allowing to recover it.

In the future reader should also be used by logical walsender for similar
reasons (currently we download the tail on compute start synchronously).

The main test is test_lagging_sk. However, I also run it manually a lot varying
MAX_SEND_SIZE on both sides (on safekeeper and on walproposer), testing various
fragmentations (one side having small buffer, another, both), which brought up
#6055

closes #1012
arssher added a commit that referenced this issue Dec 14, 2023
To avoid a lot of redundant memmoves and bloated input buffer.

fixes #6055
arssher added a commit that referenced this issue Dec 14, 2023
To avoid a lot of redundant memmoves and bloated input buffer.

fixes #6055
arssher added a commit that referenced this issue Dec 15, 2023
It is similar to XLogReader, but when either requested segment is missing
locally or requested LSN is before basebackup_lsn NeonWALReader asynchronously
fetches WAL from one of safekeepers.

Patch includes walproposer switch to NeonWALReader, splitting wouldn't make much
sense as it is hard to test otherwise. This finally removes risk of pg_wal
explosion (as well as slow start time) when one safekeeper is lagging, at the
same time allowing to recover it.

In the future reader should also be used by logical walsender for similar
reasons (currently we download the tail on compute start synchronously).

The main test is test_lagging_sk. However, I also run it manually a lot varying
MAX_SEND_SIZE on both sides (on safekeeper and on walproposer), testing various
fragmentations (one side having small buffer, another, both), which brought up
#6055

closes #1012
arssher added a commit that referenced this issue Dec 15, 2023
To avoid a lot of redundant memmoves and bloated input buffer.

fixes #6055
arssher added a commit that referenced this issue Dec 26, 2023
It is similar to XLogReader, but when either requested segment is missing
locally or requested LSN is before basebackup_lsn NeonWALReader asynchronously
fetches WAL from one of safekeepers.

Patch includes walproposer switch to NeonWALReader, splitting wouldn't make much
sense as it is hard to test otherwise. This finally removes risk of pg_wal
explosion (as well as slow start time) when one safekeeper is lagging, at the
same time allowing to recover it.

In the future reader should also be used by logical walsender for similar
reasons (currently we download the tail on compute start synchronously).

The main test is test_lagging_sk. However, I also run it manually a lot varying
MAX_SEND_SIZE on both sides (on safekeeper and on walproposer), testing various
fragmentations (one side having small buffer, another, both), which brought up
#6055

closes #1012
arssher added a commit that referenced this issue Dec 26, 2023
To avoid a lot of redundant memmoves and bloated input buffer.

fixes #6055
arssher added a commit that referenced this issue Dec 26, 2023
It is similar to XLogReader, but when either requested segment is missing
locally or requested LSN is before basebackup_lsn NeonWALReader asynchronously
fetches WAL from one of safekeepers.

Patch includes walproposer switch to NeonWALReader, splitting wouldn't make much
sense as it is hard to test otherwise. This finally removes risk of pg_wal
explosion (as well as slow start time) when one safekeeper is lagging, at the
same time allowing to recover it.

In the future reader should also be used by logical walsender for similar
reasons (currently we download the tail on compute start synchronously).

The main test is test_lagging_sk. However, I also run it manually a lot varying
MAX_SEND_SIZE on both sides (on safekeeper and on walproposer), testing various
fragmentations (one side having small buffer, another, both), which brought up
#6055

closes #1012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/storage/safekeeper Component: storage: safekeeper
Projects
None yet
Development

No branches or pull requests

1 participant