Package voldemort.utils

Examples of voldemort.utils.ByteArray


        // superceding clock [1:1,6:1]
        recordException(failureDetector, primaryNode);
        recordSuccess(failureDetector, secondaryNode);
        List<Versioned<byte[]>> versioneds = store.get(aKey, null);
        assertEquals(1, versioneds.size());
        assertEquals(new ByteArray(anotherValue), new ByteArray(versioneds.get(0).getValue()));

        // Read repairs are done asynchronously, so we sleep for a short period.
        // It may be a good idea to use a synchronous executor service.
        Thread.sleep(500);
        for(Map.Entry<Integer, Store<ByteArray, byte[], byte[]>> innerStoreEntry: routedStore.getInnerStores()
                                                                                             .entrySet()) {
            // Only look at the nodes in the pref list
            if(replicatingNodes.contains(innerStoreEntry.getKey())) {
                List<Versioned<byte[]>> innerVersioneds = innerStoreEntry.getValue()
                                                                         .get(aKey, null);
                assertEquals(1, versioneds.size());
                assertEquals(new ByteArray(anotherValue), new ByteArray(innerVersioneds.get(0)
                                                                                       .getValue()));
            }
        }
    }
View Full Code Here


            // from all the zones and do the essential read repairs.
            recordSuccess(failureDetector, cluster.getNodeById(0));
            recordSuccess(failureDetector, cluster.getNodeById(1));
            List<Versioned<byte[]>> versioneds = store.get(aKey, null);
            assertEquals(1, versioneds.size());
            assertEquals(new ByteArray(anotherValue), new ByteArray(versioneds.get(0).getValue()));

            // Read repairs are done asynchronously, so we sleep for a short
            // period. It may be a good idea to use a synchronous executor
            // service.
            Thread.sleep(500);
            for(Map.Entry<Integer, Store<ByteArray, byte[], byte[]>> innerStoreEntry: routedStore.getInnerStores()
                                                                                                 .entrySet()) {
                // Only look at the nodes in the pref list
                if(replicatingNodes.contains(innerStoreEntry.getKey())) {
                    List<Versioned<byte[]>> innerVersioneds = innerStoreEntry.getValue().get(aKey,
                                                                                             null);
                    assertEquals(1, versioneds.size());
                    assertEquals(new ByteArray(anotherValue),
                                 new ByteArray(innerVersioneds.get(0).getValue()));
                }
            }

        } catch(VoldemortException ve) {
            fail("Unexpected error occurred : " + ve);
View Full Code Here

                                                            failureDetector,
                                                            createConfig(timeout));

        long start = System.nanoTime();
        try {
            routedStore.put(new ByteArray("test".getBytes()),
                            new Versioned<byte[]>(new byte[] { 1 }),
                            null);
            fail("Should have thrown");
        } catch(InsufficientOperationalNodesException e) {
            long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
View Full Code Here

                                                            failureDetector,
                                                            createConfig(timeout));

        long start = System.nanoTime();
        try {
            routedStore.get(new ByteArray("test".getBytes()), null);
            fail("Should have thrown");
        } catch(InsufficientOperationalNodesException e) {
            long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
            assertTrue(elapsed + " < " + totalDelay, elapsed < totalDelay);
        }
View Full Code Here

                                                            failureDetector,
                                                            createConfig(timeout));

        long start = System.nanoTime();
        try {
            routedStore.get(new ByteArray("test".getBytes()), null);
            fail("Should have thrown");
        } catch(InsufficientOperationalNodesException e) {
            long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
            assertTrue(elapsed + " < " + totalDelay, elapsed < totalDelay);
        }

        start = System.nanoTime();
        try {
            routedStore.put(new ByteArray("test".getBytes()),
                            new Versioned<byte[]>(new byte[] { 1 }),
                            null);
            fail("Should have thrown");
        } catch(InsufficientOperationalNodesException e) {
            long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
View Full Code Here

                                                            definition,
                                                            stores,
                                                            failureDetector,
                                                            createConfig(timeoutConfig));
        try {
            routedStore.put(new ByteArray("test".getBytes()),
                            new Versioned<byte[]>(new byte[] { 1 }),
                            null);
        } catch(InsufficientOperationalNodesException e) {
            fail("Should not have failed");
        }

        try {
            routedStore.get(new ByteArray("test".getBytes()), null);
            fail("Should have thrown");
        } catch(InsufficientOperationalNodesException e) {

        }
    }
View Full Code Here

                                                            storeDef,
                                                            subStores,
                                                            failureDetector,
                                                            createConfig(BANNAGE_PERIOD));

        ByteArray key1 = aKey;
        routedStore.put(key1, Versioned.value("value1".getBytes()), null);
        ByteArray key2 = TestUtils.toByteArray("voldemort");
        routedStore.put(key2, Versioned.value("value2".getBytes()), null);

        long putCount = statTrackingStore.getStats().getCount(Tracked.PUT);
        routedStore.getAll(Arrays.asList(key1, key2), null);
        /* Read repair happens asynchronously, so we wait a bit */
 
View Full Code Here

                                                                                             cluster);

        List<Node> nodesRoutedTo = routingStrategy.routeRequest("test".getBytes());
        long start = System.nanoTime(), elapsed;
        try {
            s1.put(new ByteArray("test".getBytes()), versioned, null);
        } finally {
            elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
            assertTrue(elapsed + " < " + SLEEPY_TIME, elapsed < SLEEPY_TIME);
        }

        Thread.sleep(SLEEPY_TIME - elapsed);

        for(Node node: nodesRoutedTo) {
            assertEquals(subStores.get(node.getId())
                                  .get(new ByteArray("test".getBytes()), null)
                                  .get(0), versioned);
        }

        // make sure the failure detector adds back any previously failed nodes
        Thread.sleep(BANNAGE_PERIOD + 100);
        start = System.nanoTime();
        try {
            s1.delete(new ByteArray("test".getBytes()), versioned.getVersion());
        } finally {
            elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
            assertTrue(elapsed + " < " + SLEEPY_TIME, elapsed < SLEEPY_TIME);
        }

        Thread.sleep(SLEEPY_TIME - elapsed);

        for(Node node: nodesRoutedTo) {
            assertEquals(subStores.get(node.getId())
                                  .get(new ByteArray("test".getBytes()), null)
                                  .size(), 0);
        }

    }
View Full Code Here

            String value = key;

            Versioned<byte[]> outputValue = Versioned.value(value.getBytes());
            // adminClient.streamingPut(new ByteArray(key.getBytes()),
            // outputValue);
            streamer.streamingPut(new ByteArray(key.getBytes()), outputValue);
        }
        streamer.commitToVoldemort();
        streamer.closeStreamingSession();
        assertEquals(verifyKeysExist(nodeIdOnWhichToVerifyKey), true);
View Full Code Here

            byte[] opCode = new byte[] { Slop.Operation.PUT.getOpCode() };
            byte[] spacer = new byte[] { (byte) 0 };
            byte[] storeNameBytes = ByteUtils.getBytes(STORE_NAME, "UTF-8");
            byte[] nodeIdBytes = new byte[ByteUtils.SIZE_OF_INT];
            ByteUtils.writeInt(nodeIdBytes, failingNodeId, 0);
            ByteArray slopKey = new ByteArray(ByteUtils.cat(opCode,
                                                            spacer,
                                                            storeNameBytes,
                                                            spacer,
                                                            nodeIdBytes,
                                                            spacer,
View Full Code Here

TOP

Related Classes of voldemort.utils.ByteArray

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.