Daylight v4.9
Release Date: 1 February 2008


thorcrunch - report and recover empty space ("garbage")

Unix Synopsis

thorcrunch [options ...] database


The manual page for "thorfilters" describes features common to all "thorfilter" programs; refer to it for more information about this program and the syntax of "database".

thorcrunch reports the current "garbage fraction" of database (the fraction of the database that is currently unused), then if the database's "garbage fraction" is above a user-specified limit, tells the Thor server to "crunch" the database.

In the Thor system, the space used by a TDT is not recovered immediately when the TDT is removed (by direct removal or when the TDT is merged and written to a new spot in the database). "Crunching" is the process of removing all of this unused space from the Thor database.

The crunch limit (see the option CRUNCH_LIMIT) is compared to the primary data file and the cross-reference data file separately; Neither, one, or both may be crunched, depending on whether its garbage fraction is above the crunch limit.

Crunching a database is a single operation for the Thor server, and can take a long time (a minute or two for small databases, a large fraction of an hour for very large databases). While a database is being crunched, the Thor server won't respond to any client; clients that attempt to communicate will be blocked, and will appear to be "frozen". Because of this, databases should not be crunched while other folks are trying to use the server.

"Crunching" requires the write-permission password for database. If database does not include a password thorcrunch will prompt for the server's password and the write password for the database; see the option SECURE_PASSWORDS in the thorfilters(1) man page.

Database crunching also happens automatically; see thormake(1), thorchange(1) and sthorman(1) for the "autocrunch limit".


Specifies R (a real number), the fraction of "garbage", below which no crunching will take place. The garbage fraction is computed as (bytes_free/(bytes_free + bytes_used)), and is a real number between 0.0 and 1.0. Default is 0.10 (10% garbage).
If TRUE, specifies that the database's garbage-fraction is to be reported, but no crunching is to take place. If TRUE, the option CRUNCH_LIMIT is ignored. Default is FALSE.

The following options are common to most or all "thorfilter" programs. They are described in more detail in thorfilters(1).


TRUE means don't allow passwords on the command line (require interactive entry). Default: TRUE.
Names the default TCP/IP service or "port" of the Thor server. Default: thor.

Return Value

Returns 0 on success, 1 on failure.


thorcrunch -CRUNCH_LIMIT 0.2 mydb@dbserver
Reports the garbage fraction of the database "mydb" on the host "dbserver", then crunches if there is more than 20% garbage.
thorcrunch -REPORT_ONLY TRUE mydb@dbserver
Reports the garbage fraction of the database "mydb" on the host "dbserver". Doesn't crunch.
thorcrunch -CRUNCH_LIMIT 0.0 mydb
Reports the garbage fraction of the database "mydb" on the current host, then crunches regardless of how much garbage there is in the database.



Daylight License

programs: thormanager

Related Topics

dayevict(1) daymessage(1) merlindbping(1) merlinload(1) merlinls(1) merlinping(1) merlinwho(1) thordbping(1) thordelete(1) thordestroy(1) thordiff(1) thordump(1) thorlist(1) thorload(1) thorlookup(1) thorls(1) thormake(1) thorping(1) thorwho(1)

sthorman(1) thorserver(1) merlinserver(1) licensing(5)

Daylight Theory Manual, Daylight System Administration Manual


None known.