Examples of StoreDefinition


Examples of voldemort.store.StoreDefinition

            for(Node node: adminClient.getAdminClientCluster().getNodes()) {
                partitionIdList.addAll(node.getPartitionIds());
            }
        }

        StoreDefinition storeDefinition = null;
        for(String store: stores) {
            storeDefinition = storeDefinitionMap.get(store);

            if(null == storeDefinition) {

                System.out.println("No store found under the name \'" + store + "\'");
                continue;
            }

            Iterator<Pair<ByteArray, Versioned<byte[]>>> entriesIteratorRef = null;
            if(fetchOrphaned) {
                System.out.println("Fetching orphaned entries of " + store);
                entriesIteratorRef = adminClient.bulkFetchOps.fetchOrphanedEntries(nodeId, store);
            } else {
                System.out.println("Fetching entries in partitions "
                                   + Joiner.on(", ").join(partitionIdList) + " of " + store);
                entriesIteratorRef = adminClient.bulkFetchOps.fetchEntries(nodeId,
                                                                           store,
                                                                           partitionIdList,
                                                                           null,
                                                                           false);
            }

            final Iterator<Pair<ByteArray, Versioned<byte[]>>> entriesIterator = entriesIteratorRef;
            File outputFile = null;
            if(directory != null) {
                outputFile = new File(directory, store + ".entries");
            }

            if(useAscii) {
                // k-v serializer
                SerializerDefinition keySerializerDef = storeDefinition.getKeySerializer();
                SerializerDefinition valueSerializerDef = storeDefinition.getValueSerializer();
                SerializerFactory serializerFactory = new DefaultSerializerFactory();
                @SuppressWarnings("unchecked")
                final Serializer<Object> keySerializer = (Serializer<Object>) serializerFactory.getSerializer(keySerializerDef);
                @SuppressWarnings("unchecked")
                final Serializer<Object> valueSerializer = (Serializer<Object>) serializerFactory.getSerializer(valueSerializerDef);
View Full Code Here

Examples of voldemort.store.StoreDefinition

            for(Node node: adminClient.getAdminClientCluster().getNodes()) {
                partitionIdList.addAll(node.getPartitionIds());
            }
        }

        StoreDefinition storeDefinition = null;
        for(String store: stores) {
            storeDefinition = storeDefinitionMap.get(store);

            if(null == storeDefinition) {
                System.out.println("No store found under the name \'" + store + "\'");
                continue;
            }

            Iterator<ByteArray> keyIteratorRef = null;
            if(fetchOrphaned) {
                System.out.println("Fetching orphaned keys  of " + store);
                keyIteratorRef = adminClient.bulkFetchOps.fetchOrphanedKeys(nodeId, store);
            } else {
                System.out.println("Fetching keys in partitions "
                                   + Joiner.on(", ").join(partitionIdList) + " of " + store);
                keyIteratorRef = adminClient.bulkFetchOps.fetchKeys(nodeId,
                                                                    store,
                                                                    partitionIdList,
                                                                    null,
                                                                    false);
            }
            File outputFile = null;
            if(directory != null) {
                outputFile = new File(directory, store + ".keys");
            }
            final Iterator<ByteArray> keyIterator = keyIteratorRef;
            if(useAscii) {
                final SerializerDefinition serializerDef = storeDefinition.getKeySerializer();
                final SerializerFactory serializerFactory = new DefaultSerializerFactory();
                @SuppressWarnings("unchecked")
                final Serializer<Object> serializer = (Serializer<Object>) serializerFactory.getSerializer(serializerDef);

                final CompressionStrategy keysCompressionStrategy;
View Full Code Here

Examples of voldemort.store.StoreDefinition

        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

        // iterate through stores
        for(final String storeName: storeNames) {
            // store definition
            StoreDefinition storeDefinition = storeDefinitions.get(storeName);
            if(storeDefinition == null) {
                throw new StoreNotFoundException("Store " + storeName + " not found");
            }

            out.write("STORE_NAME: " + storeDefinition.getName() + "\n");

            // k-v serializer
            final SerializerDefinition keySerializerDef = storeDefinition.getKeySerializer();
            final SerializerDefinition valueSerializerDef = storeDefinition.getValueSerializer();
            SerializerFactory serializerFactory = new DefaultSerializerFactory();
            @SuppressWarnings("unchecked")
            final Serializer<Object> keySerializer = (Serializer<Object>) serializerFactory.getSerializer(keySerializerDef);
            @SuppressWarnings("unchecked")
            final Serializer<Object> valueSerializer = (Serializer<Object>) serializerFactory.getSerializer(valueSerializerDef);
View Full Code Here

Examples of voldemort.store.StoreDefinition

                                               List<String> keyList) throws DecoderException {

        Cluster cluster = adminClient.getAdminClientCluster();
        List<StoreDefinition> storeDefs = adminClient.metadataMgmtOps.getRemoteStoreDefList()
                                                                     .getValue();
        StoreDefinition storeDef = StoreDefinitionUtils.getStoreDefinitionWithName(storeDefs,
                                                                                   storeName);
        StoreRoutingPlan routingPlan = new StoreRoutingPlan(cluster, storeDef);
        BaseStoreRoutingPlan bRoutingPlan = new BaseStoreRoutingPlan(cluster, storeDef);

        final int COLUMN_WIDTH = 30;

        for(String keyStr: keyList) {
            byte[] key = ByteUtils.fromHexString(keyStr);
            System.out.println("Key :" + keyStr);
            System.out.println("Replicating Partitions :"
                               + routingPlan.getReplicatingPartitionList(key));
            System.out.println("Replicating Nodes :");
            List<Integer> nodeList = routingPlan.getReplicationNodeList(routingPlan.getMasterPartitionId(key));
            for(int i = 0; i < nodeList.size(); i++) {
                System.out.println(nodeList.get(i) + "\t"
                                   + cluster.getNodeById(nodeList.get(i)).getHost());
            }

            System.out.println("Zone Nary information :");
            HashMap<Integer, Integer> zoneRepMap = storeDef.getZoneReplicationFactor();

            for(Zone zone: cluster.getZones()) {
                System.out.println("\tZone #" + zone.getId());
                int numReplicas = -1;
                if(zoneRepMap == null) {
                    // non zoned cluster
                    numReplicas = storeDef.getReplicationFactor();
                } else {
                    // zoned cluster
                    if(!zoneRepMap.containsKey(zone.getId())) {
                        Utils.croak("Repfactor for Zone " + zone.getId() + " not found in storedef");
                    }
View Full Code Here

Examples of voldemort.store.StoreDefinition

        ArrayList<ByteArray> keysHashedToPar0 = new ArrayList<ByteArray>();

        // find store
        Versioned<List<StoreDefinition>> storeDefinitions = adminClient.metadataMgmtOps.getRemoteStoreDefList(0);
        List<StoreDefinition> StoreDefitions = storeDefinitions.getValue();
        StoreDefinition storeDefinition = null;
        for(StoreDefinition def: StoreDefitions) {
            if(def.getName().equals(STORE_NAME)) {
                storeDefinition = def;
                break;
            }
View Full Code Here

Examples of voldemort.store.StoreDefinition

    public void testMissingKeysAreAddedToNodeWhenDoingReadRepair() throws Exception {
        ByteArray key = TestUtils.toByteArray("key");
        byte[] value = "foo".getBytes();

        Cluster cluster = VoldemortTestConstants.getThreeNodeCluster();
        StoreDefinition storeDef = ServerTestUtils.getStoreDef("test",
                                                               3,
                                                               3,
                                                               3,
                                                               2,
                                                               2,
View Full Code Here

Examples of voldemort.store.StoreDefinition

        // routing strategy

        StoreDefinitionsMapper mapper = new StoreDefinitionsMapper();
        List<StoreDefinition> storeDefs = mapper.readStoreList(new StringReader(VoldemortTestConstants.getTwoStoresWithZonesXml()));

        StoreDefinition consistentStore = storeDefs.get(0);
        StoreDefinition zoneStore = storeDefs.get(1);

        assertEquals(consistentStore.getName(), "cstore");
        assertEquals(zoneStore.getName(), "zstore");

        Cluster cluster = VoldemortTestConstants.getEightNodeClusterWithZones();
        RoutingStrategy cStrategy = new RoutingStrategyFactory().updateRoutingStrategy(consistentStore,
                                                                                       cluster);
        RoutingStrategy zStrategy = new RoutingStrategyFactory().updateRoutingStrategy(zoneStore,
View Full Code Here

Examples of voldemort.store.StoreDefinition

    }

    @Test
    public void testPartitionScan() {

        StoreDefinition storedef = TestUtils.makeStoreDefinition("storeA");
        RoutingStrategy strategy = TestUtils.makeSingleNodeRoutingStrategy();
        BdbStorageEngine prefixedBdbStore = (BdbStorageEngine) bdbStorage.getStore(storedef,
                                                                                   strategy);
        try {
            // insert a bunch of records
View Full Code Here

Examples of voldemort.store.StoreDefinition

            voldemortConfig.setBdbOneEnvPerStore(true);
            voldemortConfig.setBdbDataDirectory(bdbMasterDir.toURI().getPath());
            voldemortConfig.setBdbPrefixKeysWithPartitionId(prefixPartitionId);

            bdbStorage = new BdbStorageConfiguration(voldemortConfig);
            StoreDefinition defA = TestUtils.makeStoreDefinition("storeA",
                                                                 shareA / (ByteUtils.BYTES_PER_MB));
            storeA = (BdbStorageEngine) bdbStorage.getStore(defA,
                                                            TestUtils.makeSingleNodeRoutingStrategy());

            StoreDefinition defB = TestUtils.makeStoreDefinition("storeB",
                                                                 shareB / (ByteUtils.BYTES_PER_MB));
            storeB = (BdbStorageEngine) bdbStorage.getStore(defB,
                                                            TestUtils.makeSingleNodeRoutingStrategy());

            StoreDefinition defC = TestUtils.makeStoreDefinition("storeC");
            storeC = (BdbStorageEngine) bdbStorage.getStore(defC,
                                                            TestUtils.makeSingleNodeRoutingStrategy());

            // before any traffic, the cache will not have grown
            assertTrue("Store A grew without traffic",
View Full Code Here

Examples of voldemort.store.StoreDefinition

        BdbStorageEngine storeA = null;
        bdbStorage = new BdbStorageConfiguration(voldemortConfig);
        assertEquals("Reserved cache size not zero", 0, bdbStorage.getReservedCacheSize());

        try {
            StoreDefinition defA = TestUtils.makeStoreDefinition("storeA", shareA
                                                                           / ByteUtils.BYTES_PER_MB);
            storeA = (BdbStorageEngine) bdbStorage.getStore(defA,
                                                            TestUtils.makeSingleNodeRoutingStrategy());
            fail("Should have thrown exception since minSharedCache will be violated");
        } catch(StorageInitializationException sie) {
            // should come here.
        }
        // failing operations should not alter reserved cache size
        assertEquals("failure somehow altered the reservedCacheSize",
                     0,
                     bdbStorage.getReservedCacheSize());

        voldemortConfig.setBdbMinimumSharedCache(10 * ByteUtils.BYTES_PER_MB);
        bdbStorage = new BdbStorageConfiguration(voldemortConfig);
        try {
            StoreDefinition defA = TestUtils.makeStoreDefinition("storeA", shareA
                                                                           / ByteUtils.BYTES_PER_MB);
            storeA = (BdbStorageEngine) bdbStorage.getStore(defA,
                                                            TestUtils.makeSingleNodeRoutingStrategy());
        } catch(StorageInitializationException sie) {
            // should not come here.
            fail("minSharedCache should n't have been violated");
        }
        assertEquals("store A's share does not match up with reserved cache size",
                     shareA,
                     bdbStorage.getReservedCacheSize());

        long reserveCacheSize = bdbStorage.getReservedCacheSize();
        // now, try increasing the reservation dynamically and it should fail
        try {
            StoreDefinition defA = TestUtils.makeStoreDefinition("storeA", 15);
            bdbStorage.update(defA);
            fail("Should have thrown exception since minSharedCache will be violated");
        } catch(StorageInitializationException sie) {
            // should come here.
        }
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.