Skip to main content

Ingres resource limiting : Part3 (inquire_ingres)

The other option left was to capture the error from inside the 4GL code by checking the inquire_ingres error number after each sql statement (which does already,but I had to tweak it to also check for the specific error) and act upon it.

Since all code is grouped in frskeys (meaning that the user must press a key for the code to be activated) the whole error handling had to be shifted inside the frskey code.

Inside the frskey code there can be multiple sql statements and each one can trigger the exception.It might not be the first or second statement but it could be the 5th statement in the chain of execution. Furthermore the 'set maxio' directive is the first statement to be executed when the key is pressed,and must reset back to 'set nomaxio' on exiting or one of the conditions described later are met.

So every sql statement must be checked and the following was added after each one:
inquire_ingres (h_rowcount=rowcount,h_errorno=errorno,h_querytext=querytext,h_errortext=errortext);

When the query requires more resources than permitted then the error is captured and 'propagated' to another 4GL frame which contains the code that does the handling.
That frame prompts the user that the query is too heavy and if execution should continue, despite. If the user answers 'no' then a rollback is issued and the limiter is deactivated with 'set nomaxio' since the directive is session wide and if not deactivated it would hinder the user's work flow.

The problem was that if the user answers 'yes' ,thus ignoring the message and opting to continue with the execution, the code inside the frskey had to be repeated like the user pressing the key another time since the limiter has refused to run the query that triggered the exception and the whole frskey code has to be re-executed ,this time with the limit control deactivated.
Because letting the user re-press the key was not an option since allowing the user the margin for error means that the error will be made eventually,the whole frskey code was wrapped into two labeled while loops.The first loop had the control over if and when the process would be repeated and the inner loop was in charge of the executing the preexisting frskey code.Inside the inner loop each sql statement was been inquired with inquire_ingres and if an error was to occur then the error handling frame was to be called where it would check for if the error equals the generic number 36100 signifying that the resource limit has been exceed.
The handling procedure would then log the actual sql query that gave the error away and the error text (E_QE0203 The estimated nummber of IO requests to run this query (141)\n exceeds the IO limit (80) established for this session. The query is aborted with a fatal error. ) plus the current time and user terminal.
Then it would prompt the user as to continue or not.If not, 'set nomaxio' is reset and no further action is performed hence the user is free to continue with his work.
If the answer is 'yes' then the inner loop is exited and the outer loop re-executes the frskey code from the beginning but this time with 'set nomaxio' set so everything executes fine like it would normally do.

The ESQL error handler called by iiseterr() was used as well as to suppress the default runtime error messages appearing on the user's screen,so he is not introduced to the fact that an error occurred. All he sees is just a prompt for action.

Comments

Popular posts from this blog

Serverless JavaScript

We recently joined in an interesting two-hour long conversation about Serverless JavaScript led by Steve Faulkner of Bustle who answered questions on Bustle, the Shep framework, the mindset behind the AWS Lambda infrastructure, and related topics.

The discussion took place on the Sideway conversation-sharing platform on January 6th. Here we present the best takeaways from the session which really should be taken notice of by anyone working on AWS.

Steve Faulkner:
At Bustle we serve over 50 million unique readers per month through a "serverless" architecture based on AWS Lambda and Node.js.  Of course there are still servers but we don't manage them. This shift has allowed us to develop products faster and decreased the cost of our infrastructure. I'll answer any questions about how we made this transition and how it has worked out. I'll also discuss some of the tools and best practises including our open source framework shep

Eran Hammer:
When would you…

Insider's Guide To Udacity Android Developer Nanodegree Part 3 - Making the Baking App

Continuing to chart my experience of Udacity's Android Developer Nanodegree we step up in level, embarking on the advanced part of the super-course.
Completing project "Popular Movies" (see Part 2 of this series) signaled the end of "Android Developer". Now we are ready to tackle the second element of the program "Advanced Android Developer", a new class with a new syllabus and project. Continuing to chart my experience of Udacity's Android Developer Nanodegree we step up in level, embarking on the advanced part of the super-course.

Completing project "Popular Movies" (see Part 2 of this series) signaled the end of "Android Developer". Now we are ready to tackle the second element of the program "Advanced Android Developer", a new class with a new syllabus and project.

"Advanced Android Developer" is a mixed bag of self contained material and of coding seven different sample apps to learn about the…

AWS and Ionic Team Up In Starter Project

Amazon is quick in recognizing that just offering support for a number of popular programing languages is not enough to lure hoards of developers to the platform. That's why we are seeing a move towards wrapping its AWS services with greater user-friendliness.

The start was made with the introduction of CodeStar, which aimed to simplify the setting up of a project's AWS infrastructure, especially  with regard to policy and authorization, as we examined in CodeStar to Simplify Development On AWS. 

It continues this trend with the release of the open source Ionic AWS starter project Mobile Web and Hybrid Application which aims to act as a skeleton, or boilerplate, Ionic application tweaked in such a way to give developers a headstart in configuring their mobile Ionic front-end applications in relation to an AWS backend.

full article on i-programmer