You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Paul Jackson (JIRA)" <ji...@apache.org> on 2018/01/22 18:09:00 UTC

[jira] [Created] (CALCITE-2146) Errant CyclicMetadataException in multithreaded context

Paul Jackson created CALCITE-2146:
-------------------------------------

             Summary: Errant CyclicMetadataException in multithreaded context
                 Key: CALCITE-2146
                 URL: https://issues.apache.org/jira/browse/CALCITE-2146
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.15.0
            Reporter: Paul Jackson
            Assignee: Julian Hyde


The code that protects against cyclic metadata is not thread-safe. A typical stack trace looks like:

{{Caused by: org.apache.calcite.rel.metadata.CyclicMetadataException}}
{{ at org.apache.calcite.rel.metadata.CyclicMetadataException.<clinit>(CyclicMetadataException.java:28)}}
{{  at GeneratedMetadataHandler_Collation.collations(Unknown Source)}}
{{  at GeneratedMetadataHandler_Collation.collations_$(Unknown Source)}}
{{  at GeneratedMetadataHandler_Collation.collations(Unknown Source)}}
{{  at org.apache.calcite.rel.metadata.RelMetadataQuery.collations(RelMetadataQuery.java:563)}}
{{  at org.apache.calcite.rel.metadata.RelMdCollation.collations(RelMdCollation.java:117)}}
{{  at GeneratedMetadataHandler_Collation.collations_$(Unknown Source)}}
{{  at GeneratedMetadataHandler_Collation.collations(Unknown Source)}}
{{  at GeneratedMetadataHandler_Collation.collations_$(Unknown Source)}}
{{  at GeneratedMetadataHandler_Collation.collations(Unknown Source)}}
{{  at org.apache.calcite.rel.metadata.RelMetadataQuery.collations(RelMetadataQuery.java:563)}}
{{  at org.apache.calcite.rel.metadata.RelMdCollation.project(RelMdCollation.java:207)}}
{{  at org.apache.calcite.rel.logical.LogicalProject$1.get(LogicalProject.java:117)}}
{{  at org.apache.calcite.rel.logical.LogicalProject$1.get(LogicalProject.java:115)}}
{{ at org.apache.calcite.plan.RelTraitSet.replaceIfs(RelTraitSet.java:238)}}
{{  at org.apache.calcite.rel.logical.LogicalProject.create(LogicalProject.java:113)}}
{{  at org.apache.calcite.rel.logical.LogicalProject.create(LogicalProject.java:103)}}
{{  at org.apache.calcite.rel.core.RelFactories$ProjectFactoryImpl.createProject(RelFactories.java:127)}}
{{  at org.apache.calcite.tools.RelBuilder.project(RelBuilder.java:1064)}}

Generally, the use case that causes this is one where we have a set of SQL templates represented as RelNodes, which we use as a starting point for queries. If different threads operate on the same RelNode, they may work on the same cluster, and therefore the same RelMetadataQuery instance, which contains a map instance that is used to detect Cyclic Metadata.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)