authzed / spicedb

Open Source, Google Zanzibar-inspired database for scalably storing and querying fine-grained authorization data
https://authzed.com/docs
Apache License 2.0
4.99k stars 267 forks source link

Read replica support for Postgres and MySQL datastores #1878

Closed josephschorr closed 3 months ago

benny-yamagata commented 5 months ago

Just to clarify, this update will allow spice to use multiple reader nodes for postgres and mysql? So if I have 3 readers I would be able to pass in the entries for all of them to be used?

josephschorr commented 5 months ago

@benny-yamagata Yes, the replica URI parameter is a list of URIs and the system will round robin between them

josephschorr commented 5 months ago

I don't think the implementation will work for that more common use case because the datastore snapshot reader does not use a single transaction.

It uses a single connection, which means it should stay connected to the same replica

ecordell commented 5 months ago

It uses a single connection, which means it should stay connected to the same replica

I possibly just missed it, but it looked like you were using a pgxpool.Conn for the read replicas which cycles actual connections out from under itself.

josephschorr commented 5 months ago

It uses a single connection, which means it should stay connected to the same replica

I possibly just missed it, but it looked like you were using a pgxpool.Conn for the read replicas which cycles actual connections out from under itself.

Yeah, I traced it and it does use the pool. We'll have to do something else

josephschorr commented 3 months ago

Updated

josephschorr commented 3 months ago

Updated