Reindexing Database Files

The JADE Database utility Operation menu Reindex Files command enables you to repair damaged file indexes and perform free-space garbage collection serially.

The reindex file operation reads objects from a database (.dat) file serially and recreates them in a work (.reo) file, establishing and maintaining the indexes in the new file. If no errors are encountered, the reorganization work file is instantiated.

When a file is reindexed, any free-space in the file is consolidated, which provides an alternative mechanism to offline compaction for garbage collecting free-space in files.

In a post-recovery scenario, file reindexing is packaged and executed in the form of a replayable reorganization in which updates are disallowed. A journal switch is performed before starting a reindexing transaction, to provide a convenient journal boundary to facilitate a roll-forward recovery to splice out the reindexing transaction, if required, as a result of a mishap.

The value of the ReorgWorkerThreads parameter in the [JadeReorg] section of the JADE initialization file is observed, allowing multiple reindex operations to take place concurrently. The entire reorganization process, instantiation, validation, and committal of reindexed files is an atomic, idempotent (that is, remains unchanged if applied to itself), and recoverable process, which means that if the database server is terminated during the reindexing transaction before it completes and the database is restarted, the recovery process restores files to their pre-recovery state and the recovery process repeats the database file history including reindexing, as required.

As post-recovery automatic file reindex operations are journalled for replay:

Initiating a file reindex operation on an SDS secondary database is not permitted.

To disable the automatic reindexing of database files, set the value of the DisableAutoReindex parameter in the [PersistentDb] section of the JADE initialization file to true. When you set this parameter to true, recovery is terminated and exception 3113 (Database recovery not possible - fatal error encountered) is raised when restart recovery encounters an error redoing or undoing an index update operation. The database must then be restored from backup and a roll-forward recovery performed. For details about performing a database file reindex operation, see "Using the Reindex Files Command", in Chapter 1.