Package voldemort

Examples of voldemort.VoldemortException


                                                                                     .iterator();

            @Override
            protected Pair<ByteArray, Versioned<byte[]>> computeNext() {
                if(Math.random() > FAIL_PROBABILITY) {
                    throw new VoldemortException("Failing Iterator.");
                }

                if(!innerIterator.hasNext())
                    return endOfData();
View Full Code Here


        strategy = new RoutingStrategyFactory().updateRoutingStrategy(storeDef, cluster);

        InMemoryStorageEngine<ByteArray, byte[], byte[]> inMemoryStorageEngine = new InMemoryStorageEngine<ByteArray, byte[], byte[]>(STORE_NAME);
        LoggingStore<ByteArray, byte[], byte[]> loggingStore = new LoggingStore<ByteArray, byte[], byte[]>(inMemoryStorageEngine);

        VoldemortException e = new UnreachableStoreException("Node down");
        ForceFailStore<ByteArray, byte[], byte[]> failureStore = new ForceFailStore<ByteArray, byte[], byte[]>(loggingStore,
                                                                                                               e);
        SleepyStore<ByteArray, byte[], byte[]> sleepyFailureStore = new SleepyStore<ByteArray, byte[], byte[]>(sleepBeforeFailingInMs,
                                                                                                               failureStore);
        failureStore.setFail(true);
View Full Code Here

                        writes,
                        threads,
                        failing,
                        0,
                        RoutingStrategyType.CONSISTENT_STRATEGY,
                        new VoldemortException());
    }
View Full Code Here

                                           null,
                                           zoneReplicationFactor,
                                           RoutingStrategyType.ZONE_STRATEGY,
                                           0,
                                           BANNAGE_PERIOD,
                                           new VoldemortException());

        testBasicOperations(cluster.getNumberOfNodes(),
                            cluster.getNumberOfNodes(),
                            3,
                            0,
View Full Code Here

                                           Sets.newHashSet(2, 4, 8),
                                           zoneReplicationFactor,
                                           RoutingStrategyType.ZONE_STRATEGY,
                                           SLEEPY_TIME,
                                           100,
                                           new VoldemortException());

        testBasicOperations(cluster.getNumberOfNodes(),
                            cluster.getNumberOfNodes(),
                            3,
                            0,
View Full Code Here

                                           Sets.newHashSet(2, 4, 8),
                                           zoneReplicationFactor,
                                           RoutingStrategyType.ZONE_STRATEGY,
                                           SLEEPY_TIME,
                                           OPERATION_TIMEOUT,
                                           new VoldemortException());

        try {
            testBasicOperations(cluster.getNumberOfNodes(),
                                cluster.getNumberOfNodes(),
                                3,
View Full Code Here

                                                       Sets.newHashSet(4, 5, 6, 7),
                                                       zoneReplicationFactor,
                                                       RoutingStrategyType.ZONE_STRATEGY,
                                                       SLEEPY_TIME,
                                                       OPERATION_TIMEOUT,
                                                       new VoldemortException());

        start = System.nanoTime();
        try {
            s1.put(new ByteArray("test".getBytes()), versioned, null);
        } finally {
            long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
            assertTrue(elapsed + " < " + SLEEPY_TIME, elapsed < SLEEPY_TIME);
        }
        // Putting extra key to test getAll
        s1.put(new ByteArray("test2".getBytes()), versioned, null);

        start = System.nanoTime();
        try {
            s1.get(new ByteArray("test".getBytes()), null);
        } finally {
            long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
            assertTrue(elapsed + " < " + SLEEPY_TIME, elapsed < SLEEPY_TIME);
        }

        start = System.nanoTime();
        try {
            List<Version> versions = s1.getVersions(new ByteArray("test".getBytes()));
            for(Version version: versions) {
                assertEquals(version.compare(versioned.getVersion()), Occurred.BEFORE);
            }
        } finally {
            long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
            assertTrue(elapsed + " < " + SLEEPY_TIME, elapsed < SLEEPY_TIME);
        }

        start = System.nanoTime();
        try {
            s1.delete(new ByteArray("test".getBytes()), versioned.getVersion());
        } finally {
            long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
            assertTrue(elapsed + " < " + SLEEPY_TIME, elapsed < SLEEPY_TIME);
        }

        // make sure sleepy stores processed the delete before checking,
        // otherwise, we might be bailing
        // out of the test too early for the delete to be processed.
        Thread.sleep(SLEEPY_TIME * 2);
        List<ByteArray> keys = Lists.newArrayList(new ByteArray("test".getBytes()),
                                                  new ByteArray("test2".getBytes()));

        Map<ByteArray, List<Versioned<byte[]>>> values = s1.getAll(keys, null);
        assertFalse("'test' did not get deleted.",
                    values.containsKey(new ByteArray("test".getBytes())));
        ByteUtils.compare(values.get(new ByteArray("test2".getBytes())).get(0).getValue(),
                          new byte[] { 1 });

        // Basic put with zone read = 1, zone write = 1
        Store<ByteArray, byte[], byte[]> s2 = getStore(cluster,
                                                       1,
                                                       1,
                                                       1,
                                                       1,
                                                       8,
                                                       null,
                                                       Sets.newHashSet(4, 5, 6, 7),
                                                       zoneReplicationFactor,
                                                       RoutingStrategyType.ZONE_STRATEGY,
                                                       SLEEPY_TIME,
                                                       BANNAGE_PERIOD,
                                                       new VoldemortException());

        start = System.nanoTime();

        try {
            s2.put(new ByteArray("test".getBytes()), versioned, null);
        } finally {
            long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
            assertTrue(elapsed + " > " + SLEEPY_TIME, elapsed >= SLEEPY_TIME);
        }
        s2.put(new ByteArray("test2".getBytes()), versioned, null);

        try {
            s2.get(new ByteArray("test".getBytes()), null);
            fail("Should have shown exception");
        } catch(InsufficientZoneResponsesException e) {
            /*
             * Why would you want responses from two zones and wait for only one
             * response...
             */
        }

        try {
            s2.getVersions(new ByteArray("test".getBytes()));
            fail("Should have shown exception");
        } catch(InsufficientZoneResponsesException e) {
            /*
             * Why would you want responses from two zones and wait for only one
             * response...
             */
        }

        try {
            s2.delete(new ByteArray("test".getBytes()), null);
        } catch(InsufficientZoneResponsesException e) {
            /*
             * Why would you want responses from two zones and wait for only one
             * response...
             */
        }

        values = s2.getAll(keys, null);
        assertFalse("'test' did not get deleted.",
                    values.containsKey(new ByteArray("test".getBytes())));
        ByteUtils.compare(values.get(new ByteArray("test2".getBytes())).get(0).getValue(),
                          new byte[] { 1 });

        // Basic put with zone read = 0, zone write = 0 and failures in other
        // dc, but should still work
        Store<ByteArray, byte[], byte[]> s3 = getStore(cluster,
                                                       1,
                                                       1,
                                                       0,
                                                       0,
                                                       8,
                                                       Sets.newHashSet(4, 5, 6, 7),
                                                       null,
                                                       zoneReplicationFactor,
                                                       RoutingStrategyType.ZONE_STRATEGY,
                                                       SLEEPY_TIME,
                                                       BANNAGE_PERIOD,
                                                       new VoldemortException());

        start = System.nanoTime();
        try {
            s3.put(new ByteArray("test".getBytes()), versioned, null);
        } finally {
            long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
            assertTrue(elapsed + " < " + SLEEPY_TIME, elapsed < SLEEPY_TIME);
        }
        // Putting extra key to test getAll
        s3.put(new ByteArray("test2".getBytes()), versioned, null);

        start = System.nanoTime();
        try {
            List<Version> versions = s3.getVersions(new ByteArray("test".getBytes()));
            for(Version version: versions) {
                assertEquals(version.compare(versioned.getVersion()), Occurred.BEFORE);
            }
        } finally {
            long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
            assertTrue(elapsed + " < " + SLEEPY_TIME, elapsed < SLEEPY_TIME);
        }

        start = System.nanoTime();
        try {
            s3.get(new ByteArray("test".getBytes()), null);
        } finally {
            long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
            assertTrue(elapsed + " < " + SLEEPY_TIME, elapsed < SLEEPY_TIME);
        }

        start = System.nanoTime();
        try {
            s3.delete(new ByteArray("test".getBytes()), versioned.getVersion());
        } finally {
            long elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
            assertTrue(elapsed + " < " + SLEEPY_TIME, elapsed < SLEEPY_TIME);
        }

        // Basic put with zone read = 1, zone write = 1 and failures in other
        // dc, should not work
        Store<ByteArray, byte[], byte[]> s4 = getStore(cluster,
                                                       2,
                                                       2,
                                                       1,
                                                       1,
                                                       8,
                                                       Sets.newHashSet(4, 5, 6, 7),
                                                       null,
                                                       zoneReplicationFactor,
                                                       RoutingStrategyType.ZONE_STRATEGY,
                                                       SLEEPY_TIME,
                                                       BANNAGE_PERIOD,
                                                       new VoldemortException());

        try {
            s4.put(new ByteArray("test".getBytes()), new Versioned<byte[]>(new byte[] { 1 }), null);
            fail("Should have shown exception");
        } catch(InsufficientZoneResponsesException e) {
View Full Code Here

                                                       9,
                                                       9,
                                                       9,
                                                       0,
                                                       RoutingStrategyType.TO_ALL_STRATEGY,
                                                       new VoldemortException());
        try {
            s1.put(aKey, new Versioned<byte[]>(aValue), aTransform);
            fail("Failure is expected");
        } catch(InsufficientOperationalNodesException e) { /* expected */
        }
        assertOperationalNodes(9);

        cluster = getNineNodeCluster();

        Store<ByteArray, byte[], byte[]> s2 = getStore(cluster,
                                                       1,
                                                       9,
                                                       9,
                                                       9,
                                                       0,
                                                       RoutingStrategyType.TO_ALL_STRATEGY,
                                                       new UnreachableStoreException("no go"));
        try {
            s2.put(aKey, new Versioned<byte[]>(aValue), aTransform);
            fail("Failure is expected");
        } catch(InsufficientOperationalNodesException e) { /* expected */
        }
        assertOperationalNodes(0);

        // test get
        cluster = getNineNodeCluster();

        s1 = getStore(cluster,
                      1,
                      9,
                      9,
                      9,
                      0,
                      RoutingStrategyType.TO_ALL_STRATEGY,
                      new VoldemortException());
        try {
            s1.get(aKey, aTransform);
            fail("Failure is expected");
        } catch(InsufficientOperationalNodesException e) { /* expected */
        }
        assertOperationalNodes(9);

        cluster = getNineNodeCluster();

        s2 = getStore(cluster,
                      1,
                      9,
                      9,
                      9,
                      0,
                      RoutingStrategyType.TO_ALL_STRATEGY,
                      new UnreachableStoreException("no go"));
        try {
            s2.get(aKey, aTransform);
            fail("Failure is expected");
        } catch(InsufficientOperationalNodesException e) { /* expected */
        }
        assertOperationalNodes(0);

        // test delete
        cluster = getNineNodeCluster();

        s1 = getStore(cluster,
                      1,
                      9,
                      9,
                      9,
                      0,
                      RoutingStrategyType.TO_ALL_STRATEGY,
                      new VoldemortException());
        try {
            s1.delete(aKey, new VectorClock());
            fail("Failure is expected");
        } catch(InsufficientOperationalNodesException e) { /* expected */
        }
View Full Code Here

                                           Sets.newHashSet(0),
                                           zoneReplicationFactor,
                                           RoutingStrategyType.ZONE_STRATEGY,
                                           0,
                                           BANNAGE_PERIOD,
                                           new VoldemortException());
        Store<ByteArray, byte[], byte[]> store = new InconsistencyResolvingStore<ByteArray, byte[], byte[]>(routedStore,
                                                                                                            new VectorClockInconsistencyResolver<byte[]>());

        try {
            store.put(aKey, new Versioned<byte[]>(aValue), aTransform);
View Full Code Here

    }

    public void close() {}

    public void update(StoreDefinition storeDef) {
        throw new VoldemortException("Storage config updates not permitted for "
                                     + this.getClass().getCanonicalName());
    }
View Full Code Here

TOP

Related Classes of voldemort.VoldemortException

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.