Add CockroachDB support
See original GitHub issueOn the note of CockroachDB, so far i managed to get it to work by using PostgreSQL provider since it is compatible on the protocol layer. There was one issue with the Metadata table with the id column being set to serial, since in postgres serial represents a 32bit number but in cockroach it represents a 64bit number. So far i managed to get away by setting a session variable before migration by calling
SET experimental_serial_normalization = sql_sequence;
Which will force the current session to generate ids using the same format as postgres. However this is not recommended as this will make every single table accessed and created in that session to have the same effect. There are 2 possible ways to properly fix this:
- Change library’s datatype to support int64
- Create a sequence in cockroachdb and use that to generate the increment
_Originally posted by @jinhong- in https://github.com/lecaillon/Evolve/issues/111#issuecomment-480667671_
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (13 by maintainers)
Top GitHub Comments
Works alright as far as i tested it. I made use of the sequence feature to generate the id instead. This allowed me to specify the datatype as well as the limiting the running number to Int32.Max. The drawback is the insertion performance with relation to CockroachDb but this isn’t a problem considering we won’t be doing anything more than a couple of inserts every now and then
Hi @lecaillon, been a busy few weeks for me… In terms of locking, i think the way forward is to manually do locks… The logic would work something like this:
DatabaseHelper.TryAcquireApplicationLock
is called, lookup unique lockid and ensure lock is not held based on criteria that lock holder is empty or lock has expired