![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
[...] This whole story made me think if and when, an unhandled exception should be considered fatal or not, apart from that not having exception handling code is bad programming practice. The sys admin manual says that "Fatal errors are those errors that require correction before Ingres can proceed with the program. All errors, including fatal errors, are recoverable." What does that actually mean? a fatal error being recoverable ? so what is the difference between a fatal and a non-fatal one ? |
#3
| |||
| |||
|
|
Now, if you want to drive yourself totally nuts, consider a deadlock (a transient error). Where do you retryt from? Really? Are you sure? How do you know that? >:-) just by reading that drove me nuts already!! let alone looking into |

#4
| |||
| |||
|
|
A client installed an unpatched version II 9.2.1 (a64.lnx/103)NPTL and when running a ABF/4GL app the following error appears : "E_US1265 Database reorganization activity has rendered the query plan invalid. Try again after the db activity is complete. In case of dynamic SQL, the statement must be prepared again." I' ve seen this error before though. Check "E_US1265 Database reorganization error" post http://bit.ly/jv9qlO for reference, although that post's code is different from the current code that generated the same error. Turns out it was a bug since after installing patch 14065 the error never appeared again This is not a question on the bug per se but when an exception should be considered fatal. I inspected the code and there is no exception handling. i.e. there is no "inquire_ingres (h_errorno=errorno)" to catch the error, thus the exception is unhandled, the code after it is not interrupted and execution flows as normal As to why there is no exception handling, I can only speculate that the guy who wrote the code thought that it is just a Select query and thus there is no need for error checking (??) However this error is more subtle than it seems since the query plan cannot be run to completion and returns an incomplete/partial result set back To make things even harder, in the first/old case, the user was notified of the error with a pop-up fired from within the application (since it is a Forms based one), but in this second/new case there was no pop-up warning (I don't know why since there is no 'seterr' installed to supress the warning) the only indication that an error occurred was an entry in the error log. Furthermore in this second case a report is called that does further calculations upon the returned data and returns a smaller than expected sum/result back. But as far as the end user was concerned everything run ok and the reports was generated correctly This whole story made me think if and when, an unhandled exception should be considered fatal or not, apart from that not having exception handling code is bad programming practice. The sys admin manual says that "Fatal errors are those errors that require correction before Ingres can proceed with the program. All errors, including fatal errors, are recoverable." What does that actually mean? a fatal error being recoverable ? so what is the difference between a fatal and a non-fatal one ? _______________________________________________ Info-Ingres mailing list Info-Ingres (AT) kettleriverconsulting (DOT) com http://ext-cando.kettleriverconsulti...fo/info-ingres |
#5
| |||
| |||
|
|
Isn't it good practice to include code in a loop, with an error check, so that it can be retried a few times before giving up? |
|
This should allow recovery from deadlock and is no big deal to retry for serious errors. |
#6
| |||
| |||
|
|
Isn't it good practice to include code in a loop, with an error check, so that it can be retried a few times before giving up? |
#7
| |||
| |||
|
|
Isn't it good practice to include code in a loop, with an error check, so that it can be retried a few times before giving up? I guess so but it sounds overly complicated. |
|
Like that you must wrap all code that touches the dbms in while loops and gotos (seen that in ESQL code) while I would prefer to use straight forward STH (you could combine try..catch with while loops though) or it could work if you are on a persistent / statefull connection but what about when you are on a disconnected cache? i.e on a web based application how long should the client wait before he gets the error message? |
|
It also masquerades the problem at the application layer rather than resolving it at the data layer (for example avoid a deadlock by reducing the isolation level or use MVCC, locking hints etc) |
#8
| |||
| |||
|
|
On net wrote: Isn't it good practice to include code in a loop, with an error check, so that it can be retried a few times before giving up? The idea of looping to recover is good. I've just got back from a day of meetings so I don't really feel like writing a lot about this just now. I'll come back to it tomorrow--promise. But to pass the time, and because I started this by posing the problem as a sort of puzzle, why is merely looping not guaranteed to recover correctly even if the deadlock condition goes away? (Hint, this is a lifecycle issue.) |
|
This should allow recovery from deadlock and is no big deal to retry for serious errors. |
#9
| |||
| |||
|
|
On 06/07/2011 05:52, nikosv wrote: Isn't it good practice to include code in a loop, with an error check, so that it can be retried a few times before giving up? I guess so but it sounds overly complicated. It's simply a while loop wrapper around a transaction. ("while transaction is in error and retry count is less than X, retry transaction"); There is a good argument for removing all database interaction into a single place and there generic transaction handling can be applied - all SQL in one place, not spread around the world. I think there should be an option to ban SQL interaction from all frame scripts in OpenROAD.. Like that you must wrap all code that touches the dbms in while loops and gotos (seen that in ESQL code) while I would prefer to use straight forward STH (you could combine try..catch with while loops though) or it could work if you are on a persistent / statefull connection but what about when you are on a disconnected cache? i.e on a web based application how long should the client wait before he gets the error message? The end user shouldn't be expected to wait longer depending on a technology choice - any tolerance of latency should be the same, regardless of whether it's a web application or any other form of application. For the purposes of transaction handling it doesn't matter whether the session is persistent or not. It also masquerades the problem at the application layer rather than resolving it at the data layer (for example avoid a deadlock by reducing the isolation level or use MVCC, locking hints etc) There is always a potential for deadlock or delay when accessing/updating a resource used by multiple concurrent users. The looping mechanism allows the software to retry a transaction, which seems a perfectly reasonable thing to do. If deadlock occurs one session is going to have to yield a resource for the other to continue. I don't see this as masquerading at all. |
|
If a while loop is not used how do you propose retrying a deadlocked transaction? |
#10
| |||
| |||
|
|
On 05/07/2011 19:53, Roy Hann wrote: On net wrote: Isn't it good practice to include code in a loop, with an error check, so that it can be retried a few times before giving up? The idea of looping to recover is good. I've just got back from a day of meetings so I don't really feel like writing a lot about this just now. I'll come back to it tomorrow--promise. But to pass the time, and because I started this by posing the problem as a sort of puzzle, why is merely looping not guaranteed to recover correctly even if the deadlock condition goes away? (Hint, this is a lifecycle issue.) To clever for me. Retrying a failed transaction, is retrying a failed transaction. It's either a goer or not. Isn't it? |
|
I'm not suggesting retrying parts of a transaction, though it may have read like that. |
![]() |
| Thread Tools | |
| Display Modes | |
| |