mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 18:36:12 +02:00
Handle more conditions, fix #57.
Turns out that in cases it's not possible to call format-vector-row on MySQL result sets, because it's been sending us vector of bytes (blob) while the expected data (from the table definition) clearly is text. Handle the error as an input reading error, skipping the line and being verbose about it in the logs. This patch fails to update the stats about what's happening because, so might need later changes.
This commit is contained in:
parent
6d92dc251f
commit
d7b05ba411
@ -46,17 +46,21 @@
|
||||
;;
|
||||
;; All the data transformation takes place here, so that we batch fully
|
||||
;; formed COPY TEXT string ready to go in the PostgreSQL stream.
|
||||
(let ((copy-string (with-output-to-string (s)
|
||||
(format-vector-row s row (transforms copy)))))
|
||||
(with-slots (data count bytes) *current-batch*
|
||||
(setf (aref data count) copy-string)
|
||||
(when *copy-batch-size* ; running under memory watch
|
||||
(incf bytes
|
||||
#+sbcl (length
|
||||
(sb-ext:string-to-octets copy-string :external-format :utf-8))
|
||||
#+ccl (ccl:string-size-in-octets copy-string :external-format :utf-8)
|
||||
#- (or sbcl ccl) (length copy-string)))
|
||||
(incf count))))
|
||||
(handler-case
|
||||
(let ((copy-string (with-output-to-string (s)
|
||||
(format-vector-row s row (transforms copy)))))
|
||||
(with-slots (data count bytes) *current-batch*
|
||||
(setf (aref data count) copy-string)
|
||||
(when *copy-batch-size* ; running under memory watch
|
||||
(incf bytes
|
||||
#+sbcl (length
|
||||
(sb-ext:string-to-octets copy-string :external-format :utf-8))
|
||||
#+ccl (ccl:string-size-in-octets copy-string :external-format :utf-8)
|
||||
#- (or sbcl ccl) (length copy-string)))
|
||||
(incf count)))
|
||||
|
||||
(condition (e)
|
||||
(log-message :error "~a" e))))
|
||||
|
||||
(defun map-push-queue (copy queue)
|
||||
"Apply MAP-ROWS on the COPY instance and a function of ROW that will push
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user