R43WflJ8r75MupvXuS98v changeset

Changeset663534393461 (b)
ParentNone (a)
ab
0+diff --git a/bin/couchdb.tpl.in b/bin/couchdb.tpl.in
0+index 370bdb4..eab27b5 100644
0+--- a/bin/couchdb.tpl.in
0++++ b/bin/couchdb.tpl.in
0+@@ -15,7 +15,12 @@
0+ BACKGROUND=false
0+ DEFAULT_CONFIG_DIR=%localconfdir%/default.d
0+ DEFAULT_CONFIG_FILE=%localconfdir%/%defaultini%
0+-ERL_START_OPTIONS="-sasl errlog_type error +K true +A 4"
0++ERL_OS_MON_OPTIONS="-os_mon \
0++    start_memsup false \
0++    start_cpu_sup false \
0++    disk_space_check_interval 1 \
0++    disk_almost_full_threshold 1"
0++ERL_START_OPTIONS="$ERL_OS_MON_OPTIONS -sasl errlog_type error +K true +A 4"
0+ HEART_BEAT_TIMEOUT=11
0+ HEART_COMMAND="%bindir%/%couchdb_command_name% -k"
0+ INTERACTIVE=false
0+diff --git a/src/couchdb/couch_app.erl b/src/couchdb/couch_app.erl
0+index 232953d..f109780 100644
0+--- a/src/couchdb/couch_app.erl
0++++ b/src/couchdb/couch_app.erl
0+@@ -20,7 +20,7 @@
0+ 
0+ start(_Type, DefaultIniFiles) ->
0+     IniFiles = get_ini_files(DefaultIniFiles),
0+-    case start_apps([crypto, public_key, sasl, inets, oauth, ssl, ibrowse, mochiweb]) of
0++    case start_apps([crypto, public_key, sasl, inets, oauth, ssl, ibrowse, mochiweb, os_mon]) of
0+     ok ->
0+         couch_server_sup:start_link(IniFiles);
0+     {error, Reason} ->
0+diff --git a/src/couchdb/couch_compaction_daemon.erl b/src/couchdb/couch_compaction_daemon.erl
0+index ab85db8..6a0f140 100644
0+--- a/src/couchdb/couch_compaction_daemon.erl
0++++ b/src/couchdb/couch_compaction_daemon.erl
0+@@ -56,38 +56,15 @@ init(_) ->
0+     ?CONFIG_ETS = ets:new(?CONFIG_ETS, [named_table, set, protected]),
0+     ok = couch_config:register(fun ?MODULE:config_change/3),
0+     load_config(),
0+-    case start_os_mon() of
0+-    ok ->
0+-        Server = self(),
0+-        Loop = spawn_link(fun() -> compact_loop(Server) end),
0+-        {ok, #state{loop_pid = Loop}};
0+-    Error ->
0+-        {stop, Error}
0+-    end.
0++    Server = self(),
0++    Loop = spawn_link(fun() -> compact_loop(Server) end),
0++    {ok, #state{loop_pid = Loop}}.
0+ 
0+ 
0+ config_change("compactions", DbName, NewValue) ->
0+     ok = gen_server:cast(?MODULE, {config_update, DbName, NewValue}).
0+ 
0+ 
0+-start_os_mon() ->
0+-    _ = application:load(os_mon),
0+-    ok = application:set_env(
0+-        os_mon, disk_space_check_interval, ?DISK_CHECK_PERIOD),
0+-    ok = application:set_env(os_mon, disk_almost_full_threshold, 1),
0+-    ok = application:set_env(os_mon, start_memsup, false),
0+-    ok = application:set_env(os_mon, start_cpu_sup, false),
0+-    _ = application:start(sasl),
0+-    case application:start(os_mon) of
0+-    ok ->
0+-        ok;
0+-    {error, {already_started, os_mon}} ->
0+-        ok;
0+-    Error ->
0+-        Error
0+-    end.
0+-
0+-
0+ handle_cast({config_update, DbName, deleted}, State) ->
0+     true = ets:delete(?CONFIG_ETS, ?l2b(DbName)),
0+     {noreply, State};
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
--- Revision None
+++ Revision 663534393461
@@ -0,0 +1,77 @@
+diff --git a/bin/couchdb.tpl.in b/bin/couchdb.tpl.in
+index 370bdb4..eab27b5 100644
+--- a/bin/couchdb.tpl.in
++++ b/bin/couchdb.tpl.in
+@@ -15,7 +15,12 @@
+ BACKGROUND=false
+ DEFAULT_CONFIG_DIR=%localconfdir%/default.d
+ DEFAULT_CONFIG_FILE=%localconfdir%/%defaultini%
+-ERL_START_OPTIONS="-sasl errlog_type error +K true +A 4"
++ERL_OS_MON_OPTIONS="-os_mon \
++ start_memsup false \
++ start_cpu_sup false \
++ disk_space_check_interval 1 \
++ disk_almost_full_threshold 1"
++ERL_START_OPTIONS="$ERL_OS_MON_OPTIONS -sasl errlog_type error +K true +A 4"
+ HEART_BEAT_TIMEOUT=11
+ HEART_COMMAND="%bindir%/%couchdb_command_name% -k"
+ INTERACTIVE=false
+diff --git a/src/couchdb/couch_app.erl b/src/couchdb/couch_app.erl
+index 232953d..f109780 100644
+--- a/src/couchdb/couch_app.erl
++++ b/src/couchdb/couch_app.erl
+@@ -20,7 +20,7 @@
+
+ start(_Type, DefaultIniFiles) ->
+ IniFiles = get_ini_files(DefaultIniFiles),
+- case start_apps([crypto, public_key, sasl, inets, oauth, ssl, ibrowse, mochiweb]) of
++ case start_apps([crypto, public_key, sasl, inets, oauth, ssl, ibrowse, mochiweb, os_mon]) of
+ ok ->
+ couch_server_sup:start_link(IniFiles);
+ {error, Reason} ->
+diff --git a/src/couchdb/couch_compaction_daemon.erl b/src/couchdb/couch_compaction_daemon.erl
+index ab85db8..6a0f140 100644
+--- a/src/couchdb/couch_compaction_daemon.erl
++++ b/src/couchdb/couch_compaction_daemon.erl
+@@ -56,38 +56,15 @@ init(_) ->
+ ?CONFIG_ETS = ets:new(?CONFIG_ETS, [named_table, set, protected]),
+ ok = couch_config:register(fun ?MODULE:config_change/3),
+ load_config(),
+- case start_os_mon() of
+- ok ->
+- Server = self(),
+- Loop = spawn_link(fun() -> compact_loop(Server) end),
+- {ok, #state{loop_pid = Loop}};
+- Error ->
+- {stop, Error}
+- end.
++ Server = self(),
++ Loop = spawn_link(fun() -> compact_loop(Server) end),
++ {ok, #state{loop_pid = Loop}}.
+
+
+ config_change("compactions", DbName, NewValue) ->
+ ok = gen_server:cast(?MODULE, {config_update, DbName, NewValue}).
+
+
+-start_os_mon() ->
+- _ = application:load(os_mon),
+- ok = application:set_env(
+- os_mon, disk_space_check_interval, ?DISK_CHECK_PERIOD),
+- ok = application:set_env(os_mon, disk_almost_full_threshold, 1),
+- ok = application:set_env(os_mon, start_memsup, false),
+- ok = application:set_env(os_mon, start_cpu_sup, false),
+- _ = application:start(sasl),
+- case application:start(os_mon) of
+- ok ->
+- ok;
+- {error, {already_started, os_mon}} ->
+- ok;
+- Error ->
+- Error
+- end.
+-
+-
+ handle_cast({config_update, DbName, deleted}, State) ->
+ true = ets:delete(?CONFIG_ETS, ?l2b(DbName)),
+ {noreply, State};