use of voldemort.server.VoldemortServer in project voldemort by voldemort.
the class ServerTestUtils method waitForSlopDrain.
public static void waitForSlopDrain(Map<Integer, VoldemortServer> vservers, Long slopDrainTimoutMs) throws InterruptedException {
long timeStart = System.currentTimeMillis();
boolean allSlopsEmpty = false;
while (System.currentTimeMillis() < timeStart + slopDrainTimoutMs) {
allSlopsEmpty = true;
for (Integer nodeId : vservers.keySet()) {
VoldemortServer vs = vservers.get(nodeId);
SlopStorageEngine sse = vs.getStoreRepository().getSlopStore();
ClosableIterator<ByteArray> keys = sse.keys();
long count = 0;
while (keys.hasNext()) {
keys.next();
count++;
}
keys.close();
if (count > 0) {
allSlopsEmpty = false;
logger.info(String.format("Slop engine for node %d is not yet empty with %d slops\n", nodeId, count));
}
}
if (allSlopsEmpty) {
break;
}
Thread.sleep(1000);
}
if (!allSlopsEmpty) {
throw new RuntimeException("Timeout while waiting for all slops to drain");
}
}
use of voldemort.server.VoldemortServer in project voldemort by voldemort.
the class RebootstrappingStoreTest method setUp.
@Before
public void setUp() throws Exception {
SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2, 10000, 100000, 32 * 1024);
int numServers = 2;
VoldemortServer[] voldemortServers = new VoldemortServer[numServers];
int[][] partitionMap = { { 0, 1 }, {} };
cluster = ServerTestUtils.startVoldemortCluster(numServers, voldemortServers, partitionMap, socketStoreFactory, false, null, STORES_XML, new Properties());
servers = Lists.newArrayList();
for (int i = 0; i < numServers; ++i) {
servers.add(voldemortServers[i]);
}
String bootstrapUrl = cluster.getNodeById(0).getSocketUrl().toString();
storeClient = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl)).getStoreClient(STORE_NAME);
Map<String, String> entries = Maps.newHashMap();
entries.put("a", "1");
entries.put("b", "2");
for (Map.Entry<String, String> entry : entries.entrySet()) storeClient.put(entry.getKey(), entry.getValue());
}
use of voldemort.server.VoldemortServer in project voldemort by voldemort.
the class RedirectingStoreTest method startServer.
private VoldemortServer startServer(int node, String storesXmlfile, Cluster cluster) throws IOException {
VoldemortConfig config = ServerTestUtils.createServerConfig(useNio, node, TestUtils.createTempDir().getAbsolutePath(), null, storesXmlfile, new Properties());
// enable metadata checking for this test.
config.setEnableMetadataChecking(true);
config.setEnableRebalanceService(false);
VoldemortServer server = new VoldemortServer(config, cluster);
server.start();
return server;
}
use of voldemort.server.VoldemortServer in project voldemort by voldemort.
the class VersionedPutPruneJobTest method setup.
@Before
public void setup() throws Exception {
socketStoreMap = new HashMap<Integer, Store<ByteArray, byte[], byte[]>>();
socketStoreFactory = new ClientRequestExecutorPool(2, 10000, 100000, 32 * 1024);
final int numServers = 4;
servers = new VoldemortServer[numServers];
int[][] currentPartitionMap = { { 0, 4 }, { 2, 6 }, { 1, 5 }, { 3, 7 } };
cluster = ServerTestUtils.startVoldemortCluster(numServers, servers, currentPartitionMap, socketStoreFactory, true, null, "test/common/voldemort/config/single-store-322.xml", new Properties());
StringReader reader = new StringReader(VoldemortTestConstants.getSingleStore322Xml());
StoreDefinition storeDef = new StoreDefinitionsMapper().readStoreList(reader).get(0);
currentRoutingPlan = new BaseStoreRoutingPlan(cluster, storeDef);
String bootStrapUrl = "";
for (VoldemortServer server : servers) {
Node node = server.getIdentityNode();
socketStoreMap.put(node.getId(), ServerTestUtils.getSocketStore(socketStoreFactory, "test", node.getHost(), node.getSocketPort(), RequestFormatType.PROTOCOL_BUFFERS, false, true));
bootStrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();
}
testEntries = ServerTestUtils.createRandomKeyValueString(100);
int[][] oldPartitionMap = { { 3, 6 }, { 1, 4 }, { 7, 2 }, { 5, 0 } };
oldRoutingPlan = new BaseStoreRoutingPlan(ServerTestUtils.getLocalCluster(numServers, oldPartitionMap), storeDef);
SocketStoreClientFactory factory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootStrapUrl));
storeClient = factory.getStoreClient("test");
}
use of voldemort.server.VoldemortServer in project voldemort by voldemort.
the class ServerSideRoutingTest method startServer.
private VoldemortServer startServer(boolean useNio, int node, String storesXmlfile, Cluster cluster, boolean metadataChecking) throws IOException {
VoldemortConfig config = ServerTestUtils.createServerConfig(useNio, node, TestUtils.createTempDir().getAbsolutePath(), null, storesXmlfile, new Properties());
if (metadataChecking)
config.setEnableMetadataChecking(true);
else
config.setEnableMetadataChecking(false);
// set server side routing true.
config.setEnableServerRouting(true);
VoldemortServer server = new VoldemortServer(config, cluster);
server.start();
return server;
}
Aggregations