couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "Compaction" by SebastianCohnen
Date Wed, 03 Mar 2010 10:41:05 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "Compaction" page has been changed by SebastianCohnen.
The comment on this change is: Added TOC; Clarification on View-Compaction/-Cleanup; Added
curl-statements to all examples.
http://wiki.apache.org/couchdb/Compaction?action=diff&rev1=13&rev2=14

--------------------------------------------------

- == Overview ==
+ = Compaction =
+ <<TableOfContents(2)>>
+ 
+ == Database Compaction ==
  
  Compaction rewrites the database file, removing outdated document revisions and deleted
documents. It is available in builds of CouchDB built from SVN after 2008-04-07, and in official
release since version 0.8-incubating.
  
- Compaction is manually triggered per database. Support for queued compaction of multiple
databases is planned.
+ Compaction is manually triggered per database. Support for queued compaction of multiple
databases is planned. Please note, that compaction will be run as a background task.
  
  === Example ===
  
- Compaction is triggered by an HTTP post request to the _compact sub-resource of your database.
On success, HTTP status 202 is returned.
+ Compaction is triggered by an HTTP post request to the _compact sub-resource of your database.
On success, HTTP status 202 is returned immediately.
  
  {{{
-     # POST http://localhost/my_db/_compact via curl
-     curl -X POST http://localhost/my_db/_compact
+     curl -X POST http://localhost:5984/my_db/_compact
      #=> {"ok":true}
  }}}
  
  GET requesting your database base url ( http://localhost/my_db ) gives a hash of statuses
that look like this:
  
  {{{
-     curl http://localhost/my_db
+     curl -X GET http://localhost/my_db
-     #=> {"db_name":"my_db","doc_count":0,"doc_del_count":1,"update_seq":3,"compact_running":false,"disk_size":14341}
+     #=> {"db_name":"my_db", "doc_count":1, "doc_del_count":1, "update_seq":4, "purge_seq":0,
"compact_running":false, "disk_size":12377, "instance_start_time":"1267612389906234", "disk_format_version":5}
  }}}
  
  The compact_running key will be set to true during compaction.
@@ -36, +38 @@

  
  In the future, a single CouchDB node can be changed to stop or fail other updates if the
write load is too heavy for it to complete in a reasonable time.
  
+ 
  == View compaction ==
  
- There is a compact views feature:
+ Views need compaction like databases. There is a compact views feature:
  {{{
- POST /dbname/_compact/designname
+ curl -X POST http://localhost:5984/dbname/_compact/designname
+ #=> {"ok":true}
  }}}
  
- This compacts the views from the current version of the design document, but old versions
(from when the design document had a different hash) remain.
+ This compacts the view index from the current version of the design document. The HTTP response
code is 202 Accepted (like compaction for databases) and a compaction background task will
be created.
  
- If you want to remove old views from disk then
+ View indexes on disk are named after their MD5 hash of the view definition. When you change
a view, old indexes remain on disk. To clean up all outdated view indexes (files named after
the MD5 representation of views, that does not exist anymore) you can trigger a view cleanup:
+ 
  {{{
- POST /dbname/_view_cleanup
+ curl -X POST http://localhost:5984/dbname/_view_cleanup
+ #=> {"ok":true}
  }}}
  

Mime
View raw message