use of voldemort.store.StoreDefinitionBuilder in project voldemort by voldemort.
the class AdminServiceBasicTest method testUpdateSerializerFails.
@Test(expected = VoldemortException.class)
public void testUpdateSerializerFails() {
doClientOperation();
AdminClient client = getAdminClient();
List<StoreDefinition> originalStoreDefinitions = client.metadataMgmtOps.getRemoteStoreDefList(0).getValue();
StoreDefinition oldStore = getStoreDefinitionFromList(originalStoreDefinitions, "test-replication-memory");
// Create a store definition for an existing store with a different
// replication factor
List<StoreDefinition> storesToBeUpdatedList = new ArrayList<StoreDefinition>();
String storeName = "test-replication-memory";
StoreDefinition definitionNew = new StoreDefinitionBuilder().setName(storeName).setType(InMemoryStorageConfiguration.TYPE_NAME).setKeySerializer(new SerializerDefinition("changing-the-serializer")).setValueSerializer(oldStore.getValueSerializer()).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY).setReplicationFactor(2).setPreferredReads(1).setRequiredReads(1).setPreferredWrites(1).setRequiredWrites(1).build();
storesToBeUpdatedList.add(definitionNew);
updateAndResetStoreDefinitions(storesToBeUpdatedList);
doClientOperation();
}
use of voldemort.store.StoreDefinitionBuilder in project voldemort by voldemort.
the class E2EClientRequestExecutorPoolAndFailureDetectorTest method getStoreDef.
public static List<StoreDefinition> getStoreDef() {
List<StoreDefinition> defs = new ArrayList<StoreDefinition>();
SerializerDefinition serDef = new SerializerDefinition("string");
String storageConfiguration = SlowStorageConfiguration.TYPE_NAME;
defs.add(new StoreDefinitionBuilder().setName(STORE_NAME).setType(storageConfiguration).setKeySerializer(serDef).setValueSerializer(serDef).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY).setHintedHandoffStrategy(HintedHandoffStrategyType.PROXIMITY_STRATEGY).setReplicationFactor(3).setPreferredReads(1).setRequiredReads(1).setPreferredWrites(1).setRequiredWrites(1).build());
return defs;
}
use of voldemort.store.StoreDefinitionBuilder in project voldemort by voldemort.
the class ZonedRebalanceNonContiguousZonesTest method setUpRWStuff.
public void setUpRWStuff() throws IOException {
// First without replication
HashMap<Integer, Integer> zrfRWStoreWithoutReplication = new HashMap<Integer, Integer>();
zrfRWStoreWithoutReplication.put(1, 1);
zrfRWStoreWithoutReplication.put(3, 1);
rwStoreDefWithoutReplication = new StoreDefinitionBuilder().setName(testStoreNameRW).setType(BdbStorageConfiguration.TYPE_NAME).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.ZONE_STRATEGY).setReplicationFactor(2).setPreferredReads(1).setRequiredReads(1).setPreferredWrites(1).setRequiredWrites(1).setZoneCountReads(0).setZoneCountWrites(0).setZoneReplicationFactor(zrfRWStoreWithoutReplication).setHintedHandoffStrategy(HintedHandoffStrategyType.PROXIMITY_STRATEGY).build();
storeDefWithoutReplication = Lists.newArrayList(rwStoreDefWithoutReplication);
String storeDefWithoutReplicationString = new StoreDefinitionsMapper().writeStoreList(storeDefWithoutReplication);
File file = ServerTestUtils.createTempFile("two-stores-", ".xml");
FileUtils.writeStringToFile(file, storeDefWithoutReplicationString);
storeDefFileWithoutReplication = file.getAbsolutePath();
// Now with replication
HashMap<Integer, Integer> zrfRWStoreWithReplication = new HashMap<Integer, Integer>();
zrfRWStoreWithReplication.put(1, 2);
zrfRWStoreWithReplication.put(3, 2);
rwStoreDefWithReplication = new StoreDefinitionBuilder().setName(testStoreNameRW).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(zrfRWStoreWithReplication).setHintedHandoffStrategy(HintedHandoffStrategyType.PROXIMITY_STRATEGY).build();
rwStoreDefWithReplication2 = new StoreDefinitionBuilder().setName(testStoreNameRW2).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(zrfRWStoreWithReplication).setHintedHandoffStrategy(HintedHandoffStrategyType.PROXIMITY_STRATEGY).build();
file = ServerTestUtils.createTempFile("rw-stores-", ".xml");
FileUtils.writeStringToFile(file, new StoreDefinitionsMapper().writeStoreList(Lists.newArrayList(rwStoreDefWithReplication)));
rwStoreDefFileWithReplication = file.getAbsolutePath();
file = ServerTestUtils.createTempFile("rw-two-stores-", ".xml");
FileUtils.writeStringToFile(file, new StoreDefinitionsMapper().writeStoreList(Lists.newArrayList(rwStoreDefWithReplication, rwStoreDefWithReplication2)));
rwTwoStoreDefFileWithReplication = file.getAbsolutePath();
storeDefWithReplication = Lists.newArrayList(rwStoreDefWithReplication);
String storeDefWithReplicationString = new StoreDefinitionsMapper().writeStoreList(storeDefWithReplication);
file = ServerTestUtils.createTempFile("two-stores-", ".xml");
FileUtils.writeStringToFile(file, storeDefWithReplicationString);
storeDefFileWithReplication = file.getAbsolutePath();
}
use of voldemort.store.StoreDefinitionBuilder in project voldemort by voldemort.
the class AbstractZonedRebalanceTest method setUpRWStuff.
public void setUpRWStuff() throws IOException {
// First without replication
HashMap<Integer, Integer> zrfRWStoreWithoutReplication = new HashMap<Integer, Integer>();
zrfRWStoreWithoutReplication.put(0, 1);
zrfRWStoreWithoutReplication.put(1, 1);
rwStoreDefWithoutReplication = new StoreDefinitionBuilder().setName(testStoreNameRW).setType(BdbStorageConfiguration.TYPE_NAME).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.ZONE_STRATEGY).setReplicationFactor(2).setPreferredReads(1).setRequiredReads(1).setPreferredWrites(1).setRequiredWrites(1).setZoneCountReads(0).setZoneCountWrites(0).setZoneReplicationFactor(zrfRWStoreWithoutReplication).setHintedHandoffStrategy(HintedHandoffStrategyType.PROXIMITY_STRATEGY).build();
storeDefWithoutReplication = Lists.newArrayList(rwStoreDefWithoutReplication);
String storeDefWithoutReplicationString = new StoreDefinitionsMapper().writeStoreList(storeDefWithoutReplication);
File file = ServerTestUtils.createTempFile("two-stores-", ".xml");
FileUtils.writeStringToFile(file, storeDefWithoutReplicationString);
storeDefFileWithoutReplication = file.getAbsolutePath();
// Now with replication
HashMap<Integer, Integer> zrfRWStoreWithReplication = new HashMap<Integer, Integer>();
zrfRWStoreWithReplication.put(0, 2);
zrfRWStoreWithReplication.put(1, 2);
rwStoreDefWithReplication = new StoreDefinitionBuilder().setName(testStoreNameRW).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(zrfRWStoreWithReplication).setHintedHandoffStrategy(HintedHandoffStrategyType.PROXIMITY_STRATEGY).build();
rwStoreDefWithReplication2 = new StoreDefinitionBuilder().setName(testStoreNameRW2).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(zrfRWStoreWithReplication).setHintedHandoffStrategy(HintedHandoffStrategyType.PROXIMITY_STRATEGY).build();
file = ServerTestUtils.createTempFile("rw-stores-", ".xml");
FileUtils.writeStringToFile(file, new StoreDefinitionsMapper().writeStoreList(Lists.newArrayList(rwStoreDefWithReplication)));
rwStoreDefFileWithReplication = file.getAbsolutePath();
file = ServerTestUtils.createTempFile("rw-two-stores-", ".xml");
FileUtils.writeStringToFile(file, new StoreDefinitionsMapper().writeStoreList(Lists.newArrayList(rwStoreDefWithReplication, rwStoreDefWithReplication2)));
rwTwoStoreDefFileWithReplication = file.getAbsolutePath();
storeDefWithReplication = Lists.newArrayList(rwStoreDefWithReplication);
String storeDefWithReplicationString = new StoreDefinitionsMapper().writeStoreList(storeDefWithReplication);
file = ServerTestUtils.createTempFile("two-stores-", ".xml");
FileUtils.writeStringToFile(file, storeDefWithReplicationString);
storeDefFileWithReplication = file.getAbsolutePath();
}
use of voldemort.store.StoreDefinitionBuilder in project voldemort by voldemort.
the class RebalanceRebootstrapConsistencyTest method setUp.
@Before
public void setUp() throws Exception {
SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2, 10000, 100000, 32 * 1024);
int numServers = 2;
rwStoreDefWithReplication = new StoreDefinitionBuilder().setName(testStoreNameRW).setType(BdbStorageConfiguration.TYPE_NAME).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY).setReplicationFactor(2).setPreferredReads(1).setRequiredReads(1).setPreferredWrites(1).setRequiredWrites(1).build();
/*
* Bug fix: The old code was trying to rename a store during rebalance !
* God knows why Renaming it back to the original store name and
* changing other preferences (required reads = 2)
*/
rwStoreDefWithReplication2 = new StoreDefinitionBuilder().setName(testStoreNameRW).setType(BdbStorageConfiguration.TYPE_NAME).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY).setReplicationFactor(2).setPreferredReads(2).setRequiredReads(2).setPreferredWrites(1).setRequiredWrites(1).build();
List<StoreDefinition> storedefs = new ArrayList<StoreDefinition>();
storedefs.add(rwStoreDefWithReplication);
String storesXmlStr = new StoreDefinitionsMapper().writeStoreList(storedefs);
// create a temp file
File tempStoresXml = ServerTestUtils.createTempFile("tempfile", ".tmp");
BufferedWriter bw = new BufferedWriter(new FileWriter(tempStoresXml));
bw.write(storesXmlStr);
bw.close();
VoldemortServer[] voldemortServers = new VoldemortServer[numServers];
int[][] partitionMap = { { 0, 1 }, {} };
cluster = ServerTestUtils.startVoldemortCluster(numServers, voldemortServers, partitionMap, socketStoreFactory, false, null, tempStoresXml.getAbsolutePath(), new Properties());
servers = Lists.newArrayList();
for (int i = 0; i < numServers; ++i) {
servers.add(voldemortServers[i]);
}
socketUrl = voldemortServers[0].getIdentityNode().getSocketUrl().toString();
bootStrapUrls = new String[1];
bootStrapUrls[0] = socketUrl;
ClientConfig clientConfig = new ClientConfig();
clientConfig.setBootstrapUrls(bootStrapUrls).setClientZoneId(this.CLIENT_ZONE_ID);
SystemStoreClientFactory<String, String> systemStoreFactory = new SystemStoreClientFactory<String, String>(clientConfig);
sysVersionStore = systemStoreFactory.createSystemStore(SystemStoreConstants.SystemStoreName.voldsys$_metadata_version_persistence.name());
repository = new SystemStoreRepository(clientConfig);
repository.addSystemStore(sysVersionStore, SystemStoreConstants.SystemStoreName.voldsys$_metadata_version_persistence.name());
this.scheduler = new SchedulerService(2, SystemTime.INSTANCE, true);
Callable<Void> rebootstrapCallback = new Callable<Void>() {
@Override
public Void call() throws Exception {
// callbackForClusterChange();
checkConsistentMetadata();
return null;
}
};
// Starting the Version Metadata Manager
this.asyncCheckMetadata = new AsyncMetadataVersionManager(this.repository, rebootstrapCallback, null);
scheduler.schedule(asyncCheckMetadata.getClass().getName(), asyncCheckMetadata, new Date(), 500);
while (maxRetries < 3 && !asyncCheckMetadata.isActive) {
Thread.sleep(500);
maxRetries++;
}
}
Aggregations