Package voldemort.utils

Examples of voldemort.utils.EventThrottler


                            executor.execute(new DataCleanupJob<ByteArray, byte[], byte[]>(engine,
                                                                                           scanPermitWrapper,
                                                                                           storeDef.getRetentionDays()
                                                                                                   * Time.MS_PER_DAY,
                                                                                           SystemTime.INSTANCE,
                                                                                           new EventThrottler(entryScanThrottleRate),
                                                                                           metadata));
                        } else {
                            logger.error("forceCleanupOldData() No permit available to run cleanJob already running multiple instance."
                                         + engine.getName());
                        }
View Full Code Here


        this.metadataStore = metadataStore;
        this.scanPermits = Utils.notNull(scanPermits);
        this.numKeysScannedThisRun = new AtomicLong(0);
        this.numKeysUpdatedThisRun = new AtomicLong(0);
        this.isRunning = new AtomicBoolean(false);
        this.throttler = new EventThrottler(maxRatePerSecond);
    }
View Full Code Here

        private final Writer writer;

        public SampleNodeTask(Node node, StoreDefinition storeDefinition, Writer writer) {
            this.node = node;
            this.storeDefinition = storeDefinition;
            this.throttler = new EventThrottler(keysPerSecondLimit);
            this.writer = writer;
        }
View Full Code Here

            this.streamStats = storeRepo.getStreamingStats(this.storeRepo.getSlopStore().getName());
        } else {
            this.streamStats = null;
        }

        this.readThrottler = new EventThrottler(voldemortConfig.getSlopMaxReadBytesPerSec());
        this.adminClient = null;
        this.consumerResults = Lists.newArrayList();
        this.zoneMapping = Maps.newHashMap();
        this.consumerExecutor = Executors.newCachedThreadPool(new ThreadFactory() {
View Full Code Here

        public SlopIterator(SynchronousQueue<Versioned<Slop>> slopQueue,
                            List<Pair<ByteArray, Version>> deleteBatch) {
            this.slopQueue = slopQueue;
            this.deleteBatch = deleteBatch;
            this.writeThrottler = new EventThrottler(voldemortConfig.getSlopMaxWriteBytesPerSec());
        }
View Full Code Here

        acquireRepairPermit();
        try {
            SlopStorageEngine slopStorageEngine = storeRepo.getSlopStore();
            StorageEngine<ByteArray, Slop, byte[]> slopStore = slopStorageEngine.asSlopStore();
            EventThrottler throttler = new EventThrottler(maxWriteBytesPerSec);

            iterator = slopStore.entries();

            while(iterator.hasNext()) {
                if(Thread.interrupted())
                    throw new InterruptedException("Slop pusher job cancelled");

                try {
                    Pair<ByteArray, Versioned<Slop>> keyAndVal;
                    try {
                        keyAndVal = iterator.next();
                    } catch(Exception e) {
                        logger.error("Exception in iterator, escaping the loop ", e);
                        break;
                    }

                    Versioned<Slop> versioned = keyAndVal.getSecond();
                    Slop slop = versioned.getValue();
                    int nodeId = slop.getNodeId();

                    // check for dead slops
                    if(isSlopDead(cluster, storeNames, versioned.getValue())) {
                        handleDeadSlop(slopStorageEngine, keyAndVal);
                        // No matter we deleted it or not, we need to move onto
                        // the next slop.
                        continue;
                    }

                    Node node = cluster.getNodeById(nodeId);

                    attemptedPushes++;
                    if(attemptedPushes % 10000 == 0) {
                        logger.info("Attempted pushing " + attemptedPushes + " slops");
                    }
                    Long attempted = attemptedByNode.get(nodeId);
                    attemptedByNode.put(nodeId, attempted + 1L);

                    if(failureDetector.isAvailable(node)) {
                        Store<ByteArray, byte[], byte[]> store = storeRepo.getNodeStore(slop.getStoreName(),
                                                                                        node.getId());
                        Long startNs = System.nanoTime();
                        int nBytes = 0;
                        try {
                            nBytes = slop.getKey().length();
                            if(slop.getOperation() == Operation.PUT) {
                                store.put(slop.getKey(),
                                          new Versioned<byte[]>(slop.getValue(),
                                                                versioned.getVersion()),
                                          slop.getTransforms());
                                nBytes += slop.getValue().length
                                          + ((VectorClock) versioned.getVersion()).sizeInBytes()
                                          + 1;

                            } else if(slop.getOperation() == Operation.DELETE) {
                                nBytes += ((VectorClock) versioned.getVersion()).sizeInBytes() + 1;
                                store.delete(slop.getKey(), versioned.getVersion());
                            } else {
                                logger.error("Unknown slop operation: " + slop.getOperation());
                                continue;
                            }
                            failureDetector.recordSuccess(node, deltaMs(startNs));
                            slopStore.delete(slop.makeKey(), versioned.getVersion());

                            slopsPushed++;
                            // Increment succeeded
                            Long succeeded = succeededByNode.get(nodeId);
                            succeededByNode.put(nodeId, succeeded + 1L);

                            // Throttle the bytes...
                            throttler.maybeThrottle(nBytes);

                        } catch(ObsoleteVersionException e) {

                            // okay it is old, just delete it
                            slopStore.delete(slop.makeKey(), versioned.getVersion());
                            slopsPushed++;

                            // Increment succeeded
                            Long succeeded = succeededByNode.get(nodeId);
                            succeededByNode.put(nodeId, succeeded + 1L);

                            // Throttle the bytes...
                            throttler.maybeThrottle(nBytes);

                        } catch(UnreachableStoreException e) {
                            failureDetector.recordException(node, deltaMs(startNs), e);
                        }
                    }
View Full Code Here

    }

    public synchronized void updateThrottleLimit(int throttleQPS) {
        THROTTLE_QPS = throttleQPS;

        this.throttler = new EventThrottler(THROTTLE_QPS);
    }
View Full Code Here

        this.allowMerge = allowMerge;
        streamingresults = Executors.newFixedThreadPool(3);
        entriesProcessed = 0;
        newBatch = true;
        isMultiSession = true;
        this.throttler = new EventThrottler(THROTTLE_QPS);

        TimeUnit unit = TimeUnit.SECONDS;

        Collection<Node> nodesInCluster = adminClient.getAdminClientCluster().getNodes();
View Full Code Here

TOP

Related Classes of voldemort.utils.EventThrottler

Copyright © 2018 www.massapicom. 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.