private void keepCubeRetention(String cubeName) { logger.info("checking keepCubeRetention"); CubeInstance cube = getCubeManager().getCube(cubeName); CubeDesc desc = cube.getDescriptor(); if (desc.getRetentionRange() <= 0) return; synchronized (CubeService.class) { cube = getCubeManager().getCube(cubeName); List<CubeSegment> readySegs = cube.getSegments(SegmentStatusEnum.READY); if (readySegs.isEmpty()) return; List<CubeSegment> toRemoveSegs = Lists.newArrayList(); long tail = readySegs.get(readySegs.size() - 1).getTSRange().end.v; long head = tail - desc.getRetentionRange(); for (CubeSegment seg : readySegs) { if (seg.getTSRange().end.v > 0) { // for streaming cube its initial value is 0 if (seg.getTSRange().end.v <= head) { toRemoveSegs.add(seg); } } } if (toRemoveSegs.size() > 0) { try { getCubeManager().updateCubeDropSegments(cube, toRemoveSegs); } catch (IOException e) { logger.error("Failed to remove old segment from cube " + cubeName, e); } } } }
newCubeDesc.setPartitionDateEnd(cubeDesc.getPartitionDateEnd()); newCubeDesc.setVolatileRange(cubeDesc.getVolatileRange()); newCubeDesc.setRetentionRange(cubeDesc.getRetentionRange()); newCubeDesc.setEngineType(cubeDesc.getEngineType()); newCubeDesc.setStorageType(cubeDesc.getStorageType());
public static CubeDesc getCopyOf(CubeDesc cubeDesc) { CubeDesc newCubeDesc = new CubeDesc(); newCubeDesc.setName(cubeDesc.getName()); newCubeDesc.setModelName(cubeDesc.getModelName()); newCubeDesc.setDescription(cubeDesc.getDescription()); newCubeDesc.setNullStrings(cubeDesc.getNullStrings()); newCubeDesc.setDimensions(cubeDesc.getDimensions()); newCubeDesc.setMeasures(cubeDesc.getMeasures()); newCubeDesc.setRowkey(cubeDesc.getRowkey()); newCubeDesc.setHbaseMapping(cubeDesc.getHbaseMapping()); newCubeDesc.setSignature(cubeDesc.getSignature()); newCubeDesc.setNotifyList(cubeDesc.getNotifyList()); newCubeDesc.setAutoMergeTimeRanges(cubeDesc.getAutoMergeTimeRanges()); newCubeDesc.setRetentionRange(cubeDesc.getRetentionRange()); newCubeDesc.setConfig(cubeDesc.getConfig()); newCubeDesc.updateRandomUuid(); return newCubeDesc; }
newCubeDesc.setPartitionDateEnd(cubeDesc.getPartitionDateEnd()); newCubeDesc.setVolatileRange(cubeDesc.getVolatileRange()); newCubeDesc.setRetentionRange(cubeDesc.getRetentionRange()); newCubeDesc.setEngineType(cubeDesc.getEngineType()); newCubeDesc.setStorageType(cubeDesc.getStorageType());