summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_db.erl
diff options
context:
space:
mode:
authorDamien F. Katz <damien@apache.org>2009-01-05 05:42:52 +0000
committerDamien F. Katz <damien@apache.org>2009-01-05 05:42:52 +0000
commit10eac24f530b5de1ea30c83518d3971f99890db6 (patch)
treef5565b0002ec028538c78b65febaddb675297596 /src/couchdb/couch_db.erl
parent4228d249b4216d390aa1f8f063d09527c4dcbe6a (diff)
Delayed commit patch. Allows documents to be saved immediately but fully committed asynchronously. On by default, to fully commit documents synchronously, use X-Couch-Full-Commit=true in the http header. We still needs to prevent committing view indexes ahead of data and to detect when a server has crashed causing potentially lost updates during remote replication (fixed by retrying the incremental replication).
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@731452 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_db.erl')
-rw-r--r--src/couchdb/couch_db.erl7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/couchdb/couch_db.erl b/src/couchdb/couch_db.erl
index 0e652b68..7c86eeae 100644
--- a/src/couchdb/couch_db.erl
+++ b/src/couchdb/couch_db.erl
@@ -21,7 +21,7 @@
-export([enum_docs/4,enum_docs/5,enum_docs_since/4,enum_docs_since/5]).
-export([enum_docs_since_reduce_to_count/1,enum_docs_reduce_to_count/1]).
-export([increment_update_seq/1,get_purge_seq/1,purge_docs/2,get_last_purged/1]).
--export([start_link/3,make_doc/2,set_admins/2,get_admins/1]).
+-export([start_link/3,make_doc/2,set_admins/2,get_admins/1,ensure_full_commit/1]).
-export([init/1,terminate/2,handle_call/3,handle_cast/2,code_change/3,handle_info/2]).
@@ -64,6 +64,9 @@ create(DbName, Options) ->
open(DbName, Options) ->
couch_server:open(DbName, Options).
+ensure_full_commit(#db{update_pid=UpdatePid}) ->
+ gen_server:call(UpdatePid, full_commit, infinity).
+
close(#db{fd=Fd}) ->
couch_file:drop_ref(Fd).
@@ -462,7 +465,7 @@ init({DbName, Filepath, Fd, Options}) ->
ok = couch_file:add_ref(Fd),
gen_server:call(UpdaterPid, get_db).
-terminate(_Reason, Db) ->
+terminate(_Reason, _Db) ->
ok.
handle_call({open_ref_counted_instance, OpenerPid}, _From, #db{fd=Fd}=Db) ->