Java Code Examples for org.apache.kylin.metadata.project.ProjectManager#clearCache()

The following examples show how to use org.apache.kylin.metadata.project.ProjectManager#clearCache() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CacheService.java    From Kylin with Apache License 2.0 5 votes vote down vote up
public void removeCache(Broadcaster.TYPE cacheType, String cacheKey) {
    final String log = "remove cache type: " + cacheType + " name:" + cacheKey;
    try {
        switch (cacheType) {
            case CUBE:
                getCubeManager().removeCubeCacheLocal(cacheKey);
                break;
            case CUBE_DESC:
                getCubeDescManager().removeLocalCubeDesc(cacheKey);
                break;
            case PROJECT:
                ProjectManager.clearCache();
                break;
            case INVERTED_INDEX:
                getIIManager().removeIILocalCache(cacheKey);
                break;
            case INVERTED_INDEX_DESC:
                getIIDescManager().removeIIDescLocal(cacheKey);
                break;
            case TABLE:
                throw new UnsupportedOperationException(log);
            case DATA_MODEL:
                throw new UnsupportedOperationException(log);
            default:
                throw new RuntimeException("invalid cacheType:" + cacheType);
        }
    } catch (IOException e) {
        throw new RuntimeException("error " + log, e);
    }
}
 
Example 2
Source File: BasicService.java    From Kylin with Apache License 2.0 5 votes vote down vote up
/**
 * Reload changed cube into cache
 * 
 * @throws IOException
 */
@Caching(evict = { @CacheEvict(value = QueryController.SUCCESS_QUERY_CACHE, allEntries = true), @CacheEvict(value = QueryController.EXCEPTION_QUERY_CACHE, allEntries = true) })
public void cleanDataCache() {
    CubeManager.clearCache();
    ProjectManager.clearCache();
    BasicService.resetOLAPDataSources();
}
 
Example 3
Source File: ServiceTestBase.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    this.createTestMetadata();

    MetadataManager.clearCache();
    DictionaryManager.clearCache();
    CubeDescManager.clearCache();
    CubeManager.clearCache();
    IIDescManager.clearCache();
    IIManager.clearCache();
    ProjectManager.clearCache();
}
 
Example 4
Source File: CubeManagerCacheTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    this.createTestMetadata();
    MetadataManager.clearCache();
    CubeManager.clearCache();
    ProjectManager.clearCache();
    cubeManager = CubeManager.getInstance(getTestConfig());
}
 
Example 5
Source File: MergeCuboidMapperTest.java    From Kylin with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() throws Exception {

    createTestMetadata();

    logger.info("The metadataUrl is : " + getTestConfig());

    MetadataManager.clearCache();
    CubeManager.clearCache();
    ProjectManager.clearCache();
    DictionaryManager.clearCache();

    // hack for distributed cache
    // CubeManager.removeInstance(KylinConfig.createInstanceFromUri("../job/meta"));//to
    // make sure the following mapper could get latest CubeManger
    FileUtils.deleteDirectory(new File("../job/meta"));

    MergeCuboidMapper mapper = new MergeCuboidMapper();
    mapDriver = MapDriver.newMapDriver(mapper);

    cubeManager = CubeManager.getInstance(getTestConfig());
    cube = cubeManager.getCube("test_kylin_cube_without_slr_left_join_ready_2_segments");
    dictionaryManager = DictionaryManager.getInstance(getTestConfig());
    lfn = cube.getDescriptor().findColumnRef("DEFAULT.TEST_KYLIN_FACT", "LSTG_FORMAT_NAME");
    lsi = cube.getDescriptor().findColumnRef("DEFAULT.TEST_KYLIN_FACT", "CAL_DT");
    ssc = cube.getDescriptor().findColumnRef("DEFAULT.TEST_CATEGORY_GROUPINGS", "META_CATEG_NAME");

    DictionaryInfo sharedDict = makeSharedDict();

    boolean isFirstSegment = true;
    for (CubeSegment segment : cube.getSegments()) {

        TableSignature signature = new TableSignature();
        signature.setSize(100);
        signature.setLastModifiedTime(System.currentTimeMillis());
        signature.setPath("fake_dict_for" + lfn.getName() + segment.getName());

        DictionaryInfo newDictInfo = new DictionaryInfo(lfn.getTable(), lfn.getColumn().getName(), lfn.getColumn().getZeroBasedIndex(), "string", signature, "");

        List<byte[]> values = new ArrayList<byte[]>();
        values.add(new byte[] { 97, 97, 97 });
        if (isFirstSegment)
            values.add(new byte[] { 99, 99, 99 });
        else
            values.add(new byte[] { 98, 98, 98 });
        Dictionary<?> dict = DictionaryGenerator.buildDictionaryFromValueList(newDictInfo, values);
        dictionaryManager.trySaveNewDict(dict, newDictInfo);
        ((TrieDictionary) dict).dump(System.out);

        segment.putDictResPath(lfn, newDictInfo.getResourcePath());
        segment.putDictResPath(lsi, sharedDict.getResourcePath());
        segment.putDictResPath(ssc, sharedDict.getResourcePath());

        // cubeManager.saveResource(segment.getCubeInstance());
        // cubeManager.afterCubeUpdated(segment.getCubeInstance());
        cubeManager.updateCube(cube);

        isFirstSegment = false;
    }

}
 
Example 6
Source File: ProjectService.java    From Kylin with Apache License 2.0 4 votes vote down vote up
public void removeProjectCache(String name) {
    ProjectManager.clearCache();
}
 
Example 7
Source File: CacheService.java    From Kylin with Apache License 2.0 4 votes vote down vote up
public void rebuildCache(Broadcaster.TYPE cacheType, String cacheKey) {
    final String log = "rebuild cache type: " + cacheType + " name:" + cacheKey;
    try {
        switch (cacheType) {
            case CUBE:
                getCubeManager().loadCubeCache(cacheKey);
                cleanProjectCacheByRealization(RealizationType.CUBE, cacheKey);
                break;
            case CUBE_DESC:
                getCubeDescManager().reloadCubeDesc(cacheKey);
                break;
            case PROJECT:
                getProjectManager().reloadProject(cacheKey);
                break;
            case INVERTED_INDEX:
                getIIManager().loadIICache(cacheKey);
                cleanProjectCacheByRealization(RealizationType.INVERTED_INDEX, cacheKey);
                break;
            case INVERTED_INDEX_DESC:
                getIIDescManager().reloadIIDesc(cacheKey);
                break;
            case TABLE:
                getMetadataManager().reloadTableCache(cacheKey);
                IIDescManager.clearCache();
                CubeDescManager.clearCache();
                break;
            case DATA_MODEL:
                getMetadataManager().reloadDataModelDesc(cacheKey);
                IIDescManager.clearCache();
                CubeDescManager.clearCache();
                break;
            case ALL:
                getMetadataManager().reload();
                CubeDescManager.clearCache();
                CubeManager.clearCache();
                IIDescManager.clearCache();
                IIManager.clearCache();
                ProjectManager.clearCache();
                BasicService.resetOLAPDataSources();
                break;
            default:
                throw new RuntimeException("invalid cacheType:" + cacheType);
        }
    } catch (IOException e) {
        throw new RuntimeException("error " + log, e);
    }

}