Subject Re: [firebird-support] Purpose of the OST (Oldest Snapshot Transaction)
Author Ann W. Harrison
On 2/5/2011 8:42 AM, Michael Ludwig wrote:
> Every transaction that is not READ ONLY READ COMMITTED is assigned
> a value for the Oldest Snapshot field. I'd like to understand what
> this field is needed for.
>

The value is not used by the transaction itself, but is used
by the database as a whole to determine the scope of garbage collection.


In order to maintain a stable view of the database for Snapshot
transactions, Firebird has to avoid garbage collecting records
that any running transaction might see. It does so by tracking
the oldest transaction that was running when any active transaction
started. Each transaction carries with it the identifier of the
oldest transaction that was running when it started. Firebird's
garbage collection ceiling is set to the oldest of those values
among running transactions. When the oldest running transaction
stops, Firebird resets the ceiling to the value from the oldest
of the remaining transactions.

If a record has two or more versions older than the ceiling value,
Firebird can garbage collect the older versions without affecting
the stability of any running transaction.


Does that make sense?


Cheers,

Ann