Fix error reporting of catalogs.

The internal catalog representation are deeply recursive in order to
make it easy to traverse the catalog both downwards (catalog to schema
to tables) and upward (table to its schema to its catalog).

In consequence we need to set *print-circles* to non-nil when we're
going to log the catalogs, so turn it to non-nil before generating the
log messages.

While at it, add logging of such catalogs in the :data log verbosity
mode. The catalog output is very verbose, but it's easy to copy/paste it
from a bug report into being a live object we can inspect in the REPL,
thanks to Common Lisp notion of a reader and readable printer!
This commit is contained in:
Dimitri Fontaine 2016-08-30 23:18:40 +02:00
parent 7070f82976
commit 3569980378
3 changed files with 12 additions and 7 deletions

View File

@ -98,7 +98,10 @@
(with-stats-collection ("Create MatViews Tables" :section :pre
:use-result-as-read t
:use-result-as-rows t)
(create-views catalog :include-drop include-drop)))))
(create-views catalog :include-drop include-drop))))
;; log the catalog we just fetched and (maybe) merged
(log-message :data "CATALOG: ~s" catalog))
(defmethod cleanup ((copy db-copy) (catalog catalog) &key materialize-views)
"In case anything wrong happens at `prepare-pgsql-database' step, this

View File

@ -121,6 +121,8 @@
(list (column-name col)))
(table-field-list (first (table-list pgsql-catalog))))))
(log-message :data "CATALOG: ~s" pgsql-catalog)
;; this sets (table-index-list (target copy))
(maybe-drop-indexes pgsql-catalog :drop-indexes drop-indexes)

View File

@ -194,12 +194,12 @@
(log-message
;; cl-log:log-message is a macro, we can't use apply
;; here, so we need to break a level of abstraction
(let ((mesg (if (log-message-arguments event)
(format nil "~{~}"
(log-message-description event)
(log-message-arguments event))
(log-message-description event)))
(*print-circle* t))
(let* ((*print-circle* t)
(mesg (if (log-message-arguments event)
(format nil "~{~}"
(log-message-description event)
(log-message-arguments event))
(log-message-description event))))
(cl-log:log-message (log-message-category event) "~a" mesg)))
(new-label