summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <kocolosk@apache.org>2010-04-22 18:26:42 +0000
committerAdam Kocoloski <kocolosk@apache.org>2010-04-22 18:26:42 +0000
commitc6361aa24b6974ad1f89841ccfe6711f5323a588 (patch)
treebda8cb8abaa8e4684a17801a6e22bdff176ae3a7
parent3143d4eba8b40b33c3dbe5897d6fdb7ec7377f71 (diff)
compaction preserves instance_start_time. Closes COUCHDB-744
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@936996 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--share/www/script/test/compact.js2
-rw-r--r--src/couchdb/couch_db_updater.erl8
2 files changed, 8 insertions, 2 deletions
diff --git a/share/www/script/test/compact.js b/share/www/script/test/compact.js
index f63bfc57..6a48992b 100644
--- a/share/www/script/test/compact.js
+++ b/share/www/script/test/compact.js
@@ -31,6 +31,7 @@ couchTests.compact = function(debug) {
T(db.save(binAttDoc).ok);
var originalsize = db.info().disk_size;
+ var start_time = db.info().instance_start_time;
for(var i in docs) {
db.deleteDoc(docs[i]);
@@ -43,6 +44,7 @@ couchTests.compact = function(debug) {
T(db.last_req.status == 202);
// compaction isn't instantaneous, loop until done
while (db.info().compact_running) {};
+ T(db.info().instance_start_time == start_time);
T(db.ensureFullCommit().ok);
restartServer();
diff --git a/src/couchdb/couch_db_updater.erl b/src/couchdb/couch_db_updater.erl
index ecd7bd65..b9945e3b 100644
--- a/src/couchdb/couch_db_updater.erl
+++ b/src/couchdb/couch_db_updater.erl
@@ -161,8 +161,12 @@ handle_cast({compact_done, CompactFilepath}, #db{filepath=Filepath}=Db) ->
fun(Value, _Offset, Acc) -> {ok, [Value | Acc]} end, []),
{ok, NewLocalBtree} = couch_btree:add(NewDb#db.local_docs_btree, LocalDocs),
- NewDb2 = commit_data( NewDb#db{local_docs_btree=NewLocalBtree,
- main_pid = Db#db.main_pid,filepath = Filepath}),
+ NewDb2 = commit_data(NewDb#db{
+ local_docs_btree = NewLocalBtree,
+ main_pid = Db#db.main_pid,
+ filepath = Filepath,
+ instance_start_time = Db#db.instance_start_time
+ }),
?LOG_DEBUG("CouchDB swapping files ~s and ~s.",
[Filepath, CompactFilepath]),