question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add CockroachDB support

See original GitHub issue

On 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:

  1. Change library’s datatype to support int64
  2. 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:closed
  • Created 4 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
jinhong-commented, Apr 8, 2019

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

0reactions
jinhong-commented, Apr 22, 2019

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:

  1. Have a table containing locks, with a lock id, lock holder id and lock expiry
  2. When 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
  3. Then, create or update lock with lock holder and lock expiry(maybe 1min). Set a schedule to renew lock every 30 seconds until release lock is called
Read more comments on GitHub >

github_iconTop Results From Across the Web

Submit a request - CockroachDB Support - Cockroach Labs
Instructions or steps to reproduce are also helpful and will save time triaging the issue. Attachments. Drag files here or click to add...
Read more >
Support Resources
If you're having an issue with CockroachDB, you can reach out for support from Cockroach Labs and our community: CockroachDB Support Portal ·...
Read more >
SQL Feature Support in CockroachDB v23.1
Retrieve a table of rows statements affect. For examples, see the INSERT and DELETE documentation. Table expressions. Component, Supported, Type, Details ...
Read more >
Third-Party Tools Supported by Cockroach Labs
The primary features of the tool are compatible with CockroachDB (e.g., connecting and basic database operations), but full integration may require additional ...
Read more >
PostgreSQL Compatibility
CockroachDB supports the PostgreSQL wire protocol and the majority of ... You can drop and add a primary key constraint within a single...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found