5vB0pIKtXXRM0eij296ibX changeset

Changeset373538353037 (b)
ParentNone (a)
ab
0+diff --git a/src/couchdb/couch_os_process.erl b/src/couchdb/couch_os_process.erl
0+index 3a267be..15e845b 100644
0+--- a/src/couchdb/couch_os_process.erl
0++++ b/src/couchdb/couch_os_process.erl
0+@@ -20,7 +20,7 @@
0+ 
0+ -include("couch_db.hrl").
0+ 
0+--define(PORT_OPTIONS, [stream, {line, 4096}, binary, exit_status, hide]).
0++-define(PORT_OPTIONS, [stream, {line, 1024}, binary, exit_status, hide]).
0+ 
0+ -record(os_proc,
0+     {command,
0+@@ -94,7 +94,7 @@ drop_port_messages(Port) ->
0+ % Utility functions for reading and writing
0+ % in custom functions
0+ writeline(OsProc, Data) when is_record(OsProc, os_proc) ->
0+-    port_command(OsProc#os_proc.port, [Data, $\n]).
0++    port_command(OsProc#os_proc.port, [Data, $\r, $\n]).
0+ 
0+ readline(#os_proc{} = OsProc) ->
0+     readline(OsProc, []).
0+@@ -123,12 +123,12 @@ readline(#os_proc{port = Port} = OsProc, Acc) ->
0+ % Standard JSON functions
0+ writejson(OsProc, Data) when is_record(OsProc, os_proc) ->
0+     JsonData = ?JSON_ENCODE(Data),
0+-    ?LOG_DEBUG("OS Process ~p Input  :: ~s", [OsProc#os_proc.port, JsonData]),
0++    ?LOG_INFO("OS Process ~p Input  :: ~s", [OsProc#os_proc.port, JsonData]),
0+     true = writeline(OsProc, JsonData).
0+ 
0+ readjson(OsProc) when is_record(OsProc, os_proc) ->
0+     Line = iolist_to_binary(readline(OsProc)),
0+-    ?LOG_DEBUG("OS Process ~p Output :: ~s", [OsProc#os_proc.port, Line]),
0++    ?LOG_INFO("OS Process ~p Output :: ~s", [OsProc#os_proc.port, Line]),
0+     try
0+         % Don't actually parse the whole JSON. Just try to see if it's
0+         % a command or a doc map/reduce/filter/show/list/update output.
0+@@ -185,7 +185,7 @@ init([Command, Options, PortOptions]) ->
0+     },
0+     KillCmd = iolist_to_binary(readline(BaseProc)),
0+     Pid = self(),
0+-    ?LOG_DEBUG("OS Process Start :: ~p", [BaseProc#os_proc.port]),
0++    ?LOG_INFO("OS Process Start :: ~p", [BaseProc#os_proc.port]),
0+     spawn(fun() ->
0+             % this ensure the real os process is killed when this process dies.
0+             erlang:monitor(process, Pid),
0+@@ -231,20 +231,20 @@ handle_cast({send, Data}, #os_proc{writer=Writer}=OsProc) ->
0+         {noreply, OsProc}
0+     catch
0+         throw:OsError ->
0+-            ?LOG_ERROR("Failed sending data: ~p -> ~p", [Data, OsError]),
0++            ?LOG_INFO("Failed sending data: ~p -> ~p", [Data, OsError]),
0+             {stop, normal, OsProc}
0+     end;
0+ handle_cast(stop, OsProc) ->
0+     {stop, normal, OsProc};
0+ handle_cast(Msg, OsProc) ->
0+-    ?LOG_DEBUG("OS Proc: Unknown cast: ~p", [Msg]),
0++    ?LOG_INFO("OS Proc: Unknown cast: ~p", [Msg]),
0+     {noreply, OsProc}.
0+ 
0+ handle_info({Port, {exit_status, 0}}, #os_proc{port=Port}=OsProc) ->
0+     ?LOG_INFO("OS Process terminated normally", []),
0+     {stop, normal, OsProc};
0+ handle_info({Port, {exit_status, Status}}, #os_proc{port=Port}=OsProc) ->
0+-    ?LOG_ERROR("OS Process died with status: ~p", [Status]),
0++    ?LOG_INFO("OS Process died with status: ~p", [Status]),
0+     {stop, {exit_status, Status}, OsProc}.
0+ 
0+ code_change(_OldVsn, State, _Extra) ->
...
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
--- Revision None
+++ Revision 373538353037
@@ -0,0 +1,70 @@
+diff --git a/src/couchdb/couch_os_process.erl b/src/couchdb/couch_os_process.erl
+index 3a267be..15e845b 100644
+--- a/src/couchdb/couch_os_process.erl
++++ b/src/couchdb/couch_os_process.erl
+@@ -20,7 +20,7 @@
+
+ -include("couch_db.hrl").
+
+--define(PORT_OPTIONS, [stream, {line, 4096}, binary, exit_status, hide]).
++-define(PORT_OPTIONS, [stream, {line, 1024}, binary, exit_status, hide]).
+
+ -record(os_proc,
+ {command,
+@@ -94,7 +94,7 @@ drop_port_messages(Port) ->
+ % Utility functions for reading and writing
+ % in custom functions
+ writeline(OsProc, Data) when is_record(OsProc, os_proc) ->
+- port_command(OsProc#os_proc.port, [Data, $\n]).
++ port_command(OsProc#os_proc.port, [Data, $\r, $\n]).
+
+ readline(#os_proc{} = OsProc) ->
+ readline(OsProc, []).
+@@ -123,12 +123,12 @@ readline(#os_proc{port = Port} = OsProc, Acc) ->
+ % Standard JSON functions
+ writejson(OsProc, Data) when is_record(OsProc, os_proc) ->
+ JsonData = ?JSON_ENCODE(Data),
+- ?LOG_DEBUG("OS Process ~p Input :: ~s", [OsProc#os_proc.port, JsonData]),
++ ?LOG_INFO("OS Process ~p Input :: ~s", [OsProc#os_proc.port, JsonData]),
+ true = writeline(OsProc, JsonData).
+
+ readjson(OsProc) when is_record(OsProc, os_proc) ->
+ Line = iolist_to_binary(readline(OsProc)),
+- ?LOG_DEBUG("OS Process ~p Output :: ~s", [OsProc#os_proc.port, Line]),
++ ?LOG_INFO("OS Process ~p Output :: ~s", [OsProc#os_proc.port, Line]),
+ try
+ % Don't actually parse the whole JSON. Just try to see if it's
+ % a command or a doc map/reduce/filter/show/list/update output.
+@@ -185,7 +185,7 @@ init([Command, Options, PortOptions]) ->
+ },
+ KillCmd = iolist_to_binary(readline(BaseProc)),
+ Pid = self(),
+- ?LOG_DEBUG("OS Process Start :: ~p", [BaseProc#os_proc.port]),
++ ?LOG_INFO("OS Process Start :: ~p", [BaseProc#os_proc.port]),
+ spawn(fun() ->
+ % this ensure the real os process is killed when this process dies.
+ erlang:monitor(process, Pid),
+@@ -231,20 +231,20 @@ handle_cast({send, Data}, #os_proc{writer=Writer}=OsProc) ->
+ {noreply, OsProc}
+ catch
+ throw:OsError ->
+- ?LOG_ERROR("Failed sending data: ~p -> ~p", [Data, OsError]),
++ ?LOG_INFO("Failed sending data: ~p -> ~p", [Data, OsError]),
+ {stop, normal, OsProc}
+ end;
+ handle_cast(stop, OsProc) ->
+ {stop, normal, OsProc};
+ handle_cast(Msg, OsProc) ->
+- ?LOG_DEBUG("OS Proc: Unknown cast: ~p", [Msg]),
++ ?LOG_INFO("OS Proc: Unknown cast: ~p", [Msg]),
+ {noreply, OsProc}.
+
+ handle_info({Port, {exit_status, 0}}, #os_proc{port=Port}=OsProc) ->
+ ?LOG_INFO("OS Process terminated normally", []),
+ {stop, normal, OsProc};
+ handle_info({Port, {exit_status, Status}}, #os_proc{port=Port}=OsProc) ->
+- ?LOG_ERROR("OS Process died with status: ~p", [Status]),
++ ?LOG_INFO("OS Process died with status: ~p", [Status]),
+ {stop, {exit_status, Status}, OsProc}.
+
+ code_change(_OldVsn, State, _Extra) ->