[
https://issues.apache.org/jira/browse/CALCITE-3981?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Botong Huang updated CALCITE-3981:
----------------------------------
Description:
When a subset is registered, registerImpl() and registerSubset() currently
simply returns the subset itself. The problem is that subset can become stale
when relSets get merged (for example in registerSubset() "merge(set,
subset.set)"). As a result, a stale/merged subset might be returned from
registerImpl, and the newly registering subtree might get registered
recursively on top of the stale subset. This is a leak because once a
relSet/subset is merged into others and becomes stale, it should not be used to
connect new relNodes.
With CALCITE-3755, subsets can now be directly matched by rules. This opens
another source of stale subset leak: (1) An active subset gets matched, the
RuleMatch gets queued in RuleQueue. (2) The subset becomes stale due to relSet
merge. (3) The rule match in (1) is popped from queue and fired. (4) In OnMatch
the rule gets the stale subset, builds new rels on top of it and regsiter the
new rels. In this case, the entire new rel subtree will be registered on top of
the stale subset as is.
Rather than returning the subset as it, register should always use canonize()
to find the equivalent active subset and return it instead.
was:
When a subset is registered, registerImpl() and registerSubset() currently
simply returns the subset itself. The problem is that subset can become stale
when relSets get merged (for example in registerSubset() "merge(set,
subset.set)"). As a result, a stale/merged subset might be returned from
registerImpl, and the newly registering subtree might get registered
recursively on top of the stale subset.
With CALCITE-3755, subsets can now be directly matched by rules. This opens
another source of stale subset leak: (1) An active subset gets matched, the
RuleMatch gets queued in RuleQueue. (2) The subset becomes stale due to relSet
merge. (3) The rule match in (1) is popped from queue and fired. (4) In OnMatch
the rule gets the stale subset, builds new rels on top of it and regsiter the
new rels. In this case, the entire new rel subtree will be registered on top of
the stale subset as is.
Rather than returning the subset as it, register should always use canonize()
to find the equivalent active subset and return it instead.
> Volcano.register should not return stale/merged subset
> ------------------------------------------------------
>
> Key: CALCITE-3981
> URL: https://issues.apache.org/jira/browse/CALCITE-3981
> Project: Calcite
> Issue Type: Bug
> Reporter: Botong Huang
> Priority: Major
>
> When a subset is registered, registerImpl() and registerSubset() currently
> simply returns the subset itself. The problem is that subset can become stale
> when relSets get merged (for example in registerSubset() "merge(set,
> subset.set)"). As a result, a stale/merged subset might be returned from
> registerImpl, and the newly registering subtree might get registered
> recursively on top of the stale subset. This is a leak because once a
> relSet/subset is merged into others and becomes stale, it should not be used
> to connect new relNodes.
> With CALCITE-3755, subsets can now be directly matched by rules. This opens
> another source of stale subset leak: (1) An active subset gets matched, the
> RuleMatch gets queued in RuleQueue. (2) The subset becomes stale due to
> relSet merge. (3) The rule match in (1) is popped from queue and fired. (4)
> In OnMatch the rule gets the stale subset, builds new rels on top of it and
> regsiter the new rels. In this case, the entire new rel subtree will be
> registered on top of the stale subset as is.
> Rather than returning the subset as it, register should always use canonize()
> to find the equivalent active subset and return it instead.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)