-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Feature request: CockroachDB support #990
Comments
I really want to avoid having another migration table like here. I also suspect that the two issues you mentioned wont be the only ones. I'm not sure how well CockroachDB works with SQL and specifically more complex join and lock statements. As most cloud providers support manages postgres and mysql at very low cost (but not cockroach), adding cockroach is not a priority for this project. |
The idea is to have the same migration table as the postgres one, I'm aligned with you here.
CockroachDB is working hard making everything pg-compat so if something doesn't work it should be fixed in the upstream and not here.
Can you point me to concrete SQL sentences, the more complex one you can think of?
Yeah, but CockroachDB is open-source (at least most of its features) and with a growing user base. Great PostgreSQL compatibility, automatic sharding (world-wide capable), NoSQL capabilities, Geo-Partitioning and cloud-native philosophy (no need for an operator to run inside a k8s cluster, for example) makes this a great database to start with.
Would you be open to do some reviews of further PRs at least? Thanks for your time. |
Of course, this is a particularly nasty one.
With pg-flavoured SQL-compatibility it should be no work to get it working with this project. How far away are they from achieving that?
Review yes but no guarantee of merging. This is not about "oh I don't like nothing that isn't MySQL or PostgreSQL" or "I dismiss the upsides of the project". Instead the issue is that including this in master implies that we:
None of these four things are something we can currently afford wrt to resources. Depending on the PR it may be possible that we have an "implicit" compatibility with CDB, but if CDB specific issues are addressed in a new migration "table"/instruction or existing migrations change (would bring serious trouble) this can't be merged. I am however happy to review a PR regarding this, maybe it's much less stuff that changes than I think it is. |
It can be more or less performant due to joins but I think that should work. Inner joins with a pattern matching which is also supported.
They are fixing the issues one by one but my feeling is that they are not too far from having a huge list of statement compatibilities. Take a look to a list of database management tools here.
IMHO merging doesn't mean official support, as you said what about just implicit compatibility and test it out explicitly adding a note saying that "[...] although it seems CockroachDB to be working properly no official support is given"?
Cool, no much time ATM but will do as soon as I can, lets discuss on the PR(s). Making proposals without promises are the most comforting jobs after all ;) Thanks again, |
That's not how this project works :) If we're including stuff in the codebase, it's supported. With implicit support I mean that there will be no extra migrations, integration, nor e2e tests that check if this actually works! This means that future upgrades might not work with CDB or break the database (very unlikely but possible). If we're making substantial code changes it means that it needs to be tested, and with tests we must maintain it. I hope you understand this reasoning here. But again, if it's possible to do this without any funkiness, let's try it! |
For the migration part, would it hurt too badly to add a new column with the right settings, move data from old to new column, remove old column and rename new column to old's name? |
That really depends, there are production instances with millions of tokens - depending on which table this touches that could cause some serious db downtime. Which one is it? |
So far it only seems to be So my current take on the issue, would be to create new tables and migrate data over, which seems silly. Essentially what I had to do, to make Hydra work with Cockroach, was to run the migrations on a normal Postgres installation, and then export the structure. Not ideal, but good enough for my use-case for now. |
Which column is causing the trouble? The latest patch introduces real primary keys (uint, serial) to all tables iirc. |
Migrations causing trouble:
|
Ah ok, I see. I am more inclined now than I was back in August to have CockroachDB officially supported. The new migration layout would potentially allow to run different migrations for each database, so theoretically, we could add just one new migration file for cockroach db. |
Another problem I had while trying to figure out which migrations failed, is the fact that it's not telling me which line/query in the migration that failed, so I had to narrow it down myself. Example right now:
I can easily find the file, but since it's a migration on the 'large' side, it's a bit tough to easily spot the failing one. I basically just run each query one by one, and fix it manually. |
This given:
Would you be open to receive/review a PR adding support for CockroachDB? At least to discuss it. I could propose some changes to accomplish this. |
Yup! |
I've been advancing on this, so I'll send a draft PR shortly, just to start the discussion :) |
add support for cockroachdb, related to ory/hydra#990
Great job @lopezator! |
Resolved #1348 |
Woohoo! 🎉 |
I'm evaluating Hydra v1.0.0-beta.8 and its compatibility with CockroachDB and I can confirm that except for two issues, things are working properly.
These two issues are:
ALTER COLUMN ... SET NOT NULL
is not supported by CockroachDB which is required by this migration. They've opened an issue for tracking this feature request (sql: support ALTER TABLE ALTER COLUMN SET NOT NULL cockroachdb/cockroach#28751) and for your interest this probably was triggered by the issue I raised some days ago sql: compatibility with ORY Hydra cockroachdb/cockroach#28415, PR: sql: support ALTER COLUMN SET NOT NULL cockroachdb/cockroach#37554.WHERE
statement are not supported although there is a work-around by callingSET sql_safe_updates = false
explicitly in the current connection or transaction. Another one could be to modify current migration to do anUPDATE .. WHERE (SELECT *)
or something like that. Nothing to do here, for details take a look here: sql: CockroachDB does not support updating session vars via UPDATE to pg_settings cockroachdb/cockroach#28826 (comment).WDYT, are you open to include CockroachDB support?
Update:
It seems like CockroachDB people is working on adding support for
ALTER TABLE ... ALTER COLUM ... SET NOT NULL
, take a look at cockroachdb/cockroach#37554.The text was updated successfully, but these errors were encountered: