KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Use Offline Compacting to Reduce Downtime
PRODUCT: 4D | VERSION: 12 | PLATFORM: Mac & Win
Published On: November 23, 2011
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Note: This Tech Tip assumes you already understand 4D's logical mirroring feature. If you are unfamiliar with this feature, please consult the 4D documentation.

Database compacting can be a time-consuming process. The larger the database, and the more fragmented it is, the longer it takes to compact. It's even possible the compact duration could be too long to fit the maintenance window of a production system.

"Offline Compacting" is a process by which a copy of the database is compacted while the production database is still live and running. When the maintenance is complete the only downtime is the time it takes to put the compacted data file into production and complete the logical mirroring procedure.

Offline compacting requires synchronization of some type for two reasons:

  • The live data file will be replaced, so the compacted data file needs to have all changes.

  • It must be possible to update the compacted data file with the latest changes before making the final swap.

4D's logical mirroring feature works well for this. For example:

Given two systems: Production and Mirror

  • Shut down the Mirror database.

  • Compact the Mirror database.

  • Launch the Mirror database and integrate all log segments that were created on Production while the compact was underway.

  • When the Mirror is "caught up", shut down Production.

  • Integrate the current log file from Production into the Mirror.

    • At this point the compacted Mirror database is fully up to date.

  • Copy the compacted Mirror database to Production and then complete setup of a logical mirror as before.

In this way the Production system is only down for the duration of a file copy and mirror setup, instead of the full compact.

Note that this may not be beneficial in all cases. For example the logical mirror setup process invokes a 4D Backup. If the Backup operation takes longer than a compact, there's no reason to use this procedure.