From a4af409b04f535c09fca9b3db96caa3d7486c309 Mon Sep 17 00:00:00 2001 From: Paul Joseph Davis Date: Mon, 22 Feb 2010 15:18:46 +0000 Subject: _purge was incorrectly returning update_seq. Patched and tested. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@912606 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/test/purge.js | 6 +++++- src/couchdb/couch_db_updater.erl | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/share/www/script/test/purge.js b/share/www/script/test/purge.js index ca68b363..a924c348 100644 --- a/share/www/script/test/purge.js +++ b/share/www/script/test/purge.js @@ -54,13 +54,15 @@ couchTests.purge = function(debug) { }); T(xhr.status == 200); + var result = JSON.parse(xhr.responseText); var newInfo = db.info(); + // purging increments the update sequence T(info.update_seq+1 == newInfo.update_seq); // and it increments the purge_seq T(info.purge_seq+1 == newInfo.purge_seq); + T(result.purge_seq == newInfo.purge_seq); - var result = JSON.parse(xhr.responseText); T(result.purged["1"][0] == doc1._rev); T(result.purged["2"][0] == doc2._rev); @@ -91,6 +93,8 @@ couchTests.purge = function(debug) { }); T(xhr.status == 200); + result = JSON.parse(xhr.responseText); + T(result.purge_seq == db.info().purge_seq); var rows = db.view("test/all_docs_twice").rows; for (var i = 4; i < numDocs; i++) { diff --git a/src/couchdb/couch_db_updater.erl b/src/couchdb/couch_db_updater.erl index d0f8ec61..982ee03a 100644 --- a/src/couchdb/couch_db_updater.erl +++ b/src/couchdb/couch_db_updater.erl @@ -130,7 +130,7 @@ handle_call({purge_docs, IdRevs}, _From, Db) -> ok = gen_server:call(Db2#db.main_pid, {db_updated, Db2}), couch_db_update_notifier:notify({updated, Db#db.name}), - {reply, {ok, Db2#db.update_seq, IdRevsPurged}, Db2}. + {reply, {ok, (Db2#db.header)#db_header.purge_seq, IdRevsPurged}, Db2}. handle_cast(start_compact, Db) -> -- cgit v1.2.3