@Override public Boolean call() throws Exception { c.instanceOperations().waitForBalance(); return true; } });
/** * Gets the TabletServers. * * @return A list of Strings of TabletServers. * @throws StoreException If failure. */ public List<String> getTabletServers() throws StoreException { return getConnection().instanceOperations().getTabletServers(); }
@Override public void removePeer(final String name) throws AccumuloException, AccumuloSecurityException, PeerNotFoundException { requireNonNull(name); context.getConnector().instanceOperations() .removeProperty(Property.REPLICATION_PEERS.getKey() + name); }
@Override public boolean testClassLoad(ByteBuffer login, String className, String asTypeName) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, TException { try { return getConnector(login).instanceOperations().testClassLoad(className, asTypeName); } catch (Exception e) { handleException(e); return false; } }
@Override public List<String> getTabletServers(ByteBuffer login) throws TException { try { return getConnector(login).instanceOperations().getTabletServers(); } catch (Exception e) { throw new TException(e); } }
@Override public void pingTabletServer(ByteBuffer login, String tserver) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, TException { try { getConnector(login).instanceOperations().ping(tserver); } catch (Exception e) { handleException(e); } }
@Before public void alterConfig() throws Exception { InstanceOperations iops = getConnector().instanceOperations(); Map<String,String> sysConfig = iops.getSystemConfiguration(); scanMaxOpenFiles = sysConfig.get(Property.TSERV_SCAN_MAX_OPENFILES.getKey()); majcConcurrent = sysConfig.get(Property.TSERV_MAJC_MAXCONCURRENT.getKey()); majcThreadMaxOpen = sysConfig.get(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey()); }
public static boolean shouldQueueOperation(State state, Environment env) throws Exception { final ThreadPoolExecutor pool = (ThreadPoolExecutor) state.get("pool"); long queuedThreads = pool.getTaskCount() - pool.getActiveCount() - pool.getCompletedTaskCount(); final Connector conn = env.getConnector(); int numTservers = conn.instanceOperations().getTabletServers().size(); if (!shouldQueue(queuedThreads, numTservers)) { log.info("Not queueing because of " + queuedThreads + " outstanding tasks"); return false; } return true; }
@Override public Map<String,String> getSystemConfiguration(ByteBuffer login) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, TException { try { return getConnector(login).instanceOperations().getSystemConfiguration(); } catch (Exception e) { handleException(e); return null; } }
@Override public void setProperty(ByteBuffer login, String property, String value) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, TException { try { getConnector(login).instanceOperations().setProperty(property, value); } catch (Exception e) { handleException(e); } }
@Before public void updateMajcDelay() throws Exception { Connector c = getConnector(); majcDelay = c.instanceOperations().getSystemConfiguration() .get(Property.TSERV_MAJC_DELAY.getKey()); c.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), "100ms"); if (getClusterType() == ClusterType.STANDALONE) { Thread.sleep(AccumuloConfiguration.getTimeInMillis(majcDelay)); } }
@Before public void reduceSessionIdle() throws Exception { InstanceOperations ops = getConnector().instanceOperations(); sessionIdle = ops.getSystemConfiguration().get(Property.TSERV_SESSION_MAXIDLE.getKey()); ops.setProperty(Property.TSERV_SESSION_MAXIDLE.getKey(), getMaxIdleTimeString()); log.info("Waiting for existing session idle time to expire"); Thread.sleep(AccumuloConfiguration.getTimeInMillis(sessionIdle)); log.info("Finished waiting"); }
@Test(expected = AccumuloException.class) public void testNoFiles() throws Exception { Connector conn = getConnector(); // Should throw an error as this property can't be changed in ZooKeeper conn.instanceOperations().setProperty(Property.GENERAL_RPC_TIMEOUT.getKey(), "60s"); }
@After public void resetMajcDelay() throws Exception { if (null != tservMajcDelay) { Connector conn = getConnector(); conn.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), tservMajcDelay); } }
@After public void resetSessionIdle() throws Exception { if (null != sessionIdle) { getConnector().instanceOperations().setProperty(Property.TSERV_SESSION_MAXIDLE.getKey(), sessionIdle); } }
private void changeSetting(RandomDataGenerator random, State state, Environment env, Properties props) throws Exception { // pick a random property int choice = random.nextInt(0, settings.length - 1); Setting setting = settings[choice]; // generate a random value long newValue = random.nextLong(setting.min, setting.max); state.set(LAST_SETTING, "" + choice); log.debug("Setting " + setting.property.getKey() + " to " + newValue); env.getConnector().instanceOperations().setProperty(setting.property.getKey(), "" + newValue); }
@Before public void offlineTraceTable() throws Exception { Connector conn = getConnector(); String traceTable = conn.instanceOperations().getSystemConfiguration() .get(Property.TRACE_TABLE.getKey()); if (conn.tableOperations().exists(traceTable)) { conn.tableOperations().offline(traceTable, true); } }
@After public void onlineTraceTable() throws Exception { if (null != cluster) { Connector conn = getConnector(); String traceTable = conn.instanceOperations().getSystemConfiguration() .get(Property.TRACE_TABLE.getKey()); if (conn.tableOperations().exists(traceTable)) { conn.tableOperations().online(traceTable, true); } } }
private long getSyncs() throws Exception { Connector c = getConnector(); ServerConfigurationFactory confFactory = new ServerConfigurationFactory(c.getInstance()); AccumuloServerContext context = new AccumuloServerContext(confFactory); for (String address : c.instanceOperations().getTabletServers()) { TabletClientService.Client client = ThriftUtil .getTServerClient(HostAndPort.fromString(address), context); TabletServerStatus status = client.getTabletServerStatus(null, context.rpcCreds()); return status.syncs; } return 0; }
@After public void resetConfig() throws Exception { if (null != majcDelay) { InstanceOperations iops = getConnector().instanceOperations(); iops.setProperty(Property.TSERV_MAJC_DELAY.getKey(), majcDelay); iops.setProperty(Property.TSERV_MAXMEM.getKey(), maxMem); getClusterControl().stopAllServers(ServerType.TABLET_SERVER); getClusterControl().startAllServers(ServerType.TABLET_SERVER); } }