Reputation: 11187
How does CouchDb deal with growing documents that run out of contiguous disk space at the end? And moreover what is CouchDb's strategy for allocating disk space for documents where it has no idea how large they could end up being?
Upvotes: 1
Views: 521
Reputation: 4679
CouchDB uses append-only strategy to write new data. This means that each new document "revision" (note, that this is not actual revision as for VCS) will be written at the end of file and there is no reallocations between. When you run database compact operation, it writes all actual revisions to the new database file stripping old ones and making delete documents as grave tomb signs. When all documents are compacted, it transparently replaces old database file with compacted one.
More detailed explanation you may read in great Riyad Kalla's article about CouchDB database format. Also, you might be interested in his discussion on mailing list.
Upvotes: 1