mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 18:43:02 +01:00
39 lines
2.2 KiB
Plaintext
39 lines
2.2 KiB
Plaintext
|
-----------------------------------------------------------
|
||
|
Firebird 2.0 garbage collector
|
||
|
-----------------------------------------------------------
|
||
|
|
||
|
Engine knows about each record versions produced by update\delete statement
|
||
|
and can remove it as soon as oldest snapshot transaction (OST) allowed this.
|
||
|
This is eliminate need to read pages with this versions again by user request
|
||
|
(i.e. SELECT COUNT(*) FROM table) and avoid situation when this versions is
|
||
|
never reads (of course sweep always removed all unused record versions). Also
|
||
|
there are high probability that needed pages still reside in the buffer cache
|
||
|
thus there are less additional disk IO needed.
|
||
|
|
||
|
Between notifying garbage collector about page with unused versions and time
|
||
|
when garbage collector will read this page new transaction can update record
|
||
|
and garbage collector can't cleanup this record if this new transaction number
|
||
|
is above OST or still active. In this case engine again notified garbage collector
|
||
|
with this page number and it will clean up garbage at some time later (old garbage
|
||
|
collector will "forget" about this page until user reads it again)
|
||
|
|
||
|
Both cooperative and background garbage collection now possible. To manage it
|
||
|
introduced new configuration parameter "GCPolicy". It can be set to:
|
||
|
|
||
|
a) cooperative - garbage collection performed only in cooperative mode, such
|
||
|
as before IB6. Each user request is responsible for removing unused record
|
||
|
versions. This is how engine works before IB6. This is only option for
|
||
|
Classic Server mode. Engine don't track versions produced as result of
|
||
|
update and delete statements
|
||
|
|
||
|
b) background - garbage collection performed only by background thread, such
|
||
|
as in IB6 and latter. No user requests is removed unused record versions.
|
||
|
Instead user request notified dedicated garbage collector thread with page
|
||
|
number where unused record version detected. Also engine remember page numbers
|
||
|
where update\delete statement created backversions.
|
||
|
|
||
|
c) combined - both background and cooperative garbage collection is performed.
|
||
|
|
||
|
Default is "combined" for SuperServer. ClassicServer ignore this parameter and
|
||
|
always worked in "cooperative" mode
|