Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[UPDATED]
This branch will attempt to add cockroachdb support to flowable.
I would like to get some feedback on preferences in regards to the implementation options.
Cockroachdb's core strategy seems to be to focus on being postgres compatible for ORM's and other tools. Although they may in future start supporting tools specifically so that cockroach's unique features can be better exploited.
I have run some tests with manually altered schema and this works, but automated schema upgrades present some challenges especially around transactions.
Implementation options
1. Create a new database in all places it is required, new scripts, new properties.
This approach is challenging for the following reasons:
a. The JDBC driver returns product as postgresql and even the versions are postgres versions. The recommended way to detect cockroach over postgres is to run the following query: select version() from which CockroachDB can be extracted.
The posthres driver hardcodes product name, but could retrieve it from a handshake parameters called crdb_version as used by other cockroach tools like pgasync. I tested making this change to the driver, it's simple and works, but I am not sure if a pull request would be accepted for this, even though it seems more correct than hardcoding. I suspect it would break tools that work with the driver currently (it sounds like hibernate works to some extent).
b. Liquibase might need a custom extension as there is none yet. This is not particularly hard to do and it has the concept of priority when overriding databases. Need is maybe a strong word, because so far I have been able to make changes to changesets that do work on the postgres implementation.
c. More work is required to keep schemas up to date, especially the non-liquibase ones.
2. Try to align postgres and cockroachdb implementations, to be compatible with each other.
This approach is challenging for its own reasons.
a. Foreign keys require indexes but you can't create them in the same transaction, not without postgres incompatible syntax. One option is to execute foreign keys in a second transaction which is not quite ideal (this approach is part of my initial commits). I opened an issue at cockroach here: cockroachdb/cockroach#24578
So this may be resolved in future.
b. Other such issues may arise in future, and one the differentiation then becomes a bit more haphazard.
c. More care needs to go into postgres scripts to make sure they don't disobey cockroach semantics.
Summary of issues found
I opened issues at cockroach for the following:
Postgresql JDBC driver hangs with certain sequence of queries cockroachdb/cockroach#24578
This requires starting a fresh transaction right before ddl scripts are run.
Comments