use of org.apache.accumulo.core.client.impl.thrift.ThriftNotActiveServiceException in project accumulo by apache.
the class DynamicThreadPoolsIT method test.
@Test
public void test() throws Exception {
final String[] tables = getUniqueNames(15);
String firstTable = tables[0];
Connector c = getConnector();
c.instanceOperations().setProperty(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), "5");
TestIngest.Opts opts = new TestIngest.Opts();
opts.rows = 500 * 1000;
opts.createTable = true;
opts.setTableName(firstTable);
ClientConfiguration clientConf = cluster.getClientConfig();
if (clientConf.hasSasl()) {
opts.updateKerberosCredentials(clientConf);
} else {
opts.setPrincipal(getAdminPrincipal());
}
TestIngest.ingest(c, opts, new BatchWriterOpts());
c.tableOperations().flush(firstTable, null, null, true);
for (int i = 1; i < tables.length; i++) c.tableOperations().clone(firstTable, tables[i], true, null, null);
// time between checks of the thread pool sizes
sleepUninterruptibly(11, TimeUnit.SECONDS);
Credentials creds = new Credentials(getAdminPrincipal(), getAdminToken());
for (int i = 1; i < tables.length; i++) c.tableOperations().compact(tables[i], null, null, true, false);
for (int i = 0; i < 30; i++) {
int count = 0;
MasterClientService.Iface client = null;
MasterMonitorInfo stats = null;
while (true) {
try {
client = MasterClient.getConnectionWithRetry(new ClientContext(c.getInstance(), creds, clientConf));
stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance()));
break;
} catch (ThriftNotActiveServiceException e) {
// Let it loop, fetching a new location
sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} finally {
if (client != null)
MasterClient.close(client);
}
}
for (TabletServerStatus server : stats.tServerInfo) {
for (TableInfo table : server.tableMap.values()) {
count += table.majors.running;
}
}
System.out.println("count " + count);
if (count > 3)
return;
sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
}
fail("Could not observe higher number of threads after changing the config");
}
use of org.apache.accumulo.core.client.impl.thrift.ThriftNotActiveServiceException in project accumulo by apache.
the class MiniAccumuloClusterImpl method getMasterMonitorInfo.
/**
* Get programmatic interface to information available in a normal monitor. XXX the returned structure won't contain information about the metadata table
* until there is data in it. e.g. if you want to see the metadata table you should create a table.
*
* @since 1.6.1
*/
public MasterMonitorInfo getMasterMonitorInfo() throws AccumuloException, AccumuloSecurityException {
MasterClientService.Iface client = null;
while (true) {
try {
Instance instance = new ZooKeeperInstance(getClientConfig());
ClientContext context = new ClientContext(instance, new Credentials("root", new PasswordToken("unchecked")), getClientConfig());
client = MasterClient.getConnectionWithRetry(context);
return client.getMasterStats(Tracer.traceInfo(), context.rpcCreds());
} catch (ThriftSecurityException exception) {
throw new AccumuloSecurityException(exception);
} catch (ThriftNotActiveServiceException e) {
// Let it loop, fetching a new location
log.debug("Contacted a Master which is no longer active, retrying");
sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} catch (TException exception) {
throw new AccumuloException(exception);
} finally {
if (client != null) {
MasterClient.close(client);
}
}
}
}
use of org.apache.accumulo.core.client.impl.thrift.ThriftNotActiveServiceException in project accumulo by apache.
the class ListBulkCommand method execute.
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {
List<String> tservers;
MasterMonitorInfo stats;
MasterClientService.Iface client = null;
Instance instance = shellState.getInstance();
AccumuloServerContext context = new AccumuloServerContext(instance, new ServerConfigurationFactory(instance));
while (true) {
try {
client = MasterClient.getConnectionWithRetry(context);
stats = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds());
break;
} catch (ThriftNotActiveServiceException e) {
// Let it loop, fetching a new location
sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} finally {
if (client != null)
MasterClient.close(client);
}
}
final boolean paginate = !cl.hasOption(disablePaginationOpt.getOpt());
if (cl.hasOption(tserverOption.getOpt())) {
tservers = new ArrayList<>();
tservers.add(cl.getOptionValue(tserverOption.getOpt()));
} else {
tservers = Collections.emptyList();
}
shellState.printLines(new BulkImportListIterator(tservers, stats), paginate);
return 0;
}
use of org.apache.accumulo.core.client.impl.thrift.ThriftNotActiveServiceException in project accumulo by apache.
the class DetectDeadTabletServersIT method getStats.
private MasterMonitorInfo getStats(Connector c) throws Exception {
Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
ClientContext context = new ClientContext(c.getInstance(), creds, getClientConfig());
Client client = null;
while (true) {
try {
client = MasterClient.getConnectionWithRetry(context);
log.info("Fetching master stats");
return client.getMasterStats(Tracer.traceInfo(), context.rpcCreds());
} catch (ThriftNotActiveServiceException e) {
// Let it loop, fetching a new location
sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} finally {
if (client != null) {
MasterClient.close(client);
}
}
}
}
use of org.apache.accumulo.core.client.impl.thrift.ThriftNotActiveServiceException in project accumulo by apache.
the class MetadataMaxFilesIT method test.
@Test
public void test() throws Exception {
Connector c = getConnector();
SortedSet<Text> splits = new TreeSet<>();
for (int i = 0; i < 1000; i++) {
splits.add(new Text(String.format("%03d", i)));
}
c.tableOperations().setProperty(MetadataTable.NAME, Property.TABLE_SPLIT_THRESHOLD.getKey(), "10000");
// propagation time
sleepUninterruptibly(5, TimeUnit.SECONDS);
for (int i = 0; i < 5; i++) {
String tableName = "table" + i;
log.info("Creating {}", tableName);
c.tableOperations().create(tableName);
log.info("adding splits");
c.tableOperations().addSplits(tableName, splits);
log.info("flushing");
c.tableOperations().flush(MetadataTable.NAME, null, null, true);
c.tableOperations().flush(RootTable.NAME, null, null, true);
}
log.info("shutting down");
assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
cluster.stop();
log.info("starting up");
cluster.start();
Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
while (true) {
MasterMonitorInfo stats = null;
Client client = null;
try {
ClientContext context = new ClientContext(c.getInstance(), creds, getClientConfig());
client = MasterClient.getConnectionWithRetry(context);
log.info("Fetching stats");
stats = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds());
} catch (ThriftNotActiveServiceException e) {
// Let it loop, fetching a new location
sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
continue;
} finally {
if (client != null)
MasterClient.close(client);
}
int tablets = 0;
for (TabletServerStatus tserver : stats.tServerInfo) {
for (Entry<String, TableInfo> entry : tserver.tableMap.entrySet()) {
if (entry.getKey().startsWith("!") || entry.getKey().startsWith("+"))
continue;
tablets += entry.getValue().onlineTablets;
}
}
log.info("Online tablets " + tablets);
if (tablets == 5005)
break;
sleepUninterruptibly(1, TimeUnit.SECONDS);
}
}
Aggregations