Getting auto-compaction settings

Getting auto-compaction settings

Auto-compaction settings can be retrieved on a cluster-wide level or bucket level.

HTTP method and URI

Auto-compaction settings can be configured for all buckets on a cluster-wide basis or for a specific bucket on the bucket-level


// Cluster-wide
GET /settings/autoCompaction

// Bucket-level
GET /pools/default/buckets/[bucket-name]
      

Cluster-wide syntax

To retrieve current auto-compaction settings for a cluster:

curl -u [admin]:[password] http://[localhost]:8091/settings/autoCompaction

Replace the admin , password , and localhost values in the above example with your actual values.

This results in a JSON response as follows:

Cluster-wide example

The following example requests auto-compaction information on a cluster-wide level. GET is not specified because it is the default HTTP method.


curl -u Administrator:password 
  http://127.0.0.1:8091/settings/autoCompaction        
      

Cluster-wide response

This example response shows a purgeInterval of three days and no current thresholds set for data or index compaction. The field parallelDBAndViewCompaction: false indicates that the cluster will not perform data and index compaction in parallel.


{
    "autoCompactionSettings": {
        "databaseFragmentationThreshold": {
            "percentage": undefined, 
            "size": "undefined"
        }, 
        "parallelDBAndViewCompaction": false, 
        "viewFragmentationThreshold": {
            "percentage": undefined, 
            "size": "undefined"
        }
    }, 
    "purgeInterval": 3
}

Bucket-level syntax

To see auto-compaction settings for a single bucket, use this request:

curl -u admin:password http://[localhost]:8091/pools/default/buckets/[bucket_name]

Replace the admin , password , localhost , and bucket_name values in the above example with your actual values.

Bucket-level example

The following example requests auto-compaction information for the bucket, test2. GET is not specified because it is the default HTTP method.


curl -u Administrator:password 
  http://10.5.2.117:8091/pools/default/buckets/test2
      

Bucket-level response

This example response shows the following:
  • A time interval set (from 1:00 am to 2:00 am) for when compaction can run.
  • Abort enabled (true) if the run time exceeds the set time interval.
  • Database and view fragmentation threshold set at 30%.
  • A tombstone purge interval set to two (2) days>. This means items can be expired for two days or deleted two days ago and their tombstones will be purged during the next cluster-wide auto-compaction run.
 ...
    "autoCompactionSettings": {
        "allowedTimePeriod": {
            "abortOutside": true, 
            "fromHour": 1, 
            "fromMinute": 0, 
            "toHour": 2, 
            "toMinute": 0
        }, 
        "databaseFragmentationThreshold": {
            "percentage": 30, 
            "size": "undefined"
        }, 
        "parallelDBAndViewCompaction": true, 
        "viewFragmentationThreshold": {
            "percentage": 30, 
            "size": "undefined"
        }
    },  
    ...    
    "purgeInterval": 2,
...