use of org.apache.accumulo.core.clientImpl.ClientInfo in project accumulo by apache.
the class RestartIT method restartManagerSplit.
@Test
public void restartManagerSplit() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
final String tableName = getUniqueNames(1)[0];
final ClusterControl control = getCluster().getClusterControl();
c.tableOperations().create(tableName);
c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "5K");
VerifyParams params = new VerifyParams(getClientProps(), tableName, 10_000);
Future<Integer> ret = svc.submit(() -> {
try {
return control.exec(TestIngest.class, new String[] { "-c", cluster.getClientPropsPath(), "--rows", "" + params.rows, "--table", tableName });
} catch (Exception e) {
log.error("Error running TestIngest", e);
return -1;
}
});
control.stopAllServers(ServerType.MANAGER);
ClientInfo info = ClientInfo.from(c.properties());
ZooReader zreader = new ZooReader(info.getZooKeepers(), info.getZooKeepersSessionTimeOut());
ZooCache zcache = new ZooCache(zreader, null);
var zLockPath = ServiceLock.path(ZooUtil.getRoot(c.instanceOperations().getInstanceId()) + Constants.ZMANAGER_LOCK);
byte[] managerLockData;
do {
managerLockData = ServiceLock.getLockData(zcache, zLockPath, null);
if (managerLockData != null) {
log.info("Manager lock is still held");
Thread.sleep(1000);
}
} while (managerLockData != null);
cluster.start();
assertEquals(0, ret.get().intValue());
VerifyIngest.verifyIngest(c, params);
}
}
use of org.apache.accumulo.core.clientImpl.ClientInfo in project accumulo by apache.
the class RestartIT method restartManagerRecovery.
@Test
public void restartManagerRecovery() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
String tableName = getUniqueNames(1)[0];
c.tableOperations().create(tableName);
VerifyParams params = new VerifyParams(getClientProps(), tableName, 10_000);
TestIngest.ingest(c, params);
ClusterControl control = getCluster().getClusterControl();
// TODO implement a kill all too?
// cluster.stop() would also stop ZooKeeper
control.stopAllServers(ServerType.MANAGER);
control.stopAllServers(ServerType.TABLET_SERVER);
control.stopAllServers(ServerType.GARBAGE_COLLECTOR);
control.stopAllServers(ServerType.MONITOR);
ClientInfo info = ClientInfo.from(c.properties());
ZooReader zreader = new ZooReader(info.getZooKeepers(), info.getZooKeepersSessionTimeOut());
ZooCache zcache = new ZooCache(zreader, null);
var zLockPath = ServiceLock.path(ZooUtil.getRoot(c.instanceOperations().getInstanceId()) + Constants.ZMANAGER_LOCK);
byte[] managerLockData;
do {
managerLockData = ServiceLock.getLockData(zcache, zLockPath, null);
if (managerLockData != null) {
log.info("Manager lock is still held");
Thread.sleep(1000);
}
} while (managerLockData != null);
cluster.start();
sleepUninterruptibly(5, TimeUnit.MILLISECONDS);
control.stopAllServers(ServerType.MANAGER);
managerLockData = new byte[0];
do {
managerLockData = ServiceLock.getLockData(zcache, zLockPath, null);
if (managerLockData != null) {
log.info("Manager lock is still held");
Thread.sleep(1000);
}
} while (managerLockData != null);
cluster.start();
VerifyIngest.verifyIngest(c, params);
}
}
Aggregations