Thanks Michael. Hope you dont mind some further questions.
Michael Ubell wrote:
Quote:
Casey,
If you release locks for other transactions then there is no
way to be sure you can back out a change, since other
transactions my update the data.
If it is the case that the other transactions are read only
then you might consider if DB_DIRTY_READ locking gets you what
you want along with child transactions.
If dirty reading is not acceptable there is no facility in Berkeley DB
that directly provides the functionality that you want. You could
implement it by writing change descriptions to a separate database
so that you can use that to back out your changes. |
I was hoping that i could use the "change description" information
that is already in the db log.
If I kept around the transaction id, could i rollback to that
transaction id? I was poking around the code a little and came
across:
/*
* __db_apprec --
* Perform recovery. If max_lsn is non-NULL, then we are trying
* to synchronize this system up with another system that has a max
* LSN of max_lsn, so we need to roll back sufficiently far for that
* to work. See __log_backup for details.
*
* PUBLIC: int __db_apprec __P((DB_ENV *, DB_LSN *, u_int32_t));
*/
int
__db_apprec(dbenv, max_lsn, flags)
DB_ENV *dbenv;
DB_LSN *max_lsn;
u_int32_t flags;
As documented, the max_lsn parm didn't appear to be used for normal
recovery, but it did appear to be used to sync up remote master/client
databases. Maybe I could use DB_ENV->log_put() to get a lsn for
later use with __db_apprec or something similar. I know I'm getting
into the internals here - that's ok with me. Just wondering if
I might be on the right path.
-casey
Quote:
Michael Ubell
Sleepycat Software. |