Auto-compaction settings trigger the compaction process. The process compacts databases and their respective view indexes when the following conditions are met. Full Administrators and Cluster Administrators can configure auto-compaction settings.
If you set the default auto-compaction settings for Couchbase Server, auto-compaction is automatically enabled for all Couchbase buckets. You can override all the auto-compaction settings except index fragmentation settings using per-bucket settings that are available when creating or editing data buckets.
You can provide a purge interval to remove the key and metadata for items that have been deleted or are expired, which is known as Tombstone purging.
The auto-compaction settings can also be modified using the REST API.
|Database Fragmentation||Sets the database fragmentation level that determines the point when compaction is triggered. You must specify either one or both parameters:
|View Fragmentation||Sets the view fragmentation level that determines the point when compaction is triggered. You must specify either one or both parameters:
|Index Fragmentation||Sets the write strategy and trigger point when compaction is triggered. This option only applies when Standard Global Secondary Index storage option is selected for indexes. Write mode and compaction strategy do not apply to memory-optimized global secondary indexes. You can select one of the following options:
Whenever you change the compaction settings for the index, the system starts the global secondary index process on all the nodes.
When you switch from append-only writes with percent-fragmentation based trigger to circular reuse with time-based trigger, the setting may not take effect immediately after upgrading from 4.1 or 4.0 to version 4.5. To see when the circular reuse option takes effect, ensure that compaction has completed on all the indexes on all nodes with global indexes.
Note: Index compaction settings cannot be overridden at the bucket level.
|Metadata Purge Interval||Sets the frequency of metadata purge interval. The default value is three days.
Tombstones are records of expired or deleted items, and they include the key and metadata. Tombstones are used in Couchbase Server to provide eventual consistency of data between clusters. The auto-compaction process waits for the specified number of days before permanently deleting tombstones for expired or deleted items.
If you set this value too low, you may see more inconsistent results in views queries, such as deleted items in a result set. You may also see inconsistent items in clusters with XDCR set up between the clusters. If you set this value too high, it will delay the server from reclaiming disk space.