Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix bug with long stream identifiers when using Postgres adapter #29297
PostgreSQL has a limit on identifiers length (63 chars, docs).
Provided fix minifies identifiers longer than 63 chars by hashing them with SHA1.
It would be great to use non-cryptographic hash functions (such as Murmur or CityHash), but that would require adding new dependencies.
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @matthewd (or someone else) soon.
If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.
This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.
Please see the contribution instructions for more information.
I'm fine with SHA1 -- it shouldn't be user-controlled data, so I see no risk of collision. And it's used for network communication, so the extra time spent hashing should indeed be negligible.
It does seem a bit unfortunate to leave it totally opaque, though... is it worth keeping the first 22 characters?
Keeping in mind that we're working with long GlobalIDs, I'm not sure that would help, 'cause in that case the prefix would contain only a part of a namespace, e.g. "gid://app/MySuperModule/SubModule/Person/5" => "gid://app/MySuperModul".
Sorry I didn't reply on this earlier.
Beyond general concern about Timeout, allocating a single
As for the ARTest thing -- yeah, I just couldn't work out why that was necessary for this change. If it's Just Wrong, we should definitely fix that.
If someone needs this backported to a released version of Rails the following will work:
I drop this in my