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

Make another walcraft test more robust #7439

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

hlinnaka
Copy link
Contributor

There were two issues with the test at page boundaries:

  1. If the first logical message with 10 bytes payload crossed a page boundary, the calculated 'base_size' was too large because it included the page header.

  2. If it was inserted near the end of a page so that there was not enough room for another one, we did "remaining_lsn += XLOG_BLCKSZ" but that didn't take into account the page headers either.

As a result, the test would fail if the WAL insert position at the beginning of the test was too close to the end of a WAL page. Fix the calculations by repeating the 10-byte logical message if the starting position is not suitable.

I bumped into this with PR #7377; it changed the arguments of a few SQL functions in neon_test_utils extension, which changed the WAL positions slightly, and caused a test failure.

This is similar to #7436, but for different test.

@hlinnaka hlinnaka requested review from a team as code owners April 19, 2024 23:35
@hlinnaka hlinnaka force-pushed the make-walcraft-test-less-fragile-2 branch from 03797c4 to 6450d25 Compare April 19, 2024 23:36
Copy link

github-actions bot commented Apr 20, 2024

2766 tests run: 2648 passed, 0 failed, 118 skipped (full report)


Code coverage* (full report)

  • functions: 28.1% (6459 of 23019 functions)
  • lines: 46.8% (45554 of 97385 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
d208092 at 2024-04-22T06:49:26.928Z :recycle:

@hlinnaka hlinnaka force-pushed the make-walcraft-test-less-fragile-2 branch from 6450d25 to ab65e74 Compare April 21, 2024 20:11
There were two issues with the test at page boundaries:

1. If the first logical message with 10 bytes payload crossed a page
   boundary, the calculated 'base_size' was too large because it included
   the page header.

2. If it was inserted near the end of a page so that there was not
   enough room for another one, we did "remaining_lsn += XLOG_BLCKSZ"
   but that didn't take into account the page headers either.

As a result, the test would fail if the WAL insert position at the
beginning of the test was too close to the end of a WAL page. Fix the
calculations by repeating the 10-byte logical message if the starting
position is not suitable.

I bumped into this with PR #7377; it changed the arguments of a few
SQL functions in neon_test_utils extension, which changed the WAL
positions slightly, and caused a test failure.
@hlinnaka hlinnaka force-pushed the make-walcraft-test-less-fragile-2 branch from ab65e74 to d208092 Compare April 22, 2024 06:07
@hlinnaka hlinnaka requested a review from bayandin April 22, 2024 06:09
@hlinnaka hlinnaka merged commit 00d9c2d into main Apr 22, 2024
53 checks passed
@hlinnaka hlinnaka deleted the make-walcraft-test-less-fragile-2 branch April 22, 2024 07:58
arssher added a commit that referenced this pull request May 2, 2024
Fixing it has limited use because postgres can always write some more WAL,
spoiling expectations (in particular, ensure! below still rarely fails).
arssher added a commit that referenced this pull request May 2, 2024
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.

2 participants