- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
PutSQL failed to update database due to a failed batch update. How to resolve it?
- Labels:
-
Apache NiFi
Created ‎04-06-2017 12:43 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to run Redshift COPY command.
My flow is GetFile --> ReplaceText --> PutSQL --> LogAttribute
This gives me error as observed in nifi-app.log file:
ERROR [Timer-Driven Process Thread-5] o.apache.nifi.processors.standard.PutSQL PutSQL[id=015b1002-5ef3-12b5-6171-cc112664e2df] Failed to update database due to a failed batch update. There were a total of 1 FlowFiles that failed, 0 that succeeded, and 0 that were not execute and will be routed to retry;
I configured my DBCPConnectionPool correctly and for some time, I can see the query running in redshift. But after some time, I get this error.
I tried using ExecuteSQL processor as well but as my query does not return anything so it won't help.
Created ‎04-06-2017 02:07 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try the following:
- Route the "failure" relationship to some processor you don't start (like UpdateAttribute)
- When a flow file fails, right-click on the failure connection and choose List Queue
- Click the info button (an "i" in a circle) to the left of the flow file, then choose View to see the contents
Does that look like a valid SQL statement? Can you try running it from the command line or in a separate PutSQL instance?
Also since you are getting the error after time, perhaps the connection is going idle and then failing. Is there any other error information around the error in the log file you mention above? Sometimes there is a "Caused by" line below it that refers to the lower-level error.
What version of NiFi are you using? As of NiFi 1.1.0, you can supply a Validation Query to the DBCPConnectionPool, this ensures that the connection is valid. A Validation Query is a query that does as little work as possible while still establishing connectivity to the server. An example of this (for Oracle) is "select 1 from dual". If you have that property available to you, please try something like that as the Validation Query, it may alleviate this issue if it is intermittent and related to idle time.
Created ‎04-06-2017 02:07 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try the following:
- Route the "failure" relationship to some processor you don't start (like UpdateAttribute)
- When a flow file fails, right-click on the failure connection and choose List Queue
- Click the info button (an "i" in a circle) to the left of the flow file, then choose View to see the contents
Does that look like a valid SQL statement? Can you try running it from the command line or in a separate PutSQL instance?
Also since you are getting the error after time, perhaps the connection is going idle and then failing. Is there any other error information around the error in the log file you mention above? Sometimes there is a "Caused by" line below it that refers to the lower-level error.
What version of NiFi are you using? As of NiFi 1.1.0, you can supply a Validation Query to the DBCPConnectionPool, this ensures that the connection is valid. A Validation Query is a query that does as little work as possible while still establishing connectivity to the server. An example of this (for Oracle) is "select 1 from dual". If you have that property available to you, please try something like that as the Validation Query, it may alleviate this issue if it is intermittent and related to idle time.
Created ‎04-07-2017 08:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Yes, i tried looking into it the way you told. It was some delimiter error in the query.
Thanks @Matt Burgess
