Fix function exporting bug, and index counts that caused infinite waiting.

This commit is contained in:
Dimitri Fontaine 2013-11-04 23:13:46 +01:00
parent 9600159d3c
commit ff9d0fd6f5
3 changed files with 13 additions and 7 deletions

View File

@ -22,7 +22,8 @@
#:*myconn-port*
#:*myconn-user*
#:*myconn-pass*
#:*state*))
#:*state*
#:getenv-default))
(in-package :pgloader.params)

View File

@ -204,7 +204,12 @@
(copy-kernel (make-kernel 2))
(all-columns (list-all-columns (db sqlite)))
(all-indexes (list-all-indexes (db sqlite)))
(max-indexes (loop for (table . indexes) in all-indexes
(our-indexes (if only-tables
(loop for (table . indexes) in all-indexes
when (member table only-tables :test #'string=)
collect (cons table indexes))
all-indexes))
(max-indexes (loop for (table . indexes) in our-indexes
maximizing (length indexes)))
(idx-kernel (when (and max-indexes (< 0 max-indexes))
(make-kernel max-indexes)))
@ -249,7 +254,7 @@
;; will get built in parallel --- not a big problem.
(when create-indexes
(let* ((indexes
(cdr (assoc table-name all-indexes :test #'string=))))
(cdr (assoc table-name our-indexes :test #'string=))))
(create-indexes-in-kernel pg-dbname indexes
idx-kernel idx-channel
:state idx-state
@ -267,12 +272,12 @@
(pgloader.pgsql:reset-all-sequences pg-dbname :tables tables))))
;; now end the kernels
(let ((lp:*kernel* idx-kernel)) (lp:end-kernel))
(let ((lp:*kernel* copy-kernel))
(let ((lp:*kernel* copy-kernel)) (lp:end-kernel))
(let ((lp:*kernel* idx-kernel))
;; wait until the indexes are done being built...
;; don't forget accounting for that waiting time.
(with-stats-collection (pg-dbname "index build completion" :state *state*)
(loop for idx in all-indexes do (lp:receive-result idx-channel)))
(loop for idx in our-indexes do (lp:receive-result idx-channel)))
(lp:end-kernel))
;; and report the total time spent on the operation

View File

@ -1,6 +1,6 @@
load database
from sqlite:///Users/dim/Downloads/lastfm_tags.db
into postgresql:///tags
into postgresql://127.0.0.1:54393/tags?tids
with drop tables, create tables, create indexes, reset sequences