英文:
SpiceDB relation tuples left in db
问题
我正在使用 spicedb 与 PostgreSQL 数据库,我注意到当我删除一个关系时,相应的元组会保留在 relation_tuple
表中,而 deleted_xid
列的值被设置为事务 ID。
这些记录会永远保留吗?它们什么时候才会被实际删除?
我担心在相对短的时间内,表中将充满无用的记录...
英文:
I'm using spicedb with postgres database, I've noticed that when I delete a Relation the corresponding tuple is left in the relation_tuple
table and the value of the column deleted_xid
is set to transaction id.
Are those records to remain there forever? When will they be actually deleted?
I'm worrying that in a relative short time the table will be clogged with useless records...
答案1
得分: 0
为了实现“时间旅行查询”,SpiceDB的Postgres数据存储实际上在删除后保留数据一段时间。
这些数据可用的时间、垃圾收集的频率以及垃圾收集的超时时间都是可配置的。
从spicedb serve --help
的用法中:
--datastore-gc-interval duration
:垃圾收集之间的时间间隔(仅适用于Postgres驱动程序)(默认值为3分钟)。--datastore-gc-max-operation-time duration
:垃圾收集 pass 可以操作的最长时间(仅适用于Postgres驱动程序)(默认值为1分钟)。--datastore-gc-window duration
:修订被垃圾回收之前的时间段(默认值为24小时)。
如果您感兴趣,您可以深入了解实现,阅读此特定文件:https://github.com/authzed/spicedb/blob/v1.25.0/internal/datastore/postgres/gc.go。
英文:
In order to implement "time-traveling queries", SpiceDB's Postgres datastore implementation actually retains data for a period of time after deletion.
How long this data is available, how often garbage collection is conducted, and how long until garbage collection times out are all configurable.
From the spicedb serve --help
usage:
--datastore-gc-interval duration amount of time between passes of garbage collection (postgres driver only) (default 3m0s)
--datastore-gc-max-operation-time duration maximum amount of time a garbage collection pass can operate before timing out (postgres driver only) (default 1m0s)
--datastore-gc-window duration amount of time before revisions are garbage collected (default 24h0m0s)
If you're curious, you can dive deeper into the implementation by reading this particular file: https://github.com/authzed/spicedb/blob/v1.25.0/internal/datastore/postgres/gc.go
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论