Search in sources :

Example 21 with StoreDefinitionBuilder

use of voldemort.store.StoreDefinitionBuilder in project voldemort by voldemort.

the class StoreRoutingPlanTest method setupNonContiguous.

@Before
public void setupNonContiguous() {
    Cluster z1z3Current = ClusterTestUtils.getZ1Z3ClusterWithNonContiguousNodeIds();
    HashMap<Integer, Integer> zoneRep211 = new HashMap<Integer, Integer>();
    zoneRep211.put(1, 2);
    zoneRep211.put(3, 2);
    StoreDefinition z1z3211StoreDef = new StoreDefinitionBuilder().setName("z1z3211").setType(BdbStorageConfiguration.TYPE_NAME).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.ZONE_STRATEGY).setReplicationFactor(4).setPreferredReads(1).setRequiredReads(1).setPreferredWrites(1).setRequiredWrites(1).setZoneCountReads(0).setZoneCountWrites(0).setZoneReplicationFactor(zoneRep211).setHintedHandoffStrategy(HintedHandoffStrategyType.PROXIMITY_STRATEGY).build();
    z1z3BaseRoutingPlan = new BaseStoreRoutingPlan(z1z3Current, z1z3211StoreDef);
    z1z3StoreRoutingPlan = new StoreRoutingPlan(z1z3Current, z1z3211StoreDef);
    // 3 zones
    Cluster z1z3z5Current = ClusterTestUtils.getZ1Z3Z5ClusterWithNonContiguousNodeIds();
    HashMap<Integer, Integer> zoneRep3zones211 = new HashMap<Integer, Integer>();
    zoneRep3zones211.put(1, 2);
    zoneRep3zones211.put(3, 2);
    zoneRep3zones211.put(5, 2);
    StoreDefinition z1z3z5211StoreDef = new StoreDefinitionBuilder().setName("z1z3z5211").setType(BdbStorageConfiguration.TYPE_NAME).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.ZONE_STRATEGY).setReplicationFactor(6).setPreferredReads(1).setRequiredReads(1).setPreferredWrites(1).setRequiredWrites(1).setZoneCountReads(0).setZoneCountWrites(0).setZoneReplicationFactor(zoneRep3zones211).setHintedHandoffStrategy(HintedHandoffStrategyType.PROXIMITY_STRATEGY).build();
    z1z3z5BaseRoutingPlan = new BaseStoreRoutingPlan(z1z3z5Current, z1z3z5211StoreDef);
    z1z3z5StoreRoutingPlan = new StoreRoutingPlan(z1z3z5Current, z1z3z5211StoreDef);
}
Also used : StoreDefinitionBuilder(voldemort.store.StoreDefinitionBuilder) HashMap(java.util.HashMap) StoreDefinition(voldemort.store.StoreDefinition) Cluster(voldemort.cluster.Cluster) SerializerDefinition(voldemort.serialization.SerializerDefinition) Before(org.junit.Before)

Example 22 with StoreDefinitionBuilder

use of voldemort.store.StoreDefinitionBuilder in project voldemort by voldemort.

the class ClusterTestUtils method getStoreDefsWithNonContiguousZones.

/*
     * Non contiguous storeDefs methods. This is the inner method that all
     * specific storeDef creation methods call.
     * 
     */
public static List<StoreDefinition> getStoreDefsWithNonContiguousZones(String storageType, String storeName, HashMap<Integer, Integer> zoneRep, int requiredReads, int requiredWrites, int zoneCountReads, int zoneCountWrites) {
    List<StoreDefinition> storeDefs = new LinkedList<StoreDefinition>();
    int totalReplicationFactor = 0;
    for (Integer value : zoneRep.values()) {
        totalReplicationFactor += value;
    }
    StoreDefinition storeDef = new StoreDefinitionBuilder().setName(storeName).setType(storageType).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.ZONE_STRATEGY).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setReplicationFactor(totalReplicationFactor).setZoneReplicationFactor(zoneRep).setRequiredReads(requiredReads).setRequiredWrites(requiredWrites).setZoneCountReads(zoneCountReads).setZoneCountWrites(zoneCountWrites).build();
    storeDefs.add(storeDef);
    return storeDefs;
}
Also used : StoreDefinitionBuilder(voldemort.store.StoreDefinitionBuilder) StoreDefinition(voldemort.store.StoreDefinition) LinkedList(java.util.LinkedList) SerializerDefinition(voldemort.serialization.SerializerDefinition)

Example 23 with StoreDefinitionBuilder

use of voldemort.store.StoreDefinitionBuilder in project voldemort by voldemort.

the class ClusterTestUtils method getZZ322StoreDefs.

public static List<StoreDefinition> getZZ322StoreDefs(String storageType) {
    List<StoreDefinition> storeDefs = new LinkedList<StoreDefinition>();
    HashMap<Integer, Integer> zoneRep322 = new HashMap<Integer, Integer>();
    zoneRep322.put(0, 3);
    zoneRep322.put(1, 3);
    StoreDefinition storeDef322 = new StoreDefinitionBuilder().setName("ZZ322").setType(storageType).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.ZONE_STRATEGY).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setReplicationFactor(6).setZoneReplicationFactor(zoneRep322).setRequiredReads(2).setRequiredWrites(2).setZoneCountReads(0).setZoneCountWrites(0).build();
    storeDefs.add(storeDef322);
    return storeDefs;
}
Also used : StoreDefinitionBuilder(voldemort.store.StoreDefinitionBuilder) HashMap(java.util.HashMap) StoreDefinition(voldemort.store.StoreDefinition) LinkedList(java.util.LinkedList) SerializerDefinition(voldemort.serialization.SerializerDefinition)

Example 24 with StoreDefinitionBuilder

use of voldemort.store.StoreDefinitionBuilder in project voldemort by voldemort.

the class ClusterTestUtils method getZZ322StoreDefsWithNonContiguousZoneIds.

public static List<StoreDefinition> getZZ322StoreDefsWithNonContiguousZoneIds(String storageType) {
    List<StoreDefinition> storeDefs = new LinkedList<StoreDefinition>();
    HashMap<Integer, Integer> zoneRep322 = new HashMap<Integer, Integer>();
    zoneRep322.put(0, 3);
    zoneRep322.put(2, 3);
    StoreDefinition storeDef322 = new StoreDefinitionBuilder().setName("ZZ322").setType(storageType).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.ZONE_STRATEGY).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setReplicationFactor(6).setZoneReplicationFactor(zoneRep322).setRequiredReads(2).setRequiredWrites(2).setZoneCountReads(0).setZoneCountWrites(0).build();
    storeDefs.add(storeDef322);
    return storeDefs;
}
Also used : StoreDefinitionBuilder(voldemort.store.StoreDefinitionBuilder) HashMap(java.util.HashMap) StoreDefinition(voldemort.store.StoreDefinition) LinkedList(java.util.LinkedList) SerializerDefinition(voldemort.serialization.SerializerDefinition)

Example 25 with StoreDefinitionBuilder

use of voldemort.store.StoreDefinitionBuilder in project voldemort by voldemort.

the class ClusterTestUtils method getZZ211StoreDefs.

public static List<StoreDefinition> getZZ211StoreDefs(String storageType) {
    List<StoreDefinition> storeDefs = new LinkedList<StoreDefinition>();
    HashMap<Integer, Integer> zoneRep211 = new HashMap<Integer, Integer>();
    zoneRep211.put(0, 2);
    zoneRep211.put(1, 2);
    StoreDefinition storeDef211 = new StoreDefinitionBuilder().setName("ZZ211").setType(storageType).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.ZONE_STRATEGY).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setReplicationFactor(4).setZoneReplicationFactor(zoneRep211).setRequiredReads(1).setRequiredWrites(1).setZoneCountReads(0).setZoneCountWrites(0).build();
    storeDefs.add(storeDef211);
    return storeDefs;
}
Also used : StoreDefinitionBuilder(voldemort.store.StoreDefinitionBuilder) HashMap(java.util.HashMap) StoreDefinition(voldemort.store.StoreDefinition) LinkedList(java.util.LinkedList) SerializerDefinition(voldemort.serialization.SerializerDefinition)

Aggregations

StoreDefinitionBuilder (voldemort.store.StoreDefinitionBuilder)57 SerializerDefinition (voldemort.serialization.SerializerDefinition)46 StoreDefinition (voldemort.store.StoreDefinition)42 HashMap (java.util.HashMap)28 ArrayList (java.util.ArrayList)27 Test (org.junit.Test)23 File (java.io.File)17 ByteArray (voldemort.utils.ByteArray)16 Cluster (voldemort.cluster.Cluster)13 StoreDefinitionsMapper (voldemort.xml.StoreDefinitionsMapper)12 LinkedList (java.util.LinkedList)10 List (java.util.List)9 VoldemortException (voldemort.VoldemortException)9 Node (voldemort.cluster.Node)8 IOException (java.io.IOException)7 Before (org.junit.Before)6 VoldemortTestConstants.getNineNodeCluster (voldemort.VoldemortTestConstants.getNineNodeCluster)6 AdminClient (voldemort.client.protocol.admin.AdminClient)6 Store (voldemort.store.Store)6 FileWriter (java.io.FileWriter)5