|
Attaching a patch for this problem. The patch does the following:
1) Fixes the logic in OptimizerImpl.java that was causing the hang (an indirect infinite loop). 2) Adds some comments describing the "JUMPING" logic that is in OptimizerImpl so that developers looking at the code can (hopefully) figure out what's going on more quickly in the future. 3) Adds a test case to the lang/subqueryFlattening.sql test for verification of the fix. The test case is based on the repro attached to this issue. NOTE: I had to set the "derby.optimizer.noTimeout" property to true for this entire test--I think this is okay since everything still passes (on my machine), but if anyone feels otherwise, please let me know... I ran derbyall on Windows 2000 w/ Sun jdk 1.4.2 and saw no failures. If someone could review this, I'd be grateful.. Submitted this patch to trunk. Army, would you like to see this fix in 10.1 branch also?
Thanks for fixing this interesting problem... And also for adding comments to existing mechanism. Great patch. Sending java\engine\org\apache\derby\impl\sql\compile\OptimizerImpl.java Sending java\testing\org\apache\derbyTesting\functionTests\master\subqueryFlattening.out Sending java\testing\org\apache\derbyTesting\functionTests\tests\lang\subqueryFlattening.sql Sending java\testing\org\apache\derbyTesting\functionTests\tests\lang\subqueryFlattening_derby.properties Transmitting file data .... Committed revision 293480. Merged to 10.1 branch. Should be part of 10.1.2 release.
I ran the repro attached to this issue as well as the new test case in lang/subqueryFlattening.sql against the trunk (10.2) and the 10.1 branch to verify that the changes have been committed and that things are working as they should. It all looks good, so I'm resolving and closing this issue. Thanks for committing, Satheesh.
Assigning to SQL component.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> java -Dderby.optimizer.noTimeout=true org.apache.derby.tools.ij
ij version 10.2
ij> connect 'jdbc:derby:testdb;create=true';
ij> run 'repro.sql';
Note that the hang won't reproduce if "noTimeout" is false (which is the default) because eventually the optimizer will decide that it's taking too long and will quit. That's nice because it means most people won't ever see this problem :) However, when noTimeout is set to true the query _should_ still finish (even if it takes longer), so I _do_ think this is a bug.