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

Abundance of usize in xlog_utils and zenith_utils::lsn #612

Open
sharnoff opened this issue Sep 15, 2021 · 0 comments
Open

Abundance of usize in xlog_utils and zenith_utils::lsn #612

sharnoff opened this issue Sep 15, 2021 · 0 comments
Labels
a/tech_debt Area: related to tech debt c/compute Component: compute, excluding postgres itself

Comments

@sharnoff
Copy link
Member

Currently, postgres_ffi::xlog_utils and zenith_utils::lsn both use usize for many of the integer arguments, even though the functions all converts it to something else later (u32 or u64). I'm sure there's other modules that do this as well, but I'm just highlighting these because I was working with them.

If possible, I think we should be explicit about the size of the integers we're expecting there, because interfacing with these tends to still require casting to a usize and back, because we read and store the data as u32s or u64s. There isn't really a good rust analog for C's "I'll take an integer of any size using #define" -- or at least not one that doesn't heavily add to code verbosity and compile times.

I opened this issue instead of just making the PR because I wanted to gauge people's thoughts/opinions on this.

@kelvich kelvich added the c/storage/pageserver Component: storage: pageserver label Dec 22, 2021
@stepashka stepashka added the a/tech_debt Area: related to tech debt label Jan 3, 2022
@shanyp shanyp added c/compute Component: compute, excluding postgres itself and removed c/storage/pageserver Component: storage: pageserver labels Jul 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a/tech_debt Area: related to tech debt c/compute Component: compute, excluding postgres itself
Projects
None yet
Development

No branches or pull requests

4 participants