|Subject||Re: [firebird-support] Re: Is there still a difference between sweep and gabage collection?|
On 20 February 2015 at 18:36, Ann Harrison aharrison@... [firebird-support] <email@example.com> wrote:
Gbak backup removes all unnecessary back versions and all rolled back changes, unless it is run with the -g switch. That switch is provided for those cases where a database cleanup is not needed. Examples include the case when the database will immediately be replaced by a restored version, upgrading the ODS, for example, or when a sweep has just been run.
What gbak does not do that sweep does it change the identity of the oldest interesting transaction. Unlike the oldest active transaction, the oldest interesting transaction is not critical for performance, but having it correct does make things slightly better. The oldest interesting transaction is the first transaction, still visible in the database, that did not commit. Any data created by older transactions is known to have been created by committed transactions. A transaction reading it doesn't have the check the state of the creating transaction. When accessing data created by a more recent transaction, the reader must test a bit in a bit vector to determine the state of the creating transaction. Pretty cheap.
During a sweep, gfix notes the oldest transaction whose work it could not clean up. At the end of the sweep, that becomes the oldest interesting transaction.
In the absence of the -g switch or the attachment parameter that implements that switch, any process that reads all the data in a database removes all unnecessary old or rolled back record versions, either itself or through the proxy of the garbage collect thread. Only gfix changes the recorded oldest interesting transaction.