tengiz wrote:... Вот что намного любопытнее - устройство Interbase, который сильно отличается от других версионников. ...
We considered briefly Interbase/Firebird for one of our projects.
Interbase is a multiversioning engine with the following pecularities:
1. Isolation levels:
SNAPSHOT
READ COMMITTED
a. Under the SIL, IB behaves in the manner identical to Oracle's SERIALIZABLE:
reads: w0[x0] c0 w1[x1] r2[x0] c1 r2[x0] c2 r2[x1]
writes: w0[x0] c0 w1[x1] c1 w[x2]* => transaction aborted.
When the younger transaction aborts, IB's error message is somewhat misleading : "deadlock-update conflicts with concurrent update" (Oracle's error message would be "cannot serialize").
The SIL is the default IL.
b. READ COMMITTED. It appears that originally IB had only SIL and the RCIL was added later on. There are two varieties of the RCIL:
b1: "read committed no record_version" that behaves so:
reads: w0[x0] c0 w1[x1] r2[x0] c1 r2[x1] c2 r2[x1]
writes: w0[x0] c0 w1[x1] c1 w2[x2]* => transaction aborted.
Quite similar to the SIL, but read consistensy is maintained only at the statement level (as opposed to the whole transaction level for the SIL).
b2. "read committed record_version". This is more interesting and resembles the locking scheduler behaviour:
reads: w0[x0] c0 w1[x1] c1 r2[x1]
writes: w0[x0] c0 w1[x1] c1 w2[x2]
In other words, both reads and writes are _blocked_ by the older write transaction until the time such transaction commits.
Both RCIL varieties have the 'NOWAIT' option whereby, upon detecting a conflict, the younger transaction returns immediately with an error code.
2. IB appears to have a locking manager similar to SQL Server/DB2 and no row level lock bytes (as Oracle does).
3. IB does not have a construct similar to Oracle's "SELECT FOR UPDATE", and the usual trick to lock a specific row is to use an actual update statement. Firebird 1.6 (not yet released as of the time we ran our tests) promises to implement something similar ("SELECT FOR UPDATE WITH LOCK"), though.
4. IB uses garbage collection ("sweep") to get rid of old dversions as opposed to Oracle's circular buffer (undo tablespace).
5. Surprisingly enough, Oracle's READ COMMITTED augmented with "SELECT FOR UPDATE" turned out to be more flexible, at least for our applications, than either of IB's RCILs.
Rgds.