summaryrefslogtreecommitdiff
path: root/share/www
diff options
context:
space:
mode:
authorDamien F. Katz <damien@apache.org>2009-04-09 21:37:23 +0000
committerDamien F. Katz <damien@apache.org>2009-04-09 21:37:23 +0000
commitcdf43ab5a1d5ea21e42302c848fe4f07150e6947 (patch)
tree431279b218c6bb13454dcfc73286b45c1f9a690d /share/www
parentcf3eac0fc97cc4671c1ba86e1924b0a46d096333 (diff)
Fix for attachment sparseness bug COUCHDB-220 by giving each attachment it's own stream and calling set_min_buffer instead of ensure_buffer. Also fixed spurious couch_file crash messages by putting the statistics decrement code into a seperate monitoring process.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@763816 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www')
-rw-r--r--share/www/script/test/attachments.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/share/www/script/test/attachments.js b/share/www/script/test/attachments.js
index 4b43e31a..d9560bce 100644
--- a/share/www/script/test/attachments.js
+++ b/share/www/script/test/attachments.js
@@ -142,5 +142,38 @@ couchTests.attachments= function(debug) {
var xhr = CouchDB.request("GET", "/test_suite_db/bin_doc4/attachment.txt");
T(xhr.status == 200);
T(xhr.responseText == "This is a string");
+
+
+ // Attachment sparseness COUCHDB-220
+
+ var docs = []
+ for (var i = 0; i < 5; i++) {
+ var doc = {
+ _id: (i).toString(),
+ _attachments:{
+ "foo.txt": {
+ content_type:"text/plain",
+ data: "VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ="
+ }
+ }
+ }
+ docs.push(doc)
+ }
+
+ db.bulkSave(docs);
+
+ var before = db.info().disk_size;
+
+ // Compact it.
+ T(db.compact().ok);
+ T(db.last_req.status == 202);
+ // compaction isn't instantaneous, loop until done
+ while (db.info().compact_running) {};
+
+ var after = db.info().disk_size;
+
+ // Compaction should reduce the database slightly, but not
+ // orders of magnitude (unless attachments introduce sparseness)
+ T(after > before * 0.1, "before: " + before + " after: " + after);
};