Package voldemort.store.slop

Examples of voldemort.store.slop.Slop


        // Now check if the slops went through and also got deleted
        Iterator<Versioned<Slop>> entryIterator = entrySet2.listIterator();
        while(entryIterator.hasNext()) {
            Versioned<Slop> versionedSlop = entryIterator.next();
            Slop nextSlop = versionedSlop.getValue();
            StorageEngine<ByteArray, byte[], byte[]> store = getVoldemortServer(2).getStoreRepository()
                                                                                  .getStorageEngine(nextSlop.getStoreName());
            if(nextSlop.getOperation().equals(Slop.Operation.PUT)) {
                assertNotSame("entry should be present at store",
                              0,
                              store.get(nextSlop.getKey(), null).size());
                assertEquals("entry value should match",
                             new String(nextSlop.getValue()),
                             new String(store.get(nextSlop.getKey(), null).get(0).getValue()));
            } else if(nextSlop.getOperation().equals(Slop.Operation.DELETE)) {
                assertEquals("entry value should match", 0, store.get(nextSlop.getKey(), null)
                                                                 .size());
            }

            // did it get deleted correctly
            assertEquals("slop should have gone", 0, slopStoreNode0.get(nextSlop.makeKey(), null)
                                                                   .size());
        }

        entryIterator = entrySet1.listIterator();
        while(entryIterator.hasNext()) {
            Versioned<Slop> versionedSlop = entryIterator.next();
            Slop nextSlop = versionedSlop.getValue();
            // did it get deleted correctly
            assertNotSame("slop should be there", 0, slopStoreNode0.get(nextSlop.makeKey(), null)
                                                                   .size());
        }

        // Check counts
        SlopStorageEngine slopEngine = getVoldemortServer(0).getStoreRepository().getSlopStore();
        assertEquals(slopEngine.getOutstandingTotal(), 50);
        assertEquals(slopEngine.getOutstandingByNode().get(1), new Long(50));
        assertEquals(slopEngine.getOutstandingByNode().get(2), new Long(0));

        // now replace server 1 with a new host and start it
        cluster = ServerTestUtils.updateClusterWithNewHost(cluster, 1);
        startServers(1);

        // update the meatadata store with the new cluster on node 0 and 2 (the
        // two servers that are running)
        servers[0].getMetadataStore().put(MetadataStore.CLUSTER_KEY, cluster);
        servers[2].getMetadataStore().put(MetadataStore.CLUSTER_KEY, cluster);

        // Give some time for the pusher job to figure out that server1 is up
        Thread.sleep(35000);

        // start the pusher job again
        pusher.run();

        // Give some time for the slops to go over
        Thread.sleep(10000);

        // make sure the slot for server 1 is pushed to the new host
        // Now check if the slops went through and also got deleted
        entryIterator = entrySet1.listIterator();
        while(entryIterator.hasNext()) {
            Versioned<Slop> versionedSlop = entryIterator.next();
            Slop nextSlop = versionedSlop.getValue();
            StorageEngine<ByteArray, byte[], byte[]> store = getVoldemortServer(1).getStoreRepository()
                                                                                  .getStorageEngine(nextSlop.getStoreName());
            if(nextSlop.getOperation().equals(Slop.Operation.PUT)) {
                assertNotSame("entry should be present at store",
                              0,
                              store.get(nextSlop.getKey(), null).size());
                assertEquals("entry value should match",
                             new String(nextSlop.getValue()),
                             new String(store.get(nextSlop.getKey(), null).get(0).getValue()));
            } else if(nextSlop.getOperation().equals(Slop.Operation.DELETE)) {
                assertEquals("entry value should match", 0, store.get(nextSlop.getKey(), null)
                                                                 .size());
            }

            // did it get deleted correctly
            assertEquals("slop should have gone", 0, slopStoreNode0.get(nextSlop.makeKey(), null)
                                                                   .size());
        }

    }
View Full Code Here


        // check updated values
        Iterator<Versioned<Slop>> entrysetItr = entrySet.iterator();

        while(entrysetItr.hasNext()) {
            Versioned<Slop> versioned = entrysetItr.next();
            Slop nextSlop = versioned.getValue();
            Store<ByteArray, byte[], byte[]> store = getStore(0, nextSlop.getStoreName());

            if(nextSlop.getOperation().equals(Slop.Operation.PUT)) {
                assertNotSame("entry should be present at store",
                              0,
                              store.get(nextSlop.getKey(), null).size());
                assertEquals("entry value should match",
                             new String(nextSlop.getValue()),
                             new String(store.get(nextSlop.getKey(), null).get(0).getValue()));
            } else if(nextSlop.getOperation().equals(Slop.Operation.DELETE)) {
                assertEquals("entry value should match", 0, store.get(nextSlop.getKey(), null)
                                                                 .size());
            }
        }
    }
View Full Code Here

    protected synchronized void streamingSlopPut(ByteArray key,
                                                 Versioned<byte[]> value,
                                                 String storeName,
                                                 int failedNodeId) throws IOException {

        Slop slop = new Slop(storeName,
                             Slop.Operation.PUT,
                             key,
                             value.getValue(),
                             null,
                             failedNodeId,
                             new Date());

        ByteArray slopKey = slop.makeKey();
        Versioned<byte[]> slopValue = new Versioned<byte[]>(slopSerializer.toBytes(slop),
                                                            value.getVersion());

        Node failedNode = adminClient.getAdminClientCluster().getNodeById(failedNodeId);
        HandoffToAnyStrategy slopRoutingStrategy = new HandoffToAnyStrategy(adminClient.getAdminClientCluster(),
View Full Code Here

    }

    @Override
    public void execute(Pipeline pipeline) {
        for(Map.Entry<Node, Slop> slopToBeSent: slopsToBeSent.entrySet()) {
            Slop slop = slopToBeSent.getValue();
            Node failedNode = slopToBeSent.getKey();
            if(logger.isTraceEnabled())
                logger.trace("Performing hinted handoff for node " + failedNode + ", store "
                             + pipelineData.getStoreName() + "key " + key + ", version" + version);
View Full Code Here

            try {
                if(entryIterator.hasNext()) {
                    while(entryIterator.hasNext()) {
                        Versioned<Slop> versionedSlop = entryIterator.next();
                        Slop slop = versionedSlop.getValue();

                        // Build the message
                        RequestType requestType = null;
                        if(slop.getOperation().equals(Operation.PUT)) {
                            requestType = RequestType.PUT;
                        } else if(slop.getOperation().equals(Operation.DELETE)) {
                            requestType = RequestType.DELETE;
                        } else {
                            logger.error("Unsupported operation. Skipping");
                            continue;
                        }
                        VAdminProto.UpdateSlopEntriesRequest.Builder updateRequest = VAdminProto.UpdateSlopEntriesRequest.newBuilder()
                                                                                                                         .setStore(slop.getStoreName())
                                                                                                                         .setKey(ProtoUtils.encodeBytes(slop.getKey()))
                                                                                                                         .setVersion(ProtoUtils.encodeClock(versionedSlop.getVersion()))
                                                                                                                         .setRequestType(requestType);
                        // Add transforms and value only if required
                        if(slop.getTransforms() != null)
                            updateRequest.setTransform(ProtoUtils.encodeTransform(slop.getTransforms()));
                        if(slop.getValue() != null)
                            updateRequest.setValue(ByteString.copyFrom(slop.getValue()));

                        if(firstMessage) {
                            ProtoUtils.writeMessage(outputStream,
                                                    VAdminProto.VoldemortAdminRequest.newBuilder()
                                                                                     .setType(VAdminProto.AdminRequestType.UPDATE_SLOP_ENTRIES)
View Full Code Here

        ex = (Exception) response.getValue();

        if(enableHintedHandoff) {
            if(ex instanceof UnreachableStoreException || ex instanceof QuotaExceededException) {
                Slop slop = new Slop(pipelineData.getStoreName(),
                                     Slop.Operation.DELETE,
                                     key,
                                     null,
                                     null,
                                     node.getId(),
View Full Code Here

            if(logger.isTraceEnabled())
                logger.trace("Performing parallel hinted handoff for node " + slopFinalDestinationNode
                             + ", store " + pipelineData.getStoreName() + " key " + key
                             + ", version " + version);

            Slop slop = new Slop(pipelineData.getStoreName(),
                                 Slop.Operation.PUT,
                                 key,
                                 versionedCopy.getValue(),
                                 transforms,
                                 failedNodeId,
View Full Code Here

                                if(logger.isDebugEnabled()) {
                                    logger.debug("PUT {key:" + key + "} triedDelegateSlop: "
                                                 + triedDelegateSlop);
                                }
                                if(!triedDelegateSlop) {
                                    Slop slop = new Slop(pipelineData.getStoreName(),
                                                         Slop.Operation.PUT,
                                                         key,
                                                         versionedCopy.getValue(),
                                                         transforms,
                                                         node.getId(),
View Full Code Here

            long keyInt = (long) (Math.random() * 1000000000L);
            ByteArray key = new ByteArray(ByteUtils.getBytes("" + keyInt, "UTF-8"));
            byte[] value = ByteUtils.getBytes("value-" + keyInt, "UTF-8");

            Versioned<Slop> versioned = Versioned.value(new Slop(storeNames[storeId],
                                                                 operationType,
                                                                 key,
                                                                 value,
                                                                 null,
                                                                 nodeId,
View Full Code Here

        try {
            while(slopIterator.hasNext()) {

                Pair<ByteArray, Versioned<Slop>> keyAndVal = slopIterator.next();
                Versioned<Slop> versioned = keyAndVal.getSecond();
                Slop slop = versioned.getValue();

                // Determine if the slop qualifies for purging..
                boolean purge = false;
                if(nodesToPurge.contains(slop.getNodeId())) {
                    purge = true;
                } else if(nodesInPurgeZone != null && nodesInPurgeZone.contains(slop.getNodeId())) {
                    purge = true;
                } else if(storesToPurge.contains(slop.getStoreName())) {
                    purge = true;
                }

                // if any one of the filters were met, delete
                if(purge) {
View Full Code Here

TOP

Related Classes of voldemort.store.slop.Slop

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.