Package voldemort.versioning

Examples of voldemort.versioning.VectorClock


        return count;
    }

    private void populateSlops(List<Versioned<Slop>> slops) {
        for(Versioned<Slop> slop: slops) {
            VectorClock clock = TestUtils.getClock(1);
            NodeValue<ByteArray, byte[]> nodeValue = new NodeValue<ByteArray, byte[]>(PURGE_SERVER_ID,
                                                                                      slop.getValue()
                                                                                          .makeKey(),
                                                                                      new Versioned<byte[]>(slopSerializer.toBytes(slop.getValue()),
                                                                                                            clock));
View Full Code Here


        }

        Store<ByteArray, byte[], byte[]> store = new InconsistencyResolvingStore<ByteArray, byte[], byte[]>(routedStore,
                                                                                                            new VectorClockInconsistencyResolver<byte[]>());

        VectorClock clock = getClock(1);
        Versioned<byte[]> versioned = new Versioned<byte[]>(aValue, clock);
        routedStore.put(aKey, versioned, aTransform);

        waitForOperationToComplete(customSleepTime);
        assertNOrMoreEqual(routedStore, cluster.getNumberOfNodes() - failures, aKey, versioned);
View Full Code Here

    private void testBasicOperationFailure(int reads,
                                           int writes,
                                           int failures,
                                           int threads,
                                           RoutedStore customRoutedStore) throws Exception {
        VectorClock clock = getClock(1);
        Versioned<byte[]> versioned = new Versioned<byte[]>(aValue, clock);

        RoutedStore routedStore = null;
        if(customRoutedStore == null) {
            routedStore = getStore(cluster,
View Full Code Here

    }

    @Test
    public void testPutIncrementsVersion() throws Exception {
        Store<ByteArray, byte[], byte[]> store = getStore();
        VectorClock clock = new VectorClock();
        VectorClock copy = clock.clone();
        store.put(aKey, new Versioned<byte[]>(getValue(), clock), aTransform);
        List<Versioned<byte[]>> found = store.get(aKey, aTransform);
        assertEquals("Invalid number of items found.", 1, found.size());
        assertEquals("Version not incremented properly",
                     Occurred.BEFORE,
                     copy.compare(found.get(0).getVersion()));
    }
View Full Code Here

    }

    @Test
    public void testPutIncrementsVersionZZZ() throws Exception {
        Store<ByteArray, byte[], byte[]> store = getZonedStore();
        VectorClock clock = new VectorClock();
        VectorClock copy = clock.clone();
        store.put(aKey, new Versioned<byte[]>(getValue(), clock), aTransform);
        List<Versioned<byte[]>> found = store.get(aKey, aTransform);
        assertEquals("Invalid number of items found.", 1, found.size());
        assertEquals("Version not incremented properly",
                     Occurred.BEFORE,
                     copy.compare(found.get(0).getVersion()));
    }
View Full Code Here

                      9,
                      0,
                      RoutingStrategyType.TO_ALL_STRATEGY,
                      new VoldemortException());
        try {
            s1.delete(aKey, new VectorClock());
            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.delete(aKey, new VectorClock());
            fail("Failure is expected");
        } catch(InsufficientOperationalNodesException e) { /* expected */
        }
        assertOperationalNodes(0);
    }
View Full Code Here

        recordException(failureDetector, secondaryNode);
        recordSuccess(failureDetector, primaryNode);
        // Generate the clock based off secondary so that the resulting clock
        // will be [1:1, 6:1] across the replicas, except for the secondary
        // which will be [6:1]
        VectorClock clock = getClock(6);
        store.put(aKey, new Versioned<byte[]>(anotherValue, clock), null);

        // Enable secondary and disable primary, the following get should cause
        // a read repair on the secondary in the code path that is only executed
        // if there are failures. This should repair the secondary with the
View Full Code Here

            fail("Store should not getAll null keys!");
        } catch(IllegalArgumentException e) {
            // this is good
        }
        try {
            store.delete(null, new VectorClock());
            fail("Store should not delete null keys!");
        } catch(IllegalArgumentException e) {
            // this is good
        }
    }
View Full Code Here

    private void testObsoletePutFails(String message,
                                      Store<K, V, T> store,
                                      K key,
                                      Versioned<V> versioned) {
        VectorClock clock = (VectorClock) versioned.getVersion();
        clock = clock.clone();
        try {
            store.put(key, versioned, null);
            fail(message);
        } catch(ObsoleteVersionException e) {
            // this is good, but check that we didn't fuck with the version
View Full Code Here

    @Test
    public void testFetchedEqualsPut() throws Exception {
        K key = getKey();
        Store<K, V, T> store = getStore();
        VectorClock clock = getClock(1, 1, 2, 3, 3, 4);
        V value = getValue();
        assertEquals("Store not empty at start!", 0, store.get(key, null).size());
        Versioned<V> versioned = new Versioned<V>(value, clock);
        store.put(key, versioned, null);
        List<Versioned<V>> found = store.get(key, null);
View Full Code Here

TOP

Related Classes of voldemort.versioning.VectorClock

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.