Package voldemort.versioning

Examples of voldemort.versioning.VectorClock.incremented()


    public void testObsoletePut() {
        for(int i = 0; i <= TEST_RUNS; i++) {
            ByteArray key = getValidKey();
            VectorClock clock = (VectorClock) metadataStore.get(key, null).get(0).getVersion();
            Versioned<byte[]> value = new Versioned<byte[]>(getValidValue(key),
                                                            clock.incremented(0, 1));

            try {
                metadataStore.put(key, value, null);
                assertTrue(true);
                metadataStore.put(key, value, null);
View Full Code Here


        for(int i = 0; i <= TEST_RUNS; i++) {
            ByteArray key = getValidKey();
            VectorClock clock = (VectorClock) metadataStore.get(key, null).get(0).getVersion();

            Versioned<byte[]> value1 = new Versioned<byte[]>(getValidValue(key),
                                                             clock.incremented(1, 1));
            Versioned<byte[]> value2 = new Versioned<byte[]>(getValidValue(key),
                                                             clock.incremented(2, 1));

            metadataStore.put(key, value1, null);
            metadataStore.put(key, value2, null);
View Full Code Here

            VectorClock clock = (VectorClock) metadataStore.get(key, null).get(0).getVersion();

            Versioned<byte[]> value1 = new Versioned<byte[]>(getValidValue(key),
                                                             clock.incremented(1, 1));
            Versioned<byte[]> value2 = new Versioned<byte[]>(getValidValue(key),
                                                             clock.incremented(2, 1));

            metadataStore.put(key, value1, null);
            metadataStore.put(key, value2, null);

            assertEquals("Only one metadata value should return", 1, metadataStore.get(key, null)
View Full Code Here

        ByteArray key = new ByteArray(ByteUtils.getBytes(keyString, "UTF-8"));
        VectorClock current = (VectorClock) metadataStore.getVersions(key).get(0);

        metadataStore.put(keyString,
                          new Versioned<Object>(value,
                                                current.incremented(0, System.currentTimeMillis())));
    }
}
View Full Code Here

                // TODO: This will work for now but we should take a step back
                // and
                // think about a uniform clock for the metadata values.
                updatedClusterVersion = updatedClusterVersion.incremented(nodeIds.iterator().next(),
                                                                          System.currentTimeMillis());
                updatedStoresVersion = updatedStoresVersion.incremented(nodeIds.iterator().next(),
                                                                        System.currentTimeMillis());
            }
            adminClient.metadataMgmtOps.updateRemoteMetadataPair(nodeIds,
                                                                 MetadataStore.CLUSTER_KEY,
                                                                 Versioned.value(clusterValue.toString(),
View Full Code Here

            // Set the new store definition on the given nodeId
            updateRemoteMetadata(nodeId,
                                 MetadataStore.STORES_KEY,
                                 new Versioned<String>(storeMapper.writeStoreList(finalStoreDefList),
                                                       oldClock.incremented(nodeId, 1)));

        }

        /**
         * Helper method to fetch the current stores xml list and update the
View Full Code Here

                // get current version.
                VectorClock oldClock = (VectorClock) metadataMgmtOps.getRemoteStoreDefList(nodeId)
                                                                    .getVersion();

                Versioned<String> value = new Versioned<String>(storeMapper.writeStoreList(storeDefs),
                                                                oldClock.incremented(nodeId, 1));

                ByteArray keyBytes = new ByteArray(ByteUtils.getBytes(MetadataStore.STORES_KEY,
                                                                      "UTF-8"));
                Versioned<byte[]> valueBytes = new Versioned<byte[]>(ByteUtils.getBytes(value.getValue(),
                                                                                        "UTF-8"),
View Full Code Here

            node = nodes.get(currentNode);
            pipelineData.incrementNodeIndex();

            VectorClock versionedClock = (VectorClock) versioned.getVersion();
            final Versioned<byte[]> versionedCopy = new Versioned<byte[]>(versioned.getValue(),
                                                                          versionedClock.incremented(node.getId(),
                                                                                                     time.getMilliseconds()));

            if(logger.isDebugEnabled())
                logger.debug("Attempt #" + (currentNode + 1) + " to perform put (node "
                             + node.getId() + ")");
View Full Code Here

        for(Node slopFinalDestinationNode: pipelineData.getSynchronizer().getDelegatedSlopDestinations()) {
            int failedNodeId = slopFinalDestinationNode.getId();
            if(versionedCopy == null) {
                VectorClock clock = (VectorClock) versioned.getVersion();
                versionedCopy = new Versioned<byte[]>(versioned.getValue(),
                                                      clock.incremented(failedNodeId,
                                                                        time.getMilliseconds()));
            }

            Version version = versionedCopy.getVersion();
            if(logger.isTraceEnabled())
View Full Code Here

                updatedVersion = updatedVersion.merge((VectorClock) adminClient.metadataMgmtOps.getRemoteMetadata(nodeId,
                                                                                                                  metaKey)
                                                                                               .getVersion());
            }
            // Bump up version on first node
            updatedVersion = updatedVersion.incremented(nodeIds.iterator().next(),
                                                        System.currentTimeMillis());
        }
        adminClient.metadataMgmtOps.updateRemoteMetadata(nodeIds,
                                                         metaKey,
                                                         Versioned.value(metaValue, updatedVersion));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.