couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject git commit: init:restart() is evil, /_restart is evil, kill -9 is awesome
Date Fri, 22 Feb 2013 20:28:50 GMT
Updated Branches:
  refs/heads/replace-init-restart-with-kill-dash-nine-booyah bb6cd0f4f -> e4603c386 (forced
update)


init:restart() is evil, /_restart is evil, kill -9 is awesome


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/e4603c38
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/e4603c38
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/e4603c38

Branch: refs/heads/replace-init-restart-with-kill-dash-nine-booyah
Commit: e4603c3869bfa4ae13e40a4f7eef4124d5b390c3
Parents: e14a2e5
Author: Jan Lehnardt <jan@apache.org>
Authored: Fri Feb 22 21:24:20 2013 +0100
Committer: Jan Lehnardt <jan@apache.org>
Committed: Fri Feb 22 21:28:31 2013 +0100

----------------------------------------------------------------------
 etc/couchdb/default.ini.tpl.in            |    1 -
 share/www/script/couch_test_runner.js     |   22 +++++++++++++++-------
 src/couchdb/couch_httpd_misc_handlers.erl |    4 +---
 src/couchdb/couch_server_sup.erl          |    5 +----
 4 files changed, 17 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/e4603c38/etc/couchdb/default.ini.tpl.in
----------------------------------------------------------------------
diff --git a/etc/couchdb/default.ini.tpl.in b/etc/couchdb/default.ini.tpl.in
index 94bf2fe..5d68994 100644
--- a/etc/couchdb/default.ini.tpl.in
+++ b/etc/couchdb/default.ini.tpl.in
@@ -152,7 +152,6 @@ _active_tasks = {couch_httpd_misc_handlers, handle_task_status_req}
 _config = {couch_httpd_misc_handlers, handle_config_req}
 _replicate = {couch_replicator_httpd, handle_req}
 _uuids = {couch_httpd_misc_handlers, handle_uuids_req}
-_restart = {couch_httpd_misc_handlers, handle_restart_req}
 _stats = {couch_httpd_stats_handlers, handle_stats_req}
 _log = {couch_httpd_misc_handlers, handle_log_req}
 _session = {couch_httpd_auth, handle_session_req}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/e4603c38/share/www/script/couch_test_runner.js
----------------------------------------------------------------------
diff --git a/share/www/script/couch_test_runner.js b/share/www/script/couch_test_runner.js
index c04e6b1..7920930 100644
--- a/share/www/script/couch_test_runner.js
+++ b/share/www/script/couch_test_runner.js
@@ -444,13 +444,21 @@ function waitForRestart() {
 };
 
 function restartServer() {
-  var xhr;
-  try {
-    CouchDB.request("POST", "/_restart");
-  } catch(e) {
-    // this request may sometimes fail
-  }
-  waitForRestart();
+  var restart_fun = function() {
+    var xhr;
+    try {
+      CouchDB.request("POST", "/_restart");
+    } catch(e) {
+      // this request may sometimes fail
+    }
+    waitForRestart();
+  };
+  run_on_modified_server([
+  {
+    section: "httpd_global_handlers",
+    key: "_restart",
+    value: "{couch_httpd_misc_handlers, handle_restart_req}"
+  }], restart_fun);
 }
 
 // legacy functions for CouchDB < 1.2.0

http://git-wip-us.apache.org/repos/asf/couchdb/blob/e4603c38/src/couchdb/couch_httpd_misc_handlers.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd_misc_handlers.erl b/src/couchdb/couch_httpd_misc_handlers.erl
index d1f947d..fa40feb 100644
--- a/src/couchdb/couch_httpd_misc_handlers.erl
+++ b/src/couchdb/couch_httpd_misc_handlers.erl
@@ -97,9 +97,7 @@ handle_task_status_req(Req) ->
 handle_restart_req(#httpd{method='POST'}=Req) ->
     couch_httpd:validate_ctype(Req, "application/json"),
     ok = couch_httpd:verify_is_server_admin(Req),
-    Result = send_json(Req, 202, {[{ok, true}]}),
-    couch_server_sup:restart_core_server(),
-    Result;
+    os:cmd("kill -9 " ++ os:getpid()); % yolo
 handle_restart_req(Req) ->
     send_method_not_allowed(Req, "POST").
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/e4603c38/src/couchdb/couch_server_sup.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_server_sup.erl b/src/couchdb/couch_server_sup.erl
index be3c3a3..0a894bd 100644
--- a/src/couchdb/couch_server_sup.erl
+++ b/src/couchdb/couch_server_sup.erl
@@ -15,7 +15,7 @@
 
 
 -export([start_link/1,stop/0, couch_config_start_link_wrapper/2,
-        restart_core_server/0, config_change/2]).
+        config_change/2]).
 
 -include("couch_db.hrl").
 
@@ -30,9 +30,6 @@ start_link(IniFiles) ->
         {error, already_started}
     end.
 
-restart_core_server() ->
-    init:restart().
-
 couch_config_start_link_wrapper(IniFiles, FirstConfigPid) ->
     case is_process_alive(FirstConfigPid) of
         true ->


Mime
View raw message