Controlling the Journal
There are three basic activities involved with controlling the KDB journal. These are all performed by the krecover utility. The first is initialising the journal. This defines where the log is, its size, its mode of operation and locking etc. This information is written to the first block of the log, and copied into the shared memory. This operation will typically only be performed once, when the system is first commissioned. The second operation is performed at system initialisation, before any KCML processes are running. This reads the header information from the first block of the log device and copies it to shared memory. If the log was closed down correctly and there wasn’t a system crash, then there is no recovery to perform. The third operation is closing down the log. This is performed at system shutdown after all the KCML processes have terminated. It marks in the log that it has been closed down successfully – so krecover knows at startup that there is no recovery to perform.
In the case of a small log, it is expected that initialisation would be performed once, by hand and that no automation of this step is required. The opening and closing of the log however must be performed each time the operating system is started and stopped. This must be performed before any KCML processes are started, and after they have all terminated. Unix allows us to call shell scripts at various stages of startup and shutdown, and this is a good way to automate control of the journal.
The krecover utility returns 0 if it was successful and 99 if it failed. This return code should always be checked.