From e4a4edb276ebde69c41943252a112972b6f9db9f Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Mon, 7 Jan 2019 20:42:36 +0100 Subject: [PATCH] Make interactive debugging easier. It's fair game to handle errors and issue logs instead when using the pgloader binary image, as it distracts users a lot. That said, as a developer the interactive debugger is very useful. In passing install some experimental thread killing behavior in case of errors and using on-error-stop setting (default for database migrations). --- src/load/copy-data.lisp | 10 +++++++--- src/utils/monitor.lisp | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/load/copy-data.lisp b/src/load/copy-data.lisp index 67a68d6..676b814 100644 --- a/src/load/copy-data.lisp +++ b/src/load/copy-data.lisp @@ -74,13 +74,17 @@ (incf task-count))) (lp:task-handler-bind - ((copy-init-error + (#+pgloader-image + (copy-init-error #'(lambda (condition) - ;; everything has been handled already + ;; stop the other tasks and then transfer the control + (log-message :log "COPY INIT ERROR") + (lp:kill-tasks :default) (lp:invoke-transfer-error condition))) (on-error-stop #'(lambda (condition) - ;; everything has been handled already + (log-message :log "ON ERROR STOP") + (lp:kill-tasks :default) (lp:invoke-transfer-error condition))) #+pgloader-image (error diff --git a/src/utils/monitor.lisp b/src/utils/monitor.lisp index 569e4e2..c56652d 100644 --- a/src/utils/monitor.lisp +++ b/src/utils/monitor.lisp @@ -147,7 +147,8 @@ (*summary-pathname* . ,*summary-pathname*) (*sections* . ',*sections*))) (kernel (lp:make-kernel 1 :bindings bindings)) - (lparallel:*kernel* kernel)) + (lparallel:*kernel* kernel) + (lparallel:*task-category* :monitor)) ;; make our kernel and channel visible from the outside (setf *monitoring-kernel* kernel @@ -155,7 +156,8 @@ *monitoring-queue* (lq:make-queue)) (lp:task-handler-bind - ((error + (#+pgloader-image + (error #'(lambda (c) ;; we can't log-message a monitor thread error (lp:invoke-transfer-error