Michael Roth wrote:

Two possible solutions::

a.) If you create a new database, check if a journal file with the right name exits already and delete it.

b.) When you create a new database, calculate a hash of some pseudo random sources like current date and time and current pid and store this id in the database. Copy this database id to every journal file you create in action of an transaction on this database.
Before you rollback a journal file, compare the database in the journal file with the id of the database file itself.
It must not be bulletproof. Just reduce the chance to a ratio like 1/(2^32 )or something.

Another one:

c.) Additionally use a "transaction counter". When a new database is created set this counter to 0. If you start a transaction, copy the counter value to the journal. If you apply a journal, make sure the database id and the transaction counter matches. After the journal is applied, increment the counter on the database, so the next journal will get a new transaction nummber. (Incrementing the counter on the database must somehow be part of the transaction itself.)

Solution a.) fights wrong journals orginating from other databases, solution c.) fights old journals on the current database.


cu

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to