-
1. Re: Continuous queries and Connection pools
shawkins Feb 27, 2013 10:50 PM (in response to markaddleman)> While the translator is waiting, there's no reason to keep the JDBC connection out of the pool but I can't find good lifecycle method to throw DataNotAvailable.
The usage paradigm with DataNotAvailable before was for asynch executions. Typically an asynch execution would not hold a connection or any large amount of state.
> I'm beginning to believe there either needs to be a new form of DNA that instructs Teiid to close the execution and restart the lifecycle entirely on dataAvailable()
You can currently perform a restart on your end if all of your translators report back that their at the end of rows, then the next execution will start after any lingering processing is finished.
> or a new lifecycle method that occurs between Execution.close() and reset() that provides an opportunity to throw DNA after the connection is closed.
There's nothing from the engine's perspective that is happening between close and reset that it would need to ask the translator/execution about. What would a DNA after close but before reset mean?
> Right now, my temporary solution is to override ExecutionFactory's getConnection() and return a lazy initializing connection but that's pretty dirty.
That's probably along the lines of the right approach (at least with how Teiid works currently). It seems like the only bit that's really dirty is hardcoding how the ExecutionFactory gets the DataSource, or do you see any other downfalls?
Steve
-
2. Re: Continuous queries and Connection pools
markaddleman Feb 27, 2013 11:59 PM (in response to shawkins)> I'm beginning to believe there either needs to be a new form of DNA that instructs Teiid to close the execution and restart the lifecycle entirely on dataAvailable()
You can currently perform a restart on your end if all of your translators report back that their at the end of rows, then the next execution will start after any lingering processing is finished.
> or a new lifecycle method that occurs between Execution.close() and reset() that provides an opportunity to throw DNA after the connection is closed.
There's nothing from the engine's perspective that is happening between close and reset that it would need to ask the translator/execution about. What would a DNA after close but before reset mean?
I'd like to pause the execution after ExecutionFactory.closeConnect() is called and before the next ExecutionFactory.getConnection(). Perhaps the proper solution is twofold: (1) Don't use a reusable execution and (2) Teiid introduces a new lifecycle method to the execution factory. It would be something like void beforeNextExecution(Command, ExecutionContext, RuntimeMetadata). It would be called before getConnection() on subsequent executions in a continuous query. Execution factories would be allowed to throw DNA from here. Calling dataAvailable() would, ideally, begin the lifecycle at getConnection() followed by createExecution() rather than calling into beforeNextExecution again.
> Right now, my temporary solution is to override ExecutionFactory's getConnection() and return a lazy initializing connection but that's pretty dirty.
That's probably along the lines of the right approach (at least with how Teiid works currently). It seems like the only bit that's really dirty is hardcoding how the ExecutionFactory gets the DataSource, or do you see any other downfalls?
No, that's the only downside I see. It's really not that bad.
-
3. Re: Continuous queries and Connection pools
shawkins Feb 28, 2013 8:02 AM (in response to markaddleman)> (1) Don't use a reusable execution and
Reusable seems fine as you still are getting a close at the end of each execution cycle.
> (2) Teiid introduces a new lifecycle method to the execution factory. It would be something like void beforeNextExecution(Command, ExecutionContext, RuntimeMetadata).
How does the executionfactory (rather than an execution) without a connection make the determination that data won't be available? With the current logic the preference would be to throw DataNotAvailable from the subsequent execute rather than putting in another lifecycle method.
The core issue for you still seems to be defeating the standard connection lifecycle, which would not be a common case. This could be tied to the reusable extension lifecyle - for example close the connection if reset throws a DataNotAvailable and call reset even on the first execution. At worst you would just be obtaining a connection and quickly closing it. Or we can simply provide you with a reference to the connection factory to facilitate the customization of taking over the connection management.
Steve