Package voldemort.store

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


                                               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

        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

    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

        // 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

    }

    @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

            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

        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

        voldemortConfig.setBdbDataDirectory(bdbMasterDir.toURI().getPath());
        voldemortConfig.setBdbMinimumSharedCache(5 * ByteUtils.BYTES_PER_MB);
        voldemortConfig.setBdbPrefixKeysWithPartitionId(prefixPartitionId);

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

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

        // load data into the stores; each store is guaranteed to be ~ 40MB.
        // Data won't fit in memory
View Full Code Here

        String inputDir = args[3];
        String outputDir = args[4];

        List<StoreDefinition> storeDefs = new StoreDefinitionsMapper().readStoreList(new File(configDir,
                                                                                              "stores.xml"));
        StoreDefinition def = null;
        for(StoreDefinition d: storeDefs)
            if(d.getName().equals(storeName))
                def = d;
        Cluster cluster = new ClusterMapper().readCluster(new File(configDir, "cluster.xml"));
View Full Code Here

TOP

Related Classes of voldemort.store.StoreDefinition

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.