You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "Vsevolod Ostapenko (JIRA)" <ji...@apache.org> on 2019/06/28 15:28:00 UTC

[jira] [Reopened] (KYLIN-3628) Query with lookup table always use latest snapshot

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

Vsevolod Ostapenko reopened KYLIN-3628:
---------------------------------------

This code change introduces a nasty bug, where Kylin will pick a random cube to answer the query that goes against a lookup table.
For exapmple, model X has two cubes C1 and C2. C1 is using lookup table L1 and C2 does not. C2 has more recent segments built than C1.
Query select * from L1 will fail with error that C2 does not contain L1.

Code analysis indicates, that LookupTableEnumerator overwrites prior cube choice correctly made by RealizationChooser. The bug is that LookupTableEnumerator finds the latest snapshot on all the realizations of all the cubes in the model, not the one that was already correctly chosen.
That leads to a random behavior and unexpected failures.

Affected code is in LookupTableEnumerator.java.
{code:java}
if (olapContext.realization instanceof CubeInstance) {
cube = (CubeInstance) olapContext.realization;
ProjectInstance project = cube.getProjectInstance();
List<RealizationEntry> realizationEntries = project.getRealizationEntries();
String lookupTableName = olapContext.firstTableScan.getTableName();
CubeManager cubeMgr = CubeManager.getInstance(cube.getConfig());
cube = cubeMgr.findLatestSnapshot(realizationEntries, lookupTableName);
olapContext.realization = cube;
}
{code}

> Query with lookup table always use latest snapshot
> --------------------------------------------------
>
>                 Key: KYLIN-3628
>                 URL: https://issues.apache.org/jira/browse/KYLIN-3628
>             Project: Kylin
>          Issue Type: Improvement
>            Reporter: Na Zhai
>            Assignee: Na Zhai
>            Priority: Major
>             Fix For: v2.6.0
>
>
> If user queries a lookup table, Kylin will randomly selects a Cube (which has the snapshot of this lookup table) to answer it. This causes uncertainty when there are multiple cubes (share the same lookup): some cubes are newly built, some not. If Kylin picks an old cube, the query result is old.
> To remove this uncertainty, for such queries, either always use latest snapshot, or use earlist snapshot. We believe the "latest" version is better.



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