Savepoint commit logging is misleading (and potentially expensive)
jamadden opened this issue · 3 comments
When savepoints are in use, ZODB.Connection
logs something like this (notice that's 80GB):
DEBUG [ZODB.Connection]] Committing savepoints of size 86970105856
Lines 1026 to 1033 in 2f8cc67
Where src
is a TmpStore
. TmpStore
copies the getSize()
method from the underlying original storage, so what's being logged isn't the size of the savepoint, it's the size of the entire database.
Lines 1131 to 1141 in 2f8cc67
On RelStorage, in order to provide a consistent, up-to-date answer (and be usable no matter what else the state of the storage is) this always opens a new connection to the database, which can be slow.
Perhaps what we want to log is len(src)
? That's the number of entries in the TmpStore
.
Why not src.position
?
BTW, IStorage defines both __len__
& getSize
so it's not consistent that TmpStore redirects only 1 of them to the underlying storage.
src.position
includes extra header data for each object and I think in the event of multiple savepoints that write the same OID more than once it also includes duplicates, but I haven't looked that closely. Either way seems like an improvement.