@Override public void waitForBalance() throws AccumuloException { try { MasterClient.executeVoid(context, client -> client.waitForBalance(Tracer.traceInfo())); } catch (AccumuloSecurityException ex) { // should never happen throw new RuntimeException("Unexpected exception thrown", ex); } }
public static MasterClientService.Client getConnectionWithRetry(ClientContext context) { while (true) { MasterClientService.Client result = getConnection(context); if (result != null) return result; sleepUninterruptibly(250, TimeUnit.MILLISECONDS); } }
protected boolean getMasterDrain(final TInfo tinfo, final TCredentials rpcCreds, final String tableName, final Set<String> wals) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { return MasterClient.execute(context, client -> client.drainReplicationTable(tinfo, rpcCreds, tableName, wals)); }
private long beginFateOperation() throws ThriftSecurityException, TException { while (true) { MasterClientService.Iface client = null; try { client = MasterClient.getConnectionWithRetry(context); return client.beginFateOperation(Tracer.traceInfo(), context.rpcCreds()); } catch (TTransportException tte) { log.debug("Failed to call beginFateOperation(), retrying ... ", tte); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } 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); } finally { MasterClient.close(client); } } }
MasterClientService.Iface client = null; try { client = MasterClient.getConnection(context); if (client != null) { mmi = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds()); } finally { if (client != null) { MasterClient.close(client);
public static void executeTable(ClientContext context, ClientExec<MasterClientService.Client> exec) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { executeGeneric(context, exec); }
@Override public void setProperty(final String namespace, final String property, final String value) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException { checkArgument(namespace != null, "namespace is null"); checkArgument(property != null, "property is null"); checkArgument(value != null, "value is null"); MasterClient.executeNamespace(context, client -> client.setNamespaceProperty(Tracer.traceInfo(), context.rpcCreds(), namespace, property, value)); checkLocalityGroups(namespace, property); }
private void setPropertyNoChecks(final String tableName, final String property, final String value) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { MasterClient.executeTable(context, client -> client.setTableProperty(Tracer.traceInfo(), context.rpcCreds(), tableName, property, value)); }
private String waitForFateOperation(long opid) throws ThriftSecurityException, TException, ThriftTableOperationException { while (true) { MasterClientService.Iface client = null; try { client = MasterClient.getConnectionWithRetry(context); return client.waitForFateOperation(Tracer.traceInfo(), context.rpcCreds(), opid); } catch (TTransportException tte) { log.debug("Failed to call waitForFateOperation(), retrying ... ", tte); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } 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); } finally { MasterClient.close(client); } } }
public static void executeVoid(ClientContext context, ClientExec<MasterClientService.Client> exec) throws AccumuloException, AccumuloSecurityException { try { executeGeneric(context, exec); } catch (TableNotFoundException e) { throw new AssertionError(e); } } }
@Override public void removeProperty(final String namespace, final String property) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException { checkArgument(namespace != null, "namespace is null"); checkArgument(property != null, "property is null"); MasterClient.executeNamespace(context, client -> client .removeNamespaceProperty(Tracer.traceInfo(), context.rpcCreds(), namespace, property)); checkLocalityGroups(namespace, property); }
private void removePropertyNoChecks(final String tableName, final String property) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { MasterClient.executeTable(context, client -> client.removeTableProperty(Tracer.traceInfo(), context.rpcCreds(), tableName, property)); }
private void finishFateOperation(long opid) throws ThriftSecurityException, TException { while (true) { MasterClientService.Iface client = null; try { client = MasterClient.getConnectionWithRetry(context); client.finishFateOperation(Tracer.traceInfo(), context.rpcCreds(), opid); break; } catch (TTransportException tte) { log.debug("Failed to call finishFateOperation(), retrying ... ", tte); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } 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); } finally { MasterClient.close(client); } } }
@Override public void setProperty(final String property, final String value) throws AccumuloException, AccumuloSecurityException, IllegalArgumentException { checkArgument(property != null, "property is null"); checkArgument(value != null, "value is null"); MasterClient.executeVoid(context, client -> client.setSystemProperty(Tracer.traceInfo(), context.rpcCreds(), property, value)); checkLocalityGroups(property); }
public static void executeNamespace(ClientContext context, ClientExec<MasterClientService.Client> exec) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException { try { executeGeneric(context, exec); } catch (TableNotFoundException e) { if (e.getCause() instanceof NamespaceNotFoundException) throw (NamespaceNotFoundException) e.getCause(); } }
@Override public DelegationToken getDelegationToken(DelegationTokenConfig cfg) throws AccumuloException, AccumuloSecurityException { final TDelegationTokenConfig tConfig; if (cfg != null) { tConfig = DelegationTokenConfigSerializer.serialize(cfg); } else { tConfig = new TDelegationTokenConfig(); } TDelegationToken thriftToken; try { thriftToken = MasterClient.execute(context, client -> client.getDelegationToken(Tracer.traceInfo(), context.rpcCreds(), tConfig)); } catch (TableNotFoundException e) { // should never happen throw new AssertionError( "Received TableNotFoundException on method which should not throw that exception", e); } AuthenticationTokenIdentifier identifier = new AuthenticationTokenIdentifier( thriftToken.getIdentifier()); // Get the password out of the thrift delegation token return new DelegationTokenImpl(thriftToken.getPassword(), identifier); }
@Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception { List<String> tservers; MasterMonitorInfo stats; MasterClientService.Iface client = null; ClientContext context = shellState.getContext(); 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; }
@Override public void removeProperty(final String property) throws AccumuloException, AccumuloSecurityException { checkArgument(property != null, "property is null"); MasterClient.executeVoid(context, client -> client.removeSystemProperty(Tracer.traceInfo(), context.rpcCreds(), property)); checkLocalityGroups(property); }
private void executeFateOperation(long opid, FateOperation op, List<ByteBuffer> args, Map<String,String> opts, boolean autoCleanUp) throws ThriftSecurityException, TException, ThriftTableOperationException { while (true) { MasterClientService.Iface client = null; try { client = MasterClient.getConnectionWithRetry(context); client.executeFateOperation(Tracer.traceInfo(), context.rpcCreds(), opid, op, args, opts, autoCleanUp); return; } catch (TTransportException tte) { log.debug("Failed to call executeFateOperation(), retrying ... ", tte); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } 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); } finally { MasterClient.close(client); } } }
private static void stopServer(final ClientContext context, final boolean tabletServersToo) throws AccumuloException, AccumuloSecurityException { MasterClient.executeVoid(context, client -> client.shutdown(Tracer.traceInfo(), context.rpcCreds(), tabletServersToo)); }