Skip to content

Commit

Permalink
tagging 0.11.1
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/couchdb/tags/0.11.1@962578 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Noah Slater committed Jul 9, 2010
2 parents 30c0bc1 + f903c31 commit ac4dc02
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions share/www/script/jquery.couch.js
Expand Up @@ -595,6 +595,7 @@

function ajax(obj, options, errorMessage, ajaxOptions) {
options = $.extend({successStatus: 200}, options);
ajaxOptions = $.extend({contentType: "application/json"}, ajaxOptions);
errorMessage = errorMessage || "Unknown error";
$.ajax($.extend($.extend({
type: "GET", dataType: "json", cache : !$.browser.msie,
Expand Down
2 changes: 1 addition & 1 deletion src/couchdb/couch_db.erl
Expand Up @@ -103,7 +103,7 @@ monitor(#db{main_pid=MainPid}) ->
erlang:monitor(process, MainPid).

start_compact(#db{update_pid=Pid}) ->
gen_server:cast(Pid, start_compact).
gen_server:call(Pid, start_compact).

delete_doc(Db, Id, Revisions) ->
DeletedDocs = [#doc{id=Id, revs=[Rev], deleted=true} || Rev <- Revisions],
Expand Down
15 changes: 8 additions & 7 deletions src/couchdb/couch_db_updater.erl
Expand Up @@ -133,21 +133,22 @@ 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.header)#db_header.purge_seq, IdRevsPurged}, Db2}.


handle_cast(start_compact, Db) ->
{reply, {ok, (Db2#db.header)#db_header.purge_seq, IdRevsPurged}, Db2};
handle_call(start_compact, _From, Db) ->
case Db#db.compactor_pid of
nil ->
?LOG_INFO("Starting compaction for db \"~s\"", [Db#db.name]),
Pid = spawn_link(fun() -> start_copy_compact(Db) end),
Db2 = Db#db{compactor_pid=Pid},
ok = gen_server:call(Db#db.main_pid, {db_updated, Db2}),
{noreply, Db2};
{reply, ok, Db2};
_ ->
% compact currently running, this is a no-op
{noreply, Db}
end;
{reply, ok, Db}
end.



handle_cast({compact_done, CompactFilepath}, #db{filepath=Filepath}=Db) ->
{ok, NewFd} = couch_file:open(CompactFilepath),
{ok, NewHeader} = couch_file:read_header(NewFd),
Expand Down
7 changes: 6 additions & 1 deletion src/couchdb/couch_httpd_db.erl
Expand Up @@ -111,12 +111,15 @@ handle_changes_req(#httpd{method='GET'}=Req, Db) ->
handle_changes_req(#httpd{path_parts=[_,<<"_changes">>]}=Req, _Db) ->
send_method_not_allowed(Req, "GET,HEAD").

handle_compact_req(#httpd{method='POST',path_parts=[DbName,_,Id|_]}=Req, _Db) ->
handle_compact_req(#httpd{method='POST',path_parts=[DbName,_,Id|_]}=Req, Db) ->
ok = couch_db:check_is_admin(Db),
couch_httpd:validate_ctype(Req, "application/json"),
ok = couch_view_compactor:start_compact(DbName, Id),
send_json(Req, 202, {[{ok, true}]});

handle_compact_req(#httpd{method='POST'}=Req, Db) ->
ok = couch_db:check_is_admin(Db),
couch_httpd:validate_ctype(Req, "application/json"),
ok = couch_db:start_compact(Db),
send_json(Req, 202, {[{ok, true}]});

Expand All @@ -125,6 +128,8 @@ handle_compact_req(Req, _Db) ->

handle_view_cleanup_req(#httpd{method='POST'}=Req, Db) ->
% delete unreferenced index files
ok = couch_db:check_is_admin(Db),
couch_httpd:validate_ctype(Req, "application/json"),
ok = couch_view:cleanup_index_files(Db),
send_json(Req, 202, {[{ok, true}]});

Expand Down

0 comments on commit ac4dc02

Please sign in to comment.