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

test(pageserver): add test wal record for unit testing #8015

Merged
merged 3 commits into from
Jun 13, 2024

Conversation

skyzh
Copy link
Member

@skyzh skyzh commented Jun 11, 2024

Problem

#8002

Summary of changes

We need mock WAL record to make it easier to write unit tests. This pull request adds such a record. It has clear flag and append field. The tests for legacy-enhanced compaction are not modified yet and will be part of the next pull request.

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.
  • Do we need to implement analytics? if so did you add the relevant metrics to the dashboard?
  • If this PR requires public announcement, mark it with /release-notes label and add several sentences in this section.

Checklist before merging

  • Do not forget to reformat commit message to not include the above checklist

Signed-off-by: Alex Chi Z <chi@neon.tech>
@skyzh skyzh requested a review from a team as a code owner June 11, 2024 18:39
@skyzh skyzh requested a review from problame June 11, 2024 18:39
Copy link

github-actions bot commented Jun 11, 2024

3210 tests run: 3068 passed, 0 failed, 142 skipped (full report)


Code coverage* (full report)

  • functions: 31.6% (6636 of 20995 functions)
  • lines: 48.6% (51598 of 106148 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
d20086c at 2024-06-12T17:30:54.411Z :recycle:

Copy link
Contributor

@problame problame left a comment

Choose a reason for hiding this comment

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

The clear doesn't seem to be used in tests?

Also, have you thought about another field that controls whether the record is will_init?

Approving since this is cfg(test) only and easily changeable later.

@skyzh
Copy link
Member Author

skyzh commented Jun 12, 2024

that's true, will add more tests before merging

@skyzh
Copy link
Member Author

skyzh commented Jun 12, 2024

There are some limitations with NeonWalRecords:

                let base_img = base_img.expect("Neon WAL redo requires base image").1;

I added the variants for clear/init records but did not use them in the test cases because of the above limitation. Will have a separate pull request to discuss how to deal with it. Besides that, if there are no further comments, I will get this pull request merged tomorrow.

Signed-off-by: Alex Chi Z <chi@neon.tech>
@skyzh skyzh force-pushed the skyzh/neon-test-wal-record branch from 34842ca to 96b9a47 Compare June 12, 2024 16:39
Signed-off-by: Alex Chi Z <chi@neon.tech>
@skyzh skyzh merged commit d25f7e3 into main Jun 13, 2024
64 checks passed
@skyzh skyzh deleted the skyzh/neon-test-wal-record branch June 13, 2024 13:44
save-buffer pushed a commit that referenced this pull request Jun 17, 2024
#8002

We need mock WAL record to make it easier to write unit tests. This pull
request adds such a record. It has `clear` flag and `append` field. The
tests for legacy-enhanced compaction are not modified yet and will be
part of the next pull request.

---------

Signed-off-by: Alex Chi Z <chi@neon.tech>
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.

None yet

2 participants