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

Update pageserver to store multixacts per region #51

Merged
merged 3 commits into from
Sep 14, 2023

Conversation

poojanilangekar
Copy link
Collaborator

This change ensures that the pageserver stores and server multixacts per region. The mechanism is similar to that used for CSNlog.

Comment on lines 88 to 94
fn mx_offset_to_member_page(xid: u32, region: u32) -> u32 {
((xid / pg_constants::MULTIXACT_MEMBERS_PER_PAGE as u32) * pg_constants::MAX_REGIONS as u32) + region
}

pub fn mx_offset_to_member_segment(xid: u32) -> i32 {
(mx_offset_to_member_page(xid) / pg_constants::SLRU_PAGES_PER_SEGMENT) as i32
pub fn mx_offset_to_member_segment(xid: u32, region: u32) -> i32 {
(mx_offset_to_member_page(xid, region) / pg_constants::SLRU_PAGES_PER_SEGMENT) as i32
}
Copy link
Collaborator

@ctring ctring Sep 14, 2023

Choose a reason for hiding this comment

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

In postgres, there are also MultiXactIdToOffsetPage and MultiXactIdToOffsetSegment macros to locate a multixact id in the offset slru, are there equivalence in the pageserver or are they not used there??

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh I think I see it now. In walredo, they inline the formula in the code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

About the walredo -- I was unsure as well, but they have these expected_* variables that they check for segment and offset; maybe that's the reason for computing it without the macros.

@poojanilangekar poojanilangekar merged commit 99674ce into remotexact Sep 14, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants