mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 10:31:02 +02:00
Fix function exporting bug, and index counts that caused infinite waiting.
This commit is contained in:
parent
9600159d3c
commit
ff9d0fd6f5
@ -22,7 +22,8 @@
|
||||
#:*myconn-port*
|
||||
#:*myconn-user*
|
||||
#:*myconn-pass*
|
||||
#:*state*))
|
||||
#:*state*
|
||||
#:getenv-default))
|
||||
|
||||
(in-package :pgloader.params)
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user