64 Message Store Maintenance Queue

Only the index file is purged when a mailbox is expunged. The purging of cache records is deferred until the amount of expunged data has exceeded a configurable limit. In addition, the message store uses a maintenance queue to schedule mailbox purge and repair tasks. Mailbox corruptions detected by the message store are also queued for repair automatically.

Topics:

Message Store Maintenance Queue Overview

The following diagram summarizes the major components and their interactions with the queue.

Figure 64-1 Message Store Maintenance Queue

Description of Figure 64-1 follows
Description of ''Figure 64-1 Message Store Maintenance Queue''

When a mailbox is expunged, the message store processes update the number of expunged messages and enqueue the mailbox name for purging when the number of expunged messages has exceeded the configured limit (set by the store.cleanupsize option). Similarly, when store corruptions are detected by the store processes, they enqueue the mailbox name for repair. A maintenance queue entry contains a mailbox name, a task ID, and a timestamp. The impurge process dequeues the entries, checks the timestamp and mailbox size or last repair time and performs the maintenance task if required. The mailbox size and last repair time are stored in the mboxlist database. Mailboxes that have already been repaired after the enqueue time are ignored. Obsoleted cache and message files are enqueued for removal after the cleanup age has expired.

You can set the impurge process to execute as a daemon or through the scheduler. When you use the scheduler, you can configure impurge to exit when the queue is empty or when the end time expires. In this way, you can configure impurge to run during off peak hours.

impurge executes as a daemon by default.

Displaying the Maintenance Queue

Use the imcheck -q command to display the contents of the maintenance queue, for example:

imcheck -q
RecNo      Mailbox                             Timestamp      Action
---------- ----------------------------------- -------------- ------
2          user/username                       20080225095558 Clean

The maintenance queue database is stored under the MessagingServer_home/data/store/mboxlist directory and persists across Oracle Communications Messaging Server restarts.

Deleting, Expunging, Purging, and Cleaning Up Messages

Message removal is a four steps process:

  1. Delete

    • A user deletes a message. This results in the per-user \Deleted flag being set on the message. If there is a second client, the deleted flag may not be recognized immediately by that second client. You can set the imap.immediateflagupdate option to enable immediate flag update.

  2. Expunge and Expire

    • When the mailbox is expunged, messages with the \Deleted flag are removed from the store.idx file. The message itself is still on disk, but once messages are expunged, clients can no longer restore them. The number of the expunged messages is also recorded in the "Expunged" mailbox meta-data field. This field can be reviewed using the ./imcheck -mmailbox command.

    • When a message matches an expiration rule during an imexpire run, the imexpire command removes the message from the store.idx file and increments the "Expunged" mailbox meta-data field.

  3. Cleanup

    • Cleanup of a folder is scheduled when the number of expunged in the folder messages exceeds store.cleanupsize, default is 100. The store.exp file is renamed to store.exp.timestamp.

    • Obsolete message files and cache files are removed from the store partitions when the store.cleanupage period has elapsed. store.cleanupage controls the cleanup grace period.

  4. Purge

    • impurge purges the cache files when the number of expunged cache records exceeds store.purge.count (default is 500) and the percentage of expunged cache records exceeds store.purge.percentage (default is 5%). This is different from the imsimta purge command, which purges older versions of the MTA log files.

Mailbox Self Healing (Auto Repair)

The message store performs sanity checks when a mailbox is opened and when index and cache data are accessed. When the message store encounters a mailbox format error, and error is returned to the client and the mailbox is enqueued for repair. impurge dequeues the mailbox and repairs the mailbox automatically. The mailbox size and last repair time are stored in the mboxlist database. Mailboxes that have already been repaired after the enqueue time are ignored.

The following is an example of the auto repair process. In this example, the store.idx file for a user's INBOX has been removed. When the user accessed their INBOX the following error was reported in the imap log file:

[25/Feb/2012:09:55:57 +1100] hostname imapd[7264]: Store Critical: Unable to open mailbox user/username: Mailbox does not exist
[25/Feb/2012:09:55:57 +1100] hostname imapd[7264]: Store Error: user/username: Mailbox has an invalid format; repair requested

In the default log file an impurge record indicates that the requested mailbox repair as been processed and the store.idx restored:

[25/Feb/2012:09:55:58 +1100] hostname impurge[7263]: General Notice: repairing user/username

Maintenance Queue Configuration Options

The store.purge.enable option enables the purge server daemon process on start-msg startup. Various other store.* options control the maintenance queue. For more information on these options, see the Messaging Server Reference.

The impurge Command

You can use the impurge command to manually purge unused cache records and message files in mailboxes when the purge server daemon process is not running, that is, when the store.purge.enable option is disabled.

Attempting to run the impurge command while the purge server daemon process is running results in the following error message in the Messaging Server default log:

[24/Feb/2012:14:47:15 +1100] hostname impurge[17986]: General Error: Could not get purge session lock.
Possibly another impurge is running

For details, see "impurge."