Database support in the future?

Hi there,

I know that Storj is migrating to TiDB, but seeing this PR stir up some thoughts ci: remove CockroachDB and Spanner integration tests · storj/storj@40bb0c8 · GitHub

Looking around the Storj source code I saw this:

// https://github.com/storj/storj/blob/d6feadb8ddd510412d9134519bce92ccc555094b/satellite/satellitedb/verifyqueue.go#L174-L175

		// Note: because Cockroach does not support SKIP LOCKED, this implementation
		// is likely much less performant under any amount of contention.
		getQuery = `
			WITH next_row AS (
				SELECT inserted_at, stream_id, position
				FROM verification_audits
				ORDER BY inserted_at, stream_id, position
				FOR UPDATE
				LIMIT 1
			)
                        ...

CRDB add support for for update skip locked sometime later:

I could create a PR fix this.

But last month, when I try to run database migration on crdb latest version - there was some hiccup.

When I try to fix database migration with a PR, @elek told me there was some issue with crdb license and told me I could patch it via Dockerfile entry (as individual using crdb). That work, but does that mean crdb won’t be update in the future?

If Storj don’t support cockroachdb (or spanner) in the future, then the resource to self support as the source code change will become a problem.

For example: Storj could drop crdb/spanner driver (or just neglect the driver). I can totally understand that - no reason to support something you don’t personally use.

But that beg the question, what now? Would spanner/crdb will still be supported (finger cross for crdb)? What the verdict?

P/s: skip locked on tidb is not yet implemented Support `SKIP LOCKED` Syntax · Issue #18207 · pingcap/tidb · GitHub

Why not just using TiDB? I mean storj is going this path and license feels much more suitable for a community project. :thinking:

It’s too soon to say that, they are also venture capital funding, what guarantee they don’t do the same in the future? Are we drifting to a new database?

Of all thing, only postgres is here to stay, and it close friend crdb support will be easier.

And, just personally, I just think crdb is the superior product :sad_but_relieved_face:.

We are thinking about removing support for Spanner and CockroachDB. Reasoning for Spanner is pretty obvious, it’s closed solution, we are moving out of Spanner now and maintaining additional database is a big effort. With CRDB situation looks that they change their licensing down the road and effectively it become unusable for us as an open source solution and as I wrote earlier maintaining additional database is a big effort.

But last month, when I try to run database migration on crdb latest version - there was some hiccup.

Because of licensing our test suites are running only against quite old versions so we cannot guarantee anything with latest versions.

Worst case, we’ll vibe code a database. I mean, how hard can it be?

Not very hard, we used AI to prototype few backends to select best option for us. We have very extensive test coverage so AI have good base to create working implementation. It might not be optimal but it will work.

Is that serious or high level satire? I can’t discern..

Refusing to use all available tools is not a virtue. There is no reward for doing menial work by hand.

It’s like vibecoding a new piecestore. We can have AI generate optimized versions for all OS+file system combinations, wouldn’t that be nice?

Anyway, I’ll set up test infra and continue support crdb branch until forseenable future Commits · kocoten1992/patch_sat · GitHub.

No, it’s exactly how it was performed. We tested several candidates before select the best of them.
Of course in many cases CRDB would be better, but as explained above it doesn’t match our Open Source approach, like a Spanner as well.

Hi @michaln :person_raising_hand:, saw recent commits, is crdb here to stay?

For now we left it in the code base but we cannot promise that we will be able to give it much attention so please take that into account.

Were you able to take PR for CRDB? right now I’ve 3 commits:

  1. replace 23.2 with latest for docker
  2. merge migration query replace primary key become a single query (so it work with latest)
  3. add skip locked and remove comment about contention

If possible then I’ll create PRs.

They stopped using crdb because of new license. So that’s not gonna happen. You are riding a dead horse, accept it and move to TIDB.

I read it differently: using crdb in production is different than just maintaining it, I think storj afraid of the resource to maintain it, I can take that role, if they don’t use it in production, no way cockroach labs will be able to go after them :slight_smile:

Why should they continue to support something that can not be used in production?

It come down to 2 things:

  1. crdb is better product for small satellite (the 10M a year revenue… not even Storj Labs have it). I could maintain it if storj can’t since it pretty much syntax identical to postgres.

  2. it simply better - since the leader (postgres) is better, this blog said better than me why-postgres.

Personally, I report a few logical bugs in mysql, concurrency bug - nasty in production, create a reproduce, they verified but it stay for years (can’t check anymore since oracle change login)..

So at the moment we have no time to do analysis if we can use latest crdb (even without using it in prod) or not but maybe we could accept change 2 and 3. But as it was mentioned I think might be dead end if you plan to maintain satelite long term.

No worries, if you still maintain postgres, I’ll find a way :smiley:.