zodb / relstorage

A backend for ZODB that stores pickles in a relational database.
Other
53 stars 46 forks source link

Clarification on oids.sqlite3 in SQLite storage #478

Closed pfw closed 3 years ago

pfw commented 3 years ago

I'm working through some backup processes and would just like to clarify my understanding of the values for zoid in the new_oid table.

To ensure that there are is no reuse of an OID the zoid value in new_oid should be at least:

max_existing = max(zoid) from object_state

zoid in new_oid >= (max_existing // 16) + 1 (this being due to the sqlite adaptor getting oids in a range 16 long)

My backup process at the moment is to use litestream (litestream.io backup to s3/gcp etc) on just main.sqlite3 then when restoring do a zodbconvert into the correct location. The end result of the zodbconvert meets the rules above but I just wanted to confirm so I can put a check in on the restore script.

jamadden commented 3 years ago

That sounds right.

pfw commented 3 years ago

Thanks.