On Tue, 22 Dec 2015 18:24:13 +0000
Harry Foster <[email protected]> wrote:
> However, it seems as soon as I enable the sql_preprocess directive we
> correctly get the reduced writes to the database as shown in the logs
> as the QN isn't 0/x, but no rows actually end up in the database.
Yeah. The transaction fails, so nothing changes in the db.
> In the PostgreSQL log I notice the following error after the COPY
> statements:
>
> LOG: incomplete message from client
> CONTEXT: COPY agg_ipsrc, line 264
> STATEMENT: COPY agg_ipsrc (stamp_updated, stamp_inserted, ip_src,
> packets, bytes) FROM STDIN DELIMITER ',' ERROR: unexpected EOF on
> client connection with an open transaction CONTEXT: COPY agg_ipsrc,
> line 264 STATEMENT: COPY agg_ipsrc (stamp_updated, stamp_inserted,
> ip_src, packets, bytes) FROM STDIN DELIMITER ',' FATAL: terminating
> connection because protocol sync was lost
>
> It's similar with INSERTS:
>
> LOG: statement: INSERT INTO agg_ipdst (stamp_updated,
> stamp_inserted, ip_dst, packets, bytes) VALUES
> (ABSTIME(1450805401)::Timestamp, ABSTIME(1450805100)::Timestamp,
> '255.255.0.246', 988, 988) LOG: unexpected EOF on client connection
> with an open transaction
Just guessing as to problems from the Postgres side. Don't
consider this authoritative in any way. Just writing in
case this helps.
Regards the COPY: The docs say:
End of data can be represented by a single line containing just
backslash-period (\.). An end-of-data marker is not necessary
when reading from a file, since the end of file serves perfectly
well; it is needed only when copying data to or from client
applications using pre-3.0 client protocol.
So, perhaps you are using a pre 3.0 protocol and pmacct is omitting a
trailing \. as the last line of data? This would depend on
your version of Postgres and the libpq used to link with pmacct.
I don't recall when the protocol changed, but I think it was some time
ago so this may be irrelevant.
But that does not really speak to a problem with INSERT.
Regards,
Karl <[email protected]>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein
_______________________________________________
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists