From c62f4279c06ab8d7695ec953d5d4b418c99e69b0 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Mon, 21 Aug 2017 16:50:16 +0200 Subject: [PATCH] Be more verbose with long-running loads. Add a message every 20 batches so that the user knows it's still going on. Also, in passing, fix some messages: present is not precise enough to decide if the log refers to an event that is being done or starting next. --- src/package.lisp | 1 + src/sources/common/db-methods.lisp | 2 +- src/utils/monitor.lisp | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/package.lisp b/src/package.lisp index 3c8b6f5..9b9edc3 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -207,6 +207,7 @@ #:pgtable-initialize-reject-files #:pgtable-secs + #:pgtable-rows #:pgtable-start #:pgtable-stop #:pgtable-reject-data diff --git a/src/sources/common/db-methods.lisp b/src/sources/common/db-methods.lisp index 1d2e3d7..edf62d1 100644 --- a/src/sources/common/db-methods.lisp +++ b/src/sources/common/db-methods.lisp @@ -135,7 +135,7 @@ ;; able to benefit from the indexes. In particular avoid doing that step ;; while CREATE INDEX statements are in flight (avoid locking). ;; - (log-message :notice "Complete PostgreSQL database.") + (log-message :notice "Completing PostgreSQL database.") (when reset-sequences (reset-sequences (clone-connection (target-db copy)) catalog)) diff --git a/src/utils/monitor.lisp b/src/utils/monitor.lisp index 2e4b96c..32eefc7 100644 --- a/src/utils/monitor.lisp +++ b/src/utils/monitor.lisp @@ -238,6 +238,21 @@ :rs (update-stats-rs event) :ws (update-stats-ws event)) + ;; log some kind of a “keep alive” message to the user, for + ;; the sake of showing progress. + ;; + ;; something like one message every 20 batches should only + ;; target big tables where we have to wait for a pretty long + ;; time. + (when (and (update-stats-rows event) + (typep label 'pgloader.catalog:table) + (< (* 19 *copy-batch-rows*) + (mod (pgtable-rows table) + (* 20 *copy-batch-rows*)))) + (log-message :notice "copy ~a: ~d rows done" + (pgloader.catalog:format-table-name label) + (pgtable-rows table))) + (when (update-stats-start event) (log-message :debug "start ~a ~30t ~a" (pgloader.catalog:format-table-name label)