Examples of Granularity


Examples of com.rackspacecloud.blueflood.rollup.Granularity

        this.serverTime = scheduleCtx.getCurrentTimeMillis();
    }
   
    public void run() {
        final Timer.Context timerCtx = rollupLocatorExecuteTimer.time();
        final Granularity gran = Granularity.granularityFromKey(parentSlotKey);
        final int parentSlot = Granularity.slotFromKey(parentSlotKey);
        final int shard = Granularity.shardFromKey(parentSlotKey);
        final Range parentRange = gran.deriveRange(parentSlot, serverTime);

        try {
            gran.finer();
        } catch (Exception ex) {
            log.error("No finer granularity available than " + gran);
            return;
        }
View Full Code Here

Examples of com.rackspacecloud.blueflood.rollup.Granularity

            if (scheduledSlots.size() == 0)
                return null;
            synchronized (runningSlots) {
                String key = orderedScheduledSlots.remove(0);
                int slot = Granularity.slotFromKey(key);
                Granularity gran = Granularity.granularityFromKey(key);
                int shard = Granularity.shardFromKey(key);
                // notice how we change the state, but the timestamp remained the same. this is important.  When the
                // state is evaluated (i.e., in Reader.getShardState()) we need to realize that when timstamps are the
                // same (this will happen), that a remove always wins during the coalesce.
                scheduledSlots.remove(key);
View Full Code Here

Examples of com.rackspacecloud.blueflood.rollup.Granularity

   
    void pushBackToScheduled(String key, boolean rescheduleImmediately) {
        synchronized (scheduledSlots) {
            synchronized (runningSlots) {
                int slot = Granularity.slotFromKey(key);
                Granularity gran = Granularity.granularityFromKey(key);
                int shard = Granularity.shardFromKey(key);
                // no need to set dirty/clean here.
                shardStateManager.getSlotStateManager(shard, gran).getAndSetState(slot, UpdateStamp.State.Active);
                scheduledSlots.add(key);
                if (rescheduleImmediately) {
View Full Code Here

Examples of com.rackspacecloud.blueflood.rollup.Granularity

    void clearFromRunning(String slotKey) {
        int shard = Granularity.shardFromKey(slotKey);
        synchronized (runningSlots) {
            runningSlots.remove(slotKey);
            int slot = Granularity.slotFromKey(slotKey);
            Granularity gran = Granularity.granularityFromKey(slotKey);

            UpdateStamp stamp = shardStateManager.getUpdateStamp(shard, gran, slot);
            shardStateManager.setAllCoarserSlotsDirtyForSlot(shard, gran, slot);
            // Update the stamp to Rolled state if and only if the current state is running.
            // If the current state is active, it means we received a delayed put which toggled the status to Active.
View Full Code Here

Examples of com.rackspacecloud.blueflood.rollup.Granularity

   
    public void run() {
        // done waiting.
        singleRollupReadContext.getWaitHist().update(System.currentTimeMillis() - startWait);

        Granularity srcGran;
        try {
            srcGran = singleRollupReadContext.getRollupGranularity().finer();
        } catch (GranularityException ex) {
            executionContext.decrementReadCounter();
            return; // no work to be done.
        }


        if (log.isDebugEnabled()) {
            log.trace("Executing rollup from {} for {} {}", new Object[] {
                    srcGran.shortName(),
                    singleRollupReadContext.getRange().toString(),
                    singleRollupReadContext.getLocator()});
        }

        // start timing this action.
        Timer.Context timerContext = singleRollupReadContext.getExecuteTimer().time();

        try {
            Timer.Context calcrollupContext = calcTimer.time();

            // Read data and compute rollup
            Points input;
            Rollup rollup = null;
            RollupType rollupType = RollupType.fromString((String) rollupTypeCache.get(
                    singleRollupReadContext.getLocator(), MetricMetadata.ROLLUP_TYPE.name().toLowerCase()));
            Class<? extends Rollup> rollupClass = RollupType.classOf(rollupType, srcGran.coarser());
            ColumnFamily<Locator, Long> srcCF = CassandraModel.getColumnFamily(rollupClass, srcGran);
            ColumnFamily<Locator, Long> dstCF = CassandraModel.getColumnFamily(rollupClass, srcGran.coarser());

            try {
                // first, get the points.
                input = AstyanaxReader.getInstance().getDataToRoll(rollupClass,
                        singleRollupReadContext.getLocator(), singleRollupReadContext.getRange(), srcCF);

                if (input.isEmpty()) {
                    noPointsToCalculateRollup.mark();
                    return;
                }

                // next, compute the rollup.
                rollup =  RollupRunnable.getRollupComputer(rollupType, srcGran).compute(input);
            } finally {
                calcrollupContext.stop();
            }
            // now enqueue the new rollup for writing.
            rollupBatchWriter.enqueueRollupForWrite(new SingleRollupWriteContext(rollup, singleRollupReadContext, dstCF));

            RollupService.lastRollupTime.set(System.currentTimeMillis());
            //Emit a rollup event to eventemitter
            RollupEventEmitter.getInstance().emit(RollupEventEmitter.ROLLUP_EVENT_NAME,
                    new RollupEvent(singleRollupReadContext.getLocator(), rollup,
                            AstyanaxReader.getUnitString(singleRollupReadContext.getLocator()),
                            singleRollupReadContext.getRollupGranularity().name(),
                            singleRollupReadContext.getRange().getStart()));
        } catch (Exception e) {
            log.error("Rollup failed; Locator: {}, Source Granularity: {}, For period: {}", new Object[] {
                    singleRollupReadContext.getLocator(),
                    singleRollupReadContext.getRange().toString(),
                    srcGran.name(),
                    e});
        } finally {
            executionContext.decrementReadCounter();
            timerContext.stop();
        }
View Full Code Here

Examples of com.rackspacecloud.blueflood.rollup.Granularity

            analyzer.scanMetrics(new ArrayList<IMetric>(metrics));
            writer.insertFull(metrics);
        }

        // generate every level of rollup for the raw data
        Granularity g = Granularity.FULL;
        while (g != Granularity.MIN_1440) {
            g = g.coarser();
            for (Locator locator : locators) {
                RollupTestUtils.generateRollups(locator, baseMillis, baseMillis + 86400000, g);
            }
        }
View Full Code Here

Examples of com.rackspacecloud.blueflood.rollup.Granularity

                    }
                };
            }
        });

        Granularity gran = Granularity.MIN_20;
        Range range = new Range(gran.snapMillis(baseMillis), baseMillis + 86400000);

        final List<Locator> tooManyLocators = new ArrayList<Locator>();
        tooManyLocators.addAll(locators);
        // generate arbitrarily large number of locators so we slow down the query so we can test a timeout
        for (int i = 0; i < 50; i++) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.