bdr: Don't proc_exit(0) in normal paths of the apply process.
authorAndres Freund <andres@anarazel.de>
Mon, 9 Feb 2015 02:33:14 +0000 (03:33 +0100)
committerAndres Freund <andres@anarazel.de>
Thu, 12 Feb 2015 09:16:59 +0000 (10:16 +0100)
Doing so unregisters the worker, which is usually not what's
wanted. Instead replace the one location that wants to unregister, and
use 1 as an exit code everywhere else.

bdr_apply.c

index 122eefdc33812bb6489176e7ef5b57a1da845076..bc5de6bcab56180916d5da24524ee8ee09ac443c 100644 (file)
@@ -389,9 +389,8 @@ process_remote_commit(StringInfo s)
        /* flush all writes so the latest position can be reported back to the sender */
        XLogFlush(GetXLogWriteRecPtr());
 
-
-       /* Signal that we should stop */
-       got_SIGTERM = true;
+       /* Stop gracefully */
+       proc_exit(0);
    }
 }
 
@@ -2542,5 +2541,9 @@ bdr_apply_main(Datum main_arg)
    }
    PG_END_TRY();
 
-   proc_exit(0);
+   /*
+    * never exit gracefully (as that'd unregister the worker) unless
+    * explicitly asked to do so.
+    */
+   proc_exit(1);
 }