Package voldemort.versioning

Examples of voldemort.versioning.Version


            store.put(aKey, new Versioned<byte[]>(aValue), null);

            List<Version> initialVersions = store.getVersions(aKey);
            assertEquals(6, initialVersions.size());

            Version mainVersion = initialVersions.get(0);
            for(int i = 1; i < initialVersions.size(); i++) {
                assertEquals(mainVersion, initialVersions.get(i));
            }

            // Do another put with all nodes in the zone 0 marked as
            // unavailable. This will force the put to use a different pseudo
            // master than before.
            byte[] anotherValue = "john".getBytes();

            // In this cluster, nodes 0 and 1 are in Zone 0. Mark them
            // unavailable
            recordException(failureDetector, cluster.getNodeById(0));
            recordException(failureDetector, cluster.getNodeById(1));
            Version newVersion = ((VectorClock) mainVersion).clone();
            store.put(aKey, new Versioned<byte[]>(anotherValue, newVersion), null);

            waitForOperationToComplete(500);

            // Mark the nodes in Zone 0 as available and do a get. The Required
View Full Code Here


    public void testDetermineConsistencyHashValue() {
        Map<ConsistencyCheck.Value, Set<ConsistencyCheck.ClusterNode>> versionNodeSetMap = new HashMap<ConsistencyCheck.Value, Set<ConsistencyCheck.ClusterNode>>();
        int replicationFactor = 4;

        // vector clocks
        Version v1 = new VectorClock();
        ((VectorClock) v1).incrementVersion(1, 100000001);
        ((VectorClock) v1).incrementVersion(2, 100000003);
        Version v2 = new VectorClock();
        ((VectorClock) v2).incrementVersion(1, 100000001);
        ((VectorClock) v2).incrementVersion(3, 100000002);
        Version v3 = new VectorClock();
        ((VectorClock) v3).incrementVersion(1, 100000001);
        ((VectorClock) v3).incrementVersion(4, 100000001);

        // Version is HashedValue
        Versioned<byte[]> versioned1 = new Versioned<byte[]>(value1, v1);
View Full Code Here

            storeClient.put("b", "Partner!!!!");

            // Do a sample get operation:
            Versioned<String> versionedValue = storeClient.get("a");
            System.out.println("Received response : " + versionedValue);
            Version obsoleteVersion = ((VectorClock) versionedValue.getVersion()).clone();

            // Do a versioned put operation:
            System.out.println("First versioned put");
            versionedValue.setObject("New Value !!!");
            System.out.println("************* original version : " + versionedValue.getVersion());
            Version putVersion = storeClient.put("a", versionedValue);
            System.out.println("************* Updated version : " + putVersion);

            // Obsolete version put
            System.out.println("Obsolete put");
            Versioned<String> obsoleteVersionedValue = new Versioned<String>("Obsolete value",
View Full Code Here

            }

            Iterator<Versioned<byte[]>> iter = returnedValuesList.iterator();
            while(iter.hasNext()) {
                Versioned<byte[]> currentValue = iter.next();
                Version currentVersion = currentValue.getVersion();
                if(currentVersion.compare(maxVersion) == Occurred.BEFORE) {
                    iter.remove();
                }
            }

            try {
View Full Code Here

        assertEquals(10, view.get(1, Arrays.asList(filter1)).get(0).getValue().size());

        Integer[] filter2 = { 5, 10 };
        assertEquals(6, view.get(1, Arrays.asList(filter2)).get(0).getValue().size());

        Version updatedVersion = view.get(1, Arrays.asList(filter2)).get(0).getVersion();

        Integer[] filter3 = { 1, 50 };

        Integer[] values2 = { 90, 15, 25, 106 };
        clock = (VectorClock) updatedVersion;
View Full Code Here

                                                          new AdminClientConfig(),
                                                          new ClientConfig());

                Versioned<String> versioned = adminClient.metadataMgmtOps.getRemoteMetadata(nodeId,
                                                                                            MetadataStore.CLUSTER_KEY);
                Version version = versioned.getVersion();

                VectorClock vectorClock = (VectorClock) version;
                vectorClock.incrementVersion(nodeId, System.currentTimeMillis());

                try {
View Full Code Here

    }

    @Test
    public void testHashCodeEquals() {
        // Create multiple nodeValues that are equal and see if they hash the same and equal each other
        Version v1 = createVersion(1, 6);
        Version v2 = createVersion(1, 6);
        Version v3 = createVersion(1, 7);

        logger.info("v1 = " + v1);
        logger.info("v2 = " + v2);
        logger.info("v3 = " + v3);

        assertEquals("VectorClock#equals works", v1, v2);
        assertEquals("VectorClock#hashCode works", v1.hashCode(), v2.hashCode());

        assertFalse(v1.equals(v3));
        assertFalse(v1.hashCode() == v3.hashCode());

        NodeValue<ByteArray, byte[]> nv1 = createNodeValue(1, v1);
        NodeValue<ByteArray, byte[]> nv2 = createNodeValue(1, v2);
        NodeValue<ByteArray, byte[]> nv3 = createNodeValue(1, v3);
View Full Code Here

    }

    @Test
    public void testMultimap () {
        Multimap<Version, NodeValue<ByteArray, byte[]>> multimap = HashMultimap.create();
        Version version = createVersion(1,6);
        NodeValue<ByteArray, byte[]> nodeValue = createNodeValue(1, version);
        multimap.put(version, nodeValue);

        Version version2 = createVersion(1, 7);
        NodeValue<ByteArray, byte[]> nodeValue2 = createNodeValue(1, version2);

        multimap.put(version2, nodeValue2);
        multimap.removeAll(version2);
       
View Full Code Here

        byte[] keyBytes = ByteUtils.fromHexString(keyBytesString);
        ByteArray key = new ByteArray(keyBytes);

        String versionBytesString = components[1];
        byte[] versionBytes = ByteUtils.fromHexString(versionBytesString);
        Version version = new VectorClock(versionBytes, 0);

        String valueBytesString = components[1];
        byte[] value = ByteUtils.fromHexString(valueBytesString);

        return new Pair<ByteArray, Versioned<byte[]>>(key, new Versioned<byte[]>(value, version));
View Full Code Here

        }
        CompositeVersionedPutVoldemortRequest<K, V> putVersionedRequestObject = new CompositeVersionedPutVoldemortRequest<K, V>(requestWrapper.getKey(),
                                                                                                                                versioned,
                                                                                                                                timeLeft);
        putVersionedRequestObject.setRequestOriginTimeInMs(requestWrapper.getRequestOriginTimeInMs());
        Version result = putVersionedWithCustomTimeout(putVersionedRequestObject);
        long endTimeInMs = System.currentTimeMillis();
        if(logger.isDebugEnabled()) {
            logger.debug("PUT response recieved for key: " + keyHexString + " , for store: "
                         + this.storeName + " at time(in ms): " + endTimeInMs);
        }
View Full Code Here

TOP

Related Classes of voldemort.versioning.Version

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.