diff options
author | Damien F. Katz <damien@apache.org> | 2008-07-22 22:04:58 +0000 |
---|---|---|
committer | Damien F. Katz <damien@apache.org> | 2008-07-22 22:04:58 +0000 |
commit | c63d078f876652088a1c3f344f716306f4a24043 (patch) | |
tree | bdf9a8a7a49a7cc7d23d00611be3ffba10cc3889 /src | |
parent | 0d2ec1a8800926543d9c859fe37f761bdf1cd65d (diff) |
Fix for compacted databases reporting 0 documents after compaction
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@678923 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/couchdb/couch_db.erl | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/couchdb/couch_db.erl b/src/couchdb/couch_db.erl index 8d671ea2..2f5df3b5 100644 --- a/src/couchdb/couch_db.erl +++ b/src/couchdb/couch_db.erl @@ -568,16 +568,17 @@ update_loop(#db{fd=Fd,name=Name, init_db(Name, CompactFilepath, NewFd, NewHeader), case Db#db.update_seq == NewSeq of true -> + NewDb2 = commit_data( + NewDb#db{ + main_pid = Db#db.main_pid, + doc_count = Db#db.doc_count, + doc_del_count = Db#db.doc_del_count, + filepath = Filepath}), + ?LOG_DEBUG("CouchDB swapping files ~s and ~s.", [Filepath, CompactFilepath]), ok = file:rename(Filepath, Filepath ++ ".old"), ok = file:rename(CompactFilepath, Filepath), - NewDb2 = NewDb#db{ - main_pid = Db#db.main_pid, - doc_count = Db#db.doc_count, - doc_del_count = Db#db.doc_del_count, - filepath = Filepath}, - couch_stream:close(Db#db.summary_stream), % close file handle async. % wait 5 secs before closing, allowing readers to finish |