@@ -70,6 +70,9 @@ scope of higher block, and old block is released when OIT moves out of lower blo
7070Block size could be set in firebird.conf using new setting ** TipCacheBlockSize** . Default value is
71714MB and it could keep 512K transactions.
7272
73+ ** CONCURRENCY** transactions now uses ** database snapshot** described above. Thus instead of taking
74+ a private copy of TIP at own start it just keeps value of global Commit Number at a moment.
75+
7376# Statement level read consistency for read-committed transactions
7477
7578## Not consistent read problem
@@ -109,14 +112,16 @@ view of database, of course.
109112The obvious solution to not consistent read problem is to make read-committed transaction to use
110113stable database snapshot while statement is executed. Each new top-level statement create own
111114database snapshot to see data committed recently. With snapshots based on commit order it is very
112- cheap operation. Nested statements (triggers, nested stored procedures and functions, dynamic
113- statements, etc) uses same database snapshot created by top-level statement.
115+ cheap operation. Let name this snapshot as ** statement-level snapshot** further. Nested statements
116+ (triggers, nested stored procedures and functions, dynamic statements, etc) uses same
117+ statement-level snapshot created by top-level statement.
114118
115119To support this solution new transaction isolation level is introduced: ** READ COMMITTED READ
116120CONSISTENCY**
117121
118122Old read-committed isolation modes (** RECORD VERSION** and ** NO RECORD VERSION** ) are still
119- allowed but considered as legacy and not recommended to use.
123+ allowed, works as before (i.e. not using statement-level snapshots) and could be considered
124+ as legacy in the future versions of Firebird.
120125
121126So, there are three kinds of read-committed transactions now:
122127 - READ COMMITTED READ CONSISTENCY
@@ -165,18 +170,28 @@ Notes:
165170 the application if not handled
166171- UPDATE\DELETE triggers will fire multiply times for the same record if statement execution was
167172 restarted and record is updated\deleted again
173+ - statement restart usually fully transparent to the applications and no special actions should
174+ be taken by developers to handle it in any way. The only exception is the code with side effects
175+ that is out of transactional control, such as:
176+ - usage of external tables, sequences or context variables;
177+ - sending e-mails using UDF;
178+ - committed autonomous transactions or external queries, and so on
179+
180+ Take into account that such code could be executed more than once if update conflict happens
181+ - there is no special tools to detect restart but it could be easy done using code with side
182+ effects as described above, for example - using context variable
168183- by historical reasons isc_update_conflict reported as secondary error code with primary error
169184 code isc_deadlock.
170185
171186
172- ### Precommitted transactions
187+ ### Read-committed read only transactions
173188
174- READ COMMITTED READ ONLY transactions marked as committed immediately when transaction started.
175- This is correct if read-committed transaction needs no database snapshot. But it is not correct
176- to mark READ CONSISTENCY READ ONLY transaction as committed as it can break statement-level
177- snapshot consistency. Therefore READ CONSISTENCY READ ONLY transactions is not precommitted
178- on start. Other kinds of READ COMMITTED READ ONLY transactions ( [ NO ] RECORD VERSION) works as
179- before and marked as committed when such transaction started .
189+ READ COMMITTED * READ ONLY* transactions marked as committed immediately when transaction started.
190+ Also such transactions do not inhibit regular garbage collection and not delays advance of OST
191+ marker. READ CONSISTENCY READ ONLY transactions still marked as committed on start but, to not
192+ let regular garbage collection to break future statement-level snapshots, it delays movement of
193+ OST marker in the same way as SNAPSHOT transactions. Note, this delays * regular * (traditional)
194+ garbage collection only, * intermediate * GC (see below) is not affected .
180195
181196### Support for new READ COMMITTED READ CONSISTENCY isolation level
182197#### SQL syntax
@@ -192,19 +207,20 @@ Parameter Buffer (TPB):
192207* isc_tpb_read_consistency*
193208
194209#### Configuration setting
195- In the future versions of Firebird old kinds of read-committed transactions could be removed.
196- To help test existing applications with new READ COMMITTED READ CONSISTENCY isolation level
197- new configuration setting is introduced:
210+ It is recommended to use READ COMMITTED READ CONSISTENCY mode whenever read-committed isolation
211+ is feasible. To help test existing applications with new READ COMMITTED READ CONSISTENCY isolation
212+ level new configuration setting is introduced:
198213
199214* ReadConsistency*
200215
201216If ReadConsistency set to 1 (by default) engine ignores [ NO] RECORD VERSION flags and makes all
202217read-committed transactions READ COMMITTED READ CONSISTENCY.
203218
204- Set ReadConsistency to 0 to allow old engine behavior - flags [ NO] RECORD VERSION takes effect as
205- in previous Firebird versions. READ COMMITTED READ CONSISTENCY isolation level should be specified
206- explicitly .
219+ If ReadConsistency is set to 0 - flags [ NO] RECORD VERSION takes effect as in previous Firebird
220+ versions. READ COMMITTED READ CONSISTENCY isolation level should be specified explicitly by
221+ application - in TPB or using SQL syntax .
207222
223+ The setting is per-database.
208224
209225# Garbage collection of intermediate record versions
210226
@@ -241,3 +257,6 @@ Garbage collection of intermediate record versions run by:
241257 - background garbage collector in SuperServer
242258 - every user attachment after update or delete record
243259 - table scan at index creation
260+
261+ Traditional way of garbage collection (regular GC) is not changed and still works the same way
262+ as in previous Firebird versions.
0 commit comments