use of voldemort.store.socket.SocketStoreFactory in project voldemort by voldemort.
the class AbstractZoneAffinityTest method tearDown.
@After
public void tearDown() throws IOException {
client.close();
for (VoldemortServer vs : this.vservers.values()) {
ServerTestUtils.stopVoldemortServer(vs);
}
for (SocketStoreFactory ssf : this.socketStoreFactories.values()) {
ssf.close();
}
ClusterTestUtils.reset();
}
use of voldemort.store.socket.SocketStoreFactory in project voldemort by voldemort.
the class AbstractZoneAffinityTest method setup.
@Before
public void setup() throws IOException {
byte[] v1_bytes = { (byte) 'V', (byte) '1' };
byte[] v2_bytes = { (byte) 'V', (byte) '2' };
byte[] k1_bytes = { (byte) 'K', (byte) '1' };
byte[] k2_bytes = { (byte) 'K', (byte) '2' };
byte[] k3_bytes = { (byte) 'K', (byte) '3' };
clientConfig = new ClientConfig();
clientConfig.setBootstrapUrls(cluster.getNodes().iterator().next().getSocketUrl().toString());
clientConfig.setClientZoneId(clientZoneId);
setupZoneAffinitySettings();
SocketStoreClientFactory socketStoreClientFactory = new SocketStoreClientFactory(clientConfig);
for (Integer nodeId : cluster.getNodeIds()) {
SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2, 10000, 100000, 1024);
VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, nodeId, TestUtils.createTempDir().getAbsolutePath(), cluster, stores, new Properties());
VoldemortServer vs = ServerTestUtils.startVoldemortServer(socketStoreFactory, config, cluster);
vservers.put(nodeId, vs);
socketStoreFactories.put(nodeId, socketStoreFactory);
Store<ByteArray, byte[], byte[]> store = vs.getStoreRepository().getLocalStore(storeDef.getName());
Node node = cluster.getNodeById(nodeId);
VectorClock version1 = new VectorClock();
version1.incrementVersion(0, System.currentTimeMillis());
VectorClock version2 = version1.incremented(0, System.currentTimeMillis());
if (node.getZoneId() == clientZoneId) {
// local zone
store.put(new ByteArray(k1_bytes), new Versioned<byte[]>(v1_bytes, version1), null);
store.put(new ByteArray(k2_bytes), new Versioned<byte[]>(v1_bytes, version1), null);
} else {
// remote zone
store.put(new ByteArray(k1_bytes), new Versioned<byte[]>(v2_bytes, version2), null);
store.put(new ByteArray(k2_bytes), new Versioned<byte[]>(v1_bytes, version1), null);
store.put(new ByteArray(k3_bytes), new Versioned<byte[]>(v1_bytes, version1), null);
}
}
client = socketStoreClientFactory.getRawStore(storeDef.getName(), null);
}
use of voldemort.store.socket.SocketStoreFactory in project voldemort by voldemort.
the class QuotaOperationsTest method setup.
@Before
public void setup() throws IOException {
// setup cluster
cluster = ServerTestUtils.getLocalCluster(2);
stores = ServerTestUtils.getStoreDefs(2);
bsURL = cluster.getNodes().iterator().next().getSocketUrl().toString();
for (Node node : cluster.getNodes()) {
SocketStoreFactory ssf = new ClientRequestExecutorPool(2, 10000, 100000, 1024);
VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, node.getId(), TestUtils.createTempDir().getAbsolutePath(), cluster, stores, new Properties());
VoldemortServer vs = ServerTestUtils.startVoldemortServer(ssf, config, cluster);
vservers.put(node.getId(), vs);
socketStoreFactories.put(node.getId(), ssf);
}
adminClient = new AdminClient(cluster);
storeName = stores.iterator().next().getName();
}
use of voldemort.store.socket.SocketStoreFactory in project voldemort by voldemort.
the class ClusterForkLiftToolTest method setUpClusters.
@Before
public void setUpClusters() {
// setup four nodes with one store and one partition
final SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2, 10000, 100000, 32 * 1024);
try {
int[][] srcPartitionMap = { { 0 }, { 1 }, { 2 }, { 3 } };
srcServers = new VoldemortServer[4];
srcCluster = ServerTestUtils.startVoldemortCluster(4, srcServers, srcPartitionMap, socketStoreFactory, true, null, SRC_STORES_XML, new Properties());
Node node = srcCluster.getNodeById(0);
srcBootStrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();
int[][] dstPartitionMap = { { 0 }, { 1 }, { 2 } };
dstServers = new VoldemortServer[3];
dstCluster = ServerTestUtils.startVoldemortCluster(3, dstServers, dstPartitionMap, socketStoreFactory, true, null, DST_STORES_XML, new Properties());
node = dstCluster.getNodeById(0);
dstBootStrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();
kvPairs = ServerTestUtils.createRandomKeyValueString(100);
int keyCount = 0;
for (String key : kvPairs.keySet()) {
if (keyCount == 0)
firstKey = key;
if (keyCount == kvPairs.size() - 1)
lastKey = key;
if (keyCount == kvPairs.size() / 2)
conflictKey = key;
keyCount++;
}
srcAdminClient = new AdminClient(srcCluster);
List<StoreDefinition> storeDefs = new StoreDefinitionsMapper().readStoreList(new File(SRC_STORES_XML));
primaryResolvingStoreDef = StoreUtils.getStoreDef(storeDefs, PRIMARY_RESOLVING_STORE_NAME);
globallyResolvingStoreDef = StoreUtils.getStoreDef(storeDefs, GLOBALLY_RESOLVING_STORE_NAME);
nonResolvingStoreDef = StoreUtils.getStoreDef(storeDefs, MULTIPLE_VERSIONS_STORE_NAME);
srcfactory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(srcBootStrapUrl).setSelectors(1).setRoutingTimeout(1000, java.util.concurrent.TimeUnit.MILLISECONDS).setSocketTimeout(1000, java.util.concurrent.TimeUnit.MILLISECONDS).setConnectionTimeout(1000, java.util.concurrent.TimeUnit.MILLISECONDS).setMaxConnectionsPerNode(1));
srcPrimaryResolvingStoreClient = srcfactory.getStoreClient(PRIMARY_RESOLVING_STORE_NAME);
srcGloballyResolvingStoreClient = srcfactory.getStoreClient(GLOBALLY_RESOLVING_STORE_NAME);
dstfactory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(dstBootStrapUrl).setSelectors(1).setRoutingTimeout(1000, java.util.concurrent.TimeUnit.MILLISECONDS).setSocketTimeout(1000, java.util.concurrent.TimeUnit.MILLISECONDS).setConnectionTimeout(1000, java.util.concurrent.TimeUnit.MILLISECONDS).setMaxConnectionsPerNode(1));
dstPrimaryResolvingStoreClient = dstfactory.getStoreClient(PRIMARY_RESOLVING_STORE_NAME);
dstGloballyResolvingStoreClient = dstfactory.getStoreClient(GLOBALLY_RESOLVING_STORE_NAME);
} catch (IOException e) {
e.printStackTrace();
fail("Unexpected exception");
}
}
use of voldemort.store.socket.SocketStoreFactory in project voldemort by voldemort.
the class MetaOperationsTest method setup.
@Before
public void setup() throws IOException {
// setup cluster
cluster = ServerTestUtils.getLocalCluster(2);
stores = ServerTestUtils.getStoreDefs(2);
bsURL = cluster.getNodes().iterator().next().getSocketUrl().toString();
for (Node node : cluster.getNodes()) {
SocketStoreFactory ssf = new ClientRequestExecutorPool(2, 10000, 100000, 1024);
VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, node.getId(), TestUtils.createTempDir().getAbsolutePath(), cluster, stores, new Properties());
VoldemortServer vs = ServerTestUtils.startVoldemortServer(ssf, config, cluster);
vservers.put(node.getId(), vs);
socketStoreFactories.put(node.getId(), ssf);
}
adminClient = new AdminClient(cluster);
}
Aggregations