use of org.apache.accumulo.core.client.admin.InstanceOperations in project accumulo by apache.
the class SplitIT method alterConfig.
@Before
public void alterConfig() throws Exception {
Assume.assumeTrue(ClusterType.MINI == getClusterType());
InstanceOperations iops = getConnector().instanceOperations();
Map<String, String> config = iops.getSystemConfiguration();
tservMaxMem = config.get(Property.TSERV_MAXMEM.getKey());
tservMajcDelay = config.get(Property.TSERV_MAJC_DELAY.getKey());
if (!tservMajcDelay.equals("100ms")) {
iops.setProperty(Property.TSERV_MAJC_DELAY.getKey(), "100ms");
}
// Property.TSERV_MAXMEM can't be altered on a running server
boolean restarted = false;
if (!tservMaxMem.equals("5K")) {
iops.setProperty(Property.TSERV_MAXMEM.getKey(), "5K");
getCluster().getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
getCluster().getClusterControl().startAllServers(ServerType.TABLET_SERVER);
restarted = true;
}
// If we restarted the tservers, we don't need to re-wait for the majc delay
if (!restarted) {
long millis = ConfigurationTypeHelper.getTimeInMillis(tservMajcDelay);
log.info("Waiting for majc delay period: {}ms", millis);
Thread.sleep(millis);
log.info("Finished waiting for majc delay period");
}
}
use of org.apache.accumulo.core.client.admin.InstanceOperations in project accumulo by apache.
the class BadDeleteMarkersCreatedIT method alterConfig.
@Before
public void alterConfig() throws Exception {
InstanceOperations iops = getConnector().instanceOperations();
Map<String, String> config = iops.getSystemConfiguration();
gcCycleDelay = config.get(Property.GC_CYCLE_DELAY.getKey());
gcCycleStart = config.get(Property.GC_CYCLE_START.getKey());
iops.setProperty(Property.GC_CYCLE_DELAY.getKey(), "1s");
iops.setProperty(Property.GC_CYCLE_START.getKey(), "0s");
log.info("Restarting garbage collector");
getCluster().getClusterControl().stopAllServers(ServerType.GARBAGE_COLLECTOR);
Instance instance = getConnector().getInstance();
ZooCache zcache = new ZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
zcache.clear();
String path = ZooUtil.getRoot(instance) + Constants.ZGC_LOCK;
byte[] gcLockData;
do {
gcLockData = ZooLock.getLockData(zcache, path, null);
if (null != gcLockData) {
log.info("Waiting for GC ZooKeeper lock to expire");
Thread.sleep(2000);
}
} while (null != gcLockData);
log.info("GC lock was lost");
getCluster().getClusterControl().startAllServers(ServerType.GARBAGE_COLLECTOR);
log.info("Garbage collector was restarted");
gcLockData = null;
do {
gcLockData = ZooLock.getLockData(zcache, path, null);
if (null == gcLockData) {
log.info("Waiting for GC ZooKeeper lock to be acquired");
Thread.sleep(2000);
}
} while (null == gcLockData);
log.info("GC lock was acquired");
}
use of org.apache.accumulo.core.client.admin.InstanceOperations in project accumulo by apache.
the class CompactionIT method resetConfig.
@After
public void resetConfig() throws Exception {
// We set the values..
if (null != majcThreadMaxOpen) {
InstanceOperations iops = getConnector().instanceOperations();
iops.setProperty(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey(), majcThreadMaxOpen);
iops.setProperty(Property.TSERV_MAJC_DELAY.getKey(), majcDelay);
iops.setProperty(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), majcMaxConcurrent);
getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
getClusterControl().startAllServers(ServerType.TABLET_SERVER);
}
}
use of org.apache.accumulo.core.client.admin.InstanceOperations in project accumulo by apache.
the class CompactionIT method alterConfig.
@Before
public void alterConfig() throws Exception {
if (ClusterType.STANDALONE == getClusterType()) {
InstanceOperations iops = getConnector().instanceOperations();
Map<String, String> config = iops.getSystemConfiguration();
majcThreadMaxOpen = config.get(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey());
majcDelay = config.get(Property.TSERV_MAJC_DELAY.getKey());
majcMaxConcurrent = config.get(Property.TSERV_MAJC_MAXCONCURRENT.getKey());
iops.setProperty(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey(), "4");
iops.setProperty(Property.TSERV_MAJC_DELAY.getKey(), "1");
iops.setProperty(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), "1");
getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
getClusterControl().startAllServers(ServerType.TABLET_SERVER);
}
}
use of org.apache.accumulo.core.client.admin.InstanceOperations in project accumulo by apache.
the class Admin method ping.
private static int ping(ClientContext context, List<String> args) throws AccumuloException, AccumuloSecurityException {
InstanceOperations io = context.getConnector().instanceOperations();
if (args.size() == 0) {
args = io.getTabletServers();
}
int unreachable = 0;
for (String tserver : args) {
try {
io.ping(tserver);
System.out.println(tserver + " OK");
} catch (AccumuloException ae) {
System.out.println(tserver + " FAILED (" + ae.getMessage() + ")");
unreachable++;
}
}
System.out.printf("\n%d of %d tablet servers unreachable\n\n", unreachable, args.size());
return unreachable;
}
Aggregations