db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-6211) Make Optimizer trace logic pluggable.
Date Wed, 01 May 2013 19:08:16 GMT

     [ 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-01-aa-createPlugin.diff

Attaching derby-6211-01-aa-createPlugin.diff. This patch abstracts out the optimizer trace
logic so that other tracers can be plugged in. I am running tests now.

This patch makes the following changes:

1) Adds a new interface OptTrace, which describes the trace operations performed by the Optimizer.

2) Removes the generic trace dispatcher from Level2OptimizerImpl. The giant switch statement
is removed and the individual cases are moved into separate methods in DefaultOptTrace, the
default implementation of OptTrace. DefaultOptTrace produces the familiar, current optimizer
trace output. The generic, opaque, weakly typed trace() method is removed and replaced by
the strongly typed methods in OptTrace.

3) Removes the trace flag constants from Optimizer.

4) Makes trace callers use the new strongly typed methods in OptTrace.

I have run some hand tests. With and without this patch, the output of optimizer tracing looks
the same.

Follow-on patches can introduce alternative trace plugins.

Touches the following files:


A       java/engine/org/apache/derby/iapi/sql/compile/OptTrace.java

Changes for (1).


A       java/engine/org/apache/derby/impl/sql/compile/DefaultOptTrace.java
M       java/engine/org/apache/derby/impl/sql/compile/Level2OptimizerImpl.java

Changes for (2).


M       java/engine/org/apache/derby/iapi/sql/compile/Optimizer.java

Changes for (3).


M       java/engine/org/apache/derby/impl/sql/compile/FromTable.java
M       java/engine/org/apache/derby/impl/sql/compile/NestedLoopJoinStrategy.java
M       java/engine/org/apache/derby/impl/sql/compile/JoinNode.java
M       java/engine/org/apache/derby/impl/sql/compile/HashJoinStrategy.java
M       java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
M       java/engine/org/apache/derby/impl/sql/compile/OptimizerImpl.java

Changes for (4).

> 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:
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: derby-6211-01-aa-createPlugin.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

View raw message