[ 
https://issues.apache.org/jira/browse/DERBY-6211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-6211:
---------------------------------

    Attachment: derby-6211-03-aa-customTracer.diff

Attaching derby-6211-03-aa-customTracer.diff. This patch adds the ability to 
plug custom trace logic into the Optimizer. I am running tests now.

To plug custom trace logic into the Optimizer, do the following:

call syscs_util.syscs_register_tool
(
    'optimizerTracing', true, 'custom',
    'my.custom.Classname'
);

...where my.custom.Classname is the name of a class which

1) implements org.apache.derby.iapi.sql.compile.OptTrace

2) has a 0-arg constructor

Then run a couple queries. When you are finished tracing, unload your custom 
trace logic. If your class implements OptTrace.printToWriter(), then your 
custom trace output will go to System.out or to a file, depending on the 
arguments to the unload command. This prints the output to System.out:

call syscs_util.syscs_register_tool( 'optimizerTracing', false );

...and this prints the trace output to z1.txt:

call syscs_util.syscs_register_tool( 'optimizerTracing', false, 'z1.txt' );



Touches the following files:

--------------

M       java/tools/org/apache/derby/impl/tools/optional/OptimizerTracer.java
M       java/tools/org/apache/derby/loc/toolsmessages.properties

Support for custom optimizer tracing.

--------------

A       
java/testing/org/apache/derbyTesting/functionTests/tests/lang/DummyOptTrace.java
M       
java/testing/org/apache/derbyTesting/functionTests/tests/lang/OptionalToolsTest.java

Tests for this new functionality.

                
> Make Optimizer trace logic pluggable.
> -------------------------------------
>
>                 Key: DERBY-6211
>                 URL: https://issues.apache.org/jira/browse/DERBY-6211
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 10.11.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: derby-6211-01-aa-createPlugin.diff, 
> derby-6211-02-aa-cleanup.diff, derby-6211-02-ab-cleanup.diff, 
> derby-6211-03-aa-customTracer.diff
>
>
> Right now the trace logic in the optimizer is hard-coded to produce a stream 
> of diagnostics. It would be good to be able to plug alternative trace logic 
> into the optimizer. This would make the following possible:
> 1) Plug in trace logic which produces formats which are easier to study and 
> which can be analyzed mechanically. E.g., xml formatted output.
> 2) Plug in trace logic which can be used during unit testing to verify that 
> the optimizer has picked the right plan. Over time this might make it easier 
> to migrate canon-based tests to assertion-based tests.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to