[bknr-devel] Warning: Encoding destroyed object
Hans Hübner
hans.huebner at gmail.com
Sun Feb 26 17:32:05 UTC 2006
Hi Kamen,
the bug that you describe is interesting. The following happens:
Your transaction "del" is entered.
"del" calls "delete-object" on the argument object.
"delete-object" marks the object as deleted.
"delete-object" is exited and a log entry is written to the transaction log.
"del" is exited and a log entry is written. During the writing of the
log entry, the datastore notices that the argument object has been
deleted and issues the warning you have seen.
You can avoid the warning by calling "destroy-object" instead of
"delete-object". "delete-object" is a transaction which is meant to
be called from non-transaction code, whereas "destroy-object" is a
standard function which should be called only from transaction code.
I am not sure whether we should keep it this way. On the positive
side, a programmer does need to be aware of whether he writes code
that executes within our outside of a transaction, so having to
seperate functions here makes some sense. On the negative side, it is
harder to remember what API to use, and in fact this is a problem with
"setf slot-value" vs. "change-slot-values".
For the time being, I'd recommend that you use "destroy-object" from
your transaction code. Also, note that if you delete your blob file
at when you delete an object, you loose the ability to roll forward to
a point back in time, should you need to do so. Deleting blob files
is best deferred to a point where old snapshots are archived using the
function "(bknr.datastore::delete-orphaned-blob-files)".
Cheers,
Hans
More information about the Bknr-devel
mailing list