-
-
Notifications
You must be signed in to change notification settings - Fork 297
varlena: support bitflag in bigendian format. #1184
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
Conversation
Postgresql has a different format for the bitflag in varlean. currently pgrx only support smallendian. adding bigendian support. Greenplum uses the bigendian format for all platforms.
This means |
The pgrx project has no facilities for testing on big endian architectures. I haven't yet validated that the new big endian impls of these macros are correct/identical-to-postgres-impls, but even if they are, we can't accept this simply because we can't test it. Is this part of a larger effort by Greenplum to offer pgrx support? If so, I'd like an opportunity to speak to someone in the company. My email is e_ridge @ tcdi.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This, of course, highlights a deeper problem, which is that we need to actually sit down and agree on the feature for enabling Greenplum support.
#[cfg(target_endian = "big")] | ||
pub use varlena_bigendian::*; | ||
#[cfg(target_endian = "little")] | ||
pub use varlena_littleendian::*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given what you said
#[cfg(target_endian = "big")] | |
pub use varlena_bigendian::*; | |
#[cfg(target_endian = "little")] | |
pub use varlena_littleendian::*; | |
#[cfg(any(feature = "greenplum7", target_endian = "big"))] | |
pub use varlena_bigendian::*; | |
#[cfg(not(any(feature = "greenplum7", target_endian = "big")))] | |
pub use varlena_littleendian::*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be clear, @workingjubilee's suggestion here is just for demonstration purposes. We are not in any position to invent a greenplum7
feature yet. Such a thing will require a significant amount of planning, design, and understanding on our part, along with the ability to test it... and test it, apparently, on disparate CPU architectures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My goal is to add greenplum support, but this PR is not related to greenplum. and this PR did not add the greenplum7
feature. If this PR gets merged, I will add gp7 support based on this PR.
this PR is not related to greenplum. for pgrx this bitflag does not use to calculate, so it is possible to use bigendian bitflag on littleendian platforms. this PR is adding the support for bitflag in bigendian format. not related to greenplum. |
Co-authored-by: Jubilee <[email protected]>
I understand that, but we strongly prefer to be able to test changes for validation of their correctness, especially with the varlena-reading tests. It is very hard for us to validate changes are correct without a big-endian system to test on, and unfortunately it isn't possible to use Rust's byte-swapping facilities such as Most of all, I don't want to approve this and then find out some other part of our code is busted as hell on big-endian systems. Better for it to fail in some blatantly obvious way... I have many grievances with Postgres but it is surprisingly good at recovering from rampant data corruption and erroring when it enters invalid states. I'd rather someone who tried to use PGRX on a big-endian system encounter an early, spectacular failure, than get far enough for them to induce a more subtle data corruption that Postgres does not detect. |
this is Ok, there is no modern CPU support big-endian anymore. I agree with you. and, just an ask, Can you accept moving most of functions to cshim? This will introduce some function call overhead, which will slightly reduce performance. this ABI problem is already handled in the C side (by static inline and macro functions) for Greenplum support, there are much more works to do. not only the things mentioned in issue 1179. |
…s, not the number of bytes.
If you're talking about e3464a1, please make a separate PR for that -- it does look like it confused length in bytes with number of elements.
Most the functions being discussed in this PR were in the cshim at one point. The primary problem with the cshim is the ability to easily cross-compile it. Some downstream pgrx users enjoy cross compiling from x86_64 to aarch64. In fact, that's a key feature of PL/Rust. Internally, we've discussed inventing some very lightweight "C to Rust" transformer that could programmatically port these types of C macros. Of course, this a) doesn't exist yet, and b) wouldn't cover everything, but I think it's a better direction. We definitely agree that hand-porting these macros is error-prone. Generally speaking, any of the Postgres #define macros or static inline functions that aren't central to general pgrx operation -- things that would be fine if unavailable when the
We'd like to support Greenplum. It's important to recognize that pgrx is developed with an understanding of the official Postgres sources/internals. Supporting deviations from that will require a lot of effort. As I mentioned earlier, I'd love an opportunity to talk to someone at Greelplum/vmware about this. In order for the pgrx core team to agree to support multiple, different products we're going to need some coordination first. I don't want to encourage you or your team to start sending us Greenplum PRs without that coordination. |
@eeeebbbbrrrr Thanks for your comments, it would be great to talk with you, and I believe we discussed Zombodb&Greenplum integration before. As a start, maybe we can discuss this in Greenplum open-source Slack channel with both the engineering and product teams. If needed, we can coordinate a time for the meeting. Slack: greenplum.slack.com |
Ok, let us wait for rust-lang/rust-bindgen#2369
From my side, this is a 20% time project. there are some people who want to use rust in his project and find pgrx is incompatible with Greenplum. and I can write Rust, and I am helping with his project. I don't know the plan at the company level. and pgrx is working with Greenplum on my fork. I think we need more tests and start internal usage first (not the company plan). I will close this PR one week after (or you can close this PR at any time). |
Is Sasasu@9f83dbb the fork you mean? |
yes, this commit breaks Postgresql support. but add Greenplum support (with cfg = pg12). |
My comment over there applies here too. |
Postgresql has an endian-dependent format for the bitflag in varlena. currently pgrx only support smallendian. adding bigendian support.
Greenplum uses the bigendian format for all platforms.
I will double check if there is some copy&past error tomorrow. :>