-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Choose better types for the ci_sessions table #2256
Conversation
It's not so difficult to use after all and the type saves space compared to base64-encoded text.
They are easier to work with than plain integers.
It is the core Postgres type to store IP addresses.
Unfortunately this solution is not scalable. While I applaud the desire for better performing tables, in this case all of the checks are either Postgre or not Postrge, which is semi-workable now since we only have 3 drivers, but there will be more drivers down the line that get ported over. |
A single DatabaseHandler is not "scalable", but is currently the accepted solution anyway. Usually you go from "semi-workable" to "scalable" by refactoring; this could be redone when there are too many drivers to keep the checks. Worrying about it now seems premature. |
Looking back at this one and my rejection looks like it was premature. We already had postgre-specific checks in the code so I'll re-open this now. My main concern now is about the BC-breaking of changing to timestamp column type. If you can roll that part back to integers than I'm happy to include the other changes now. |
4b1774a requires one to change the type of column ci_sessions.data whenever its creation predates whatever CI version that would include this change first. I admit I haven't thought about it until now, but it feels like that would have been OK for a 4.0.0 release (or any other release expected to break compatibility). Currently I can't see 529b5ad breaking anything except applications that already exist and expect integers coming from that particular column. Again, I assumed that this change would be included in a release allowed to make such changes. dd8a920 has the potential of breaking backwards compatibility if an application has to deal with nonconforming addresses - the new behavior of Postgres rejecting those could be surprising, but perhaps healthier in the long run. An attempt to convert an existing column would result either in a failure or success - I mean, it's not something that would silently cause damage until you decide to look at it. Please feel free to make adjustments or cherry-pick any of these changes. |
@michalsn @MGatner @paulbalandan Which one of you knows Postgres enough to validate these changes? |
Sadly I know no Postgres. |
Postgres is Greek to me. 😂 Maybe @samsonasik ? |
'timestamp' => time(), | ||
'data' => $this->platform === 'postgre' ? base64_encode($sessionData) : $sessionData, | ||
'timestamp' => 'now()', | ||
'data' => $this->platform === 'postgre' ? '\x' . bin2hex($sessionData) : $sessionData, |
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.
I just remember \x
prefix is valid for hex in postgres 👍
Description
Choose better types for the ci_sessions table:
Checklist: