fluent-plugin-pgjson icon indicating copy to clipboard operation
fluent-plugin-pgjson copied to clipboard

check connection status befor the put_copy_end method

Open pigi-spm opened this issue 3 years ago • 0 comments

Hi,

this bug-fix is due to an error after DB connection, if you use BUFFER in fluentd configuration file with this plugin. You have this problem if the connection to DB is already established and after the connection interruption the plugin tries to use the put_copy_end method to send the end-of-data indication to the server, but if the connection doesn't exists or it's was interrupted, plugin can't send request and generates an error. At this point the only possibility to restore the connection is to restart fluentd process so that the connection is re-established with the DB and the data is send again.

The if on code checks if you have a valid connection or not, if not it resets the connection immediately. After many tests, it seems to work correctly with the option of Buffer.

image

Best regards

pigi-spm avatar Mar 31 '22 15:03 pigi-spm