Subject Re: [firebird-support] Re: Is there still a difference between sweep and gabage collection?
Author Nick Upson
so

if I run gbak -g every night I should also run gfix​, but if I run gbak without -g I don't need gfix (but it helps a little) ?

Nick Upson, Telensa Ltd, Senior Operations Network Engineer
direct +44 (0) 1799 533252, support hotline +44 (0) 1799 399200

On 20 February 2015 at 18:36, Ann Harrison aharrison@... [firebird-support] <firebird-support@yahoogroups.com> wrote:
 


Thomas,

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.

Cheers,

Ann