From 26555564ad89db5407f278dc7e3943c0b0ba9bbc Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Wed, 22 Jul 2009 17:34:14 +0000 Subject: various bugfixes and improvements for view compaction View compaction was broken after the switch to signature-based index files, but we don't have tests for it yet so we didn't notice. I also committed a few changes that should make compaction faster and more robust: * commit the header immediately after compaction finishes. We used to wait 1 seconds, but if the server restarted in that second the index would be reset. * unlink from old index file at the end. Prevents process crashes that could couch_view (and with the delayed commit would sometimes cause index resets). * don't wait for running view updates to finish before replacing old view index file. If an update is running, restart it and point it to the new view group. This alleviates the situation where the view compaction goes into a busy wait, printing "still behind main file" 1000s of times to the log, and generally makes compaction finish more quickly. * better logging git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@796805 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_view_updater.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/couchdb/couch_view_updater.erl') diff --git a/src/couchdb/couch_view_updater.erl b/src/couchdb/couch_view_updater.erl index 64c86185..1a928cb4 100644 --- a/src/couchdb/couch_view_updater.erl +++ b/src/couchdb/couch_view_updater.erl @@ -132,7 +132,7 @@ process_doc(Db, Owner, DocInfo, {Docs, Group, ViewKVs, DocIdViewIdKeys}) -> {ok, Group2} = write_changes(Group1, ViewKVs3, DocIdViewIdKeys3, DocInfo#doc_info.high_seq), if is_pid(Owner) -> - ok = gen_server:cast(Owner, {partial_update, Group2}); + ok = gen_server:cast(Owner, {partial_update, self(), Group2}); true -> ok end, garbage_collect(), ViewEmptyKeyValues = [{View, []} || View <- Group2#group.views], -- cgit v1.2.3