Issue Details (XML | Word | Printable)

Key: DERBY-4048
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Mamta A. Satoor
Reporter: Mamta A. Satoor
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Update Statistics code in AlterTableConstantAction should use execute transaction rather than compile transaction

Created: 04/Feb/09 03:19 PM   Updated: 04/May/09 06:22 PM
Component/s: SQL
Affects Version/s: 10.5.1.1
Fix Version/s: 10.5.1.1

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works DERBY4048_useExecuteTran_diff.txt 2009-02-04 11:56 PM Mamta A. Satoor 0.7 kB

Resolution Date: 05/Feb/09 02:59 PM
Labels:


 Description  « Hide
DERBY-269 provided a new stored procedure SYSCS_UTIL.SYSCS_UPDATE_STATISTICS to update the statistics. The code to do the work was added in AlterTableConstantAction and the name of new method in that class is updateStatistics(Activation activation). This code was copied from an existing unused class execute/UpdateStatisticsConstantAction.java(that unused class has been removed from Derby code).

The copied code in AlterTableConstantAction:updateStatistics gets compile transaction as shown below to do the work of updating the statistics.
TransactionController tc = lcc.getTransactionCompile();
The javadoc for LangaugeConnectionContext for getTransactionCompile says following
/**
Get the transaction controller to use with this language connection
context at compile time.
*/
TransactionController getTransactionCompile();

I think we should be using TransactionController tc = lcc.getTransactionExecute() to do the work since we are not in the compile phase. The rest of the code in AlterTableConstantAction uses lcc.getTransactionExecute to get the transaction controller.

I will make the changes in AlterTableConstantAction.updateStatistics to use getTransactionExecute and will run the existing tests to make sure nothing breaks.

I ran into this issue of getTransactionExecute vs getTransactionCompile while working on DERBY-3788 (provide a zero-admin way of updating the statistics). While trying to run the statistics inline duirn the compile phase of a SELECT query, I ran into exception that statistics can't be updated because we are in read-only mode. But if I change the AlterTableConstantAction to use getTransactionExecute, then I do not run into the read-only mode exception.

Please let me know if anyone has any comments on this. I will run the existing tests and if no failures, then I will go ahead and commit the change of using getTransactionExecute rather than getTransactionCompile in AlterTableConstantAction:updateStatistics

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Mamta A. Satoor added a comment - 04/Feb/09 11:56 PM
I have the very simple change attached as a patch here. When I try to run the junit tests (through the ui and through just the text interface), I keep running into outofmemory errors towards the end of junit All suite (specifically databasemetadata, upgrade, encryption, after these, the ui just freezes and I can't see what else might be going on). I was wondering if anyone has spare cycles to try this patch on their machine. In the mean time, I will fire the derbyall tests. Thanks

Mamta A. Satoor added a comment - 05/Feb/09 01:42 AM
derbyall ran fine with jdk15 on my machine. Hoping someone can try my patch and run *junit tests* to see if everything runs fine on their machine.

Ole Solberg added a comment - 05/Feb/09 12:41 PM
I have run .suites.All with the patch and saw no issues.
(java -Xmx256M -XX:MaxPermSize=128M ... junit.textui.TestRunner ....suites.All)

Mamta A. Satoor added a comment - 05/Feb/09 02:47 PM
Thanks for trying the patch, Ole. I will go ahead and commit it.

Mamta A. Satoor added a comment - 05/Feb/09 02:49 PM
BTW, I was running junit suite as follows
java -Xmx1024m -cp '../../tools/java/junit.jar;../../classes' junit.swingui.TestRunner -noloading org.apache.derbyTesting.functionTests.suites.All

Mamta A. Satoor added a comment - 05/Feb/09 02:59 PM
Committed the changes with revision 741118. Will reopen the issue if any issues are discovered. The junit tests ran fine on Ole's machine and derbyall ran fine on my machine,