Hi, I have two questions:
# spicedb
m
Hi, I have two questions: 1. In our PostgreSQL database, all of the
relation_tuple
rows were logically deleted (their
deleted_xid
was set). We're not sure what caused it, but we found that the following query was executed six times: UPDATE relation_tuple SET deleted_xid = $1 WHERE deleted_xid = $2 AND namespace = $3; Are you familiar with this query? Could you explain exactly what it is supposed to do and under what circumstances SpiceDB executes it? 2. I noticed entries in the
alembic_version
table such as
create-relationship-counters-table
and
add-index-for-transaction-gc
. What exactly do these values represent? Are they migration identifiers, and what changes do they indicate were applied to the database?
y
1. the
DeleteRelationships
api will use that query if you don't give it any additional filters. 1. yes, migration identifiers. it's a string identifier for a migration that's defined in the SpiceDB code. you're welcome to [inspect them](https://github.com/authzed/spicedb/tree/main/internal/datastore/postgres/migrations).
m
Thank you. Can the Delete API be triggered during a migration downgrade? Also, does one of the flags indicate that a migration has been performed? If so, is there a way to determine when the migration occurred?
y
no - migrations intentionally do not ever touch data. there also isn't a reverse path for migrations - they're mostly used for stepping four-phase migrations and ensuring that all of the migrations necessary for a given version have been run.
yes, each of those
zz_
files is one of the migrations, and they're in numeric order.
m
So, if my database has never gone through any migrations, should the alembic_version table be empty?
y
correct, if it even exists at all
m
Ok thanks alot🙏🏽
y
sure thing!
11 Views