public static void setOnline(AccumuloClient client) throws AccumuloSecurityException, AccumuloException { try { log.info("Bringing replication table online"); client.tableOperations().online(NAME, true); } catch (TableNotFoundException e) { throw new AssertionError(NAME + " should exist, but doesn't."); } }
@Override protected void doTableOp(final Shell shellState, final String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { if (tableName.equals(RootTable.NAME)) { Shell.log.info(" The " + RootTable.NAME + " is always online."); } else { shellState.getAccumuloClient().tableOperations().online(tableName, wait); Shell.log.info("Online of table " + tableName + (wait ? " completed." : " initiated...")); } }
context.tableOperations().online(tableName, true); log.info("table {} back online", tableName);
protected void takeTableOnline(Connector conn, List<String> tableNames) throws AccumuloSecurityException, AccumuloException, TableNotFoundException { for (String tableName : tableNames) { LOGGER.debug("taking table " + tableName + " online"); try { conn.tableOperations().online(tableName); } catch (Exception ex) { LOGGER.error("Failed to online table: " + tableName, ex); } } }
public static void setOnline(Connector conn) throws AccumuloSecurityException, AccumuloException { try { log.info("Bringing replication table online"); conn.tableOperations().online(NAME, true); } catch (TableNotFoundException e) { throw new AssertionError(NAME + " should exist, but doesn't."); } }
@Override protected void doTableOp(final Shell shellState, final String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { if (tableName.equals(RootTable.NAME)) { Shell.log.info(" The " + RootTable.NAME + " is always online."); } else { shellState.getConnector().tableOperations().online(tableName, wait); Shell.log.info("Online of table " + tableName + (wait ? " completed." : " initiated...")); } }
@Override public OnlineOpTiming call() throws Exception { OnlineOpTiming status = new OnlineOpTiming(); log.trace("Setting {} online", tableName); connector.tableOperations().online(tableName, true); // stop timing status.setComplete(); log.trace("Online completed in {} ms", TimeUnit.MILLISECONDS.convert(status.runningTime(), TimeUnit.NANOSECONDS)); return status; } }
@Override public void visit(State state, Environment env, Properties props) throws Exception { @SuppressWarnings("unchecked") List<String> tables = (List<String>) state.get("tableList"); if (tables.size() <= 0) { return; } Random rand = new Random(); String tableName = tables.get(rand.nextInt(tables.size())); env.getConnector().tableOperations().offline(tableName, rand.nextBoolean()); log.debug("Table " + tableName + " offline "); env.getConnector().tableOperations().online(tableName, rand.nextBoolean()); log.debug("Table " + tableName + " online "); } }
private static void setupLocalityGroups(Connector conn, int numlg, ArrayList<byte[]> cfset, String table) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { if (numlg > 1) { int numCF = cfset.size() / numlg; int gNum = 0; Iterator<byte[]> cfiter = cfset.iterator(); Map<String,Set<Text>> groups = new HashMap<>(); while (cfiter.hasNext()) { HashSet<Text> groupCols = new HashSet<>(); for (int i = 0; i < numCF && cfiter.hasNext(); i++) { groupCols.add(new Text(cfiter.next())); } groups.put("lg" + (gNum++), groupCols); } conn.tableOperations().setLocalityGroups(table, groups); conn.tableOperations().offline(table); sleepUninterruptibly(1, TimeUnit.SECONDS); conn.tableOperations().online(table); } }
@Override public void onlineTable(ByteBuffer login, String tableName, boolean wait) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, TException { try { getConnector(login).tableOperations().online(tableName, wait); } catch (Exception e) { handleExceptionTNF(e); } }
@Override public void visit(State state, Environment env, Properties props) throws Exception { Connector conn = env.getConnector(); Random rand = (Random) state.get("rand"); @SuppressWarnings("unchecked") List<String> tableNames = (List<String>) state.get("tables"); String tableName = tableNames.get(rand.nextInt(tableNames.size())); try { conn.tableOperations().offline(tableName, rand.nextBoolean()); log.debug("Offlined " + tableName); sleepUninterruptibly(rand.nextInt(200), TimeUnit.MILLISECONDS); conn.tableOperations().online(tableName, rand.nextBoolean()); log.debug("Onlined " + tableName); } catch (TableNotFoundException tne) { log.debug("offline or online failed " + tableName + ", doesnt exist"); } catch (AccumuloException ae) { if (ae.getMessage().startsWith("Unexpected table state")) { log.debug("offline or online failed " + tableName + ", unexpected table state"); } else { throw ae; } } } }
private void createTable(String t, boolean online) throws AccumuloSecurityException, AccumuloException, TableNotFoundException, TableExistsException { Connector conn = getConnector(); conn.tableOperations().create(t); conn.tableOperations().online(t, true); SortedSet<Text> partitionKeys = new TreeSet<>(); partitionKeys.add(new Text("some split")); conn.tableOperations().addSplits(t, partitionKeys); if (!online) { conn.tableOperations().offline(t, true); } }
private void updateSamplingConfig(Connector conn, String tableName, SamplerConfiguration sc) throws TableNotFoundException, AccumuloException, AccumuloSecurityException { conn.tableOperations().setSamplerConfiguration(tableName, sc); // wait for for config change conn.tableOperations().offline(tableName, true); conn.tableOperations().online(tableName, true); }
env.getConnector().tableOperations().online(indexTableName); env.getConnector().tableOperations().importTable(tmpIndexTableName, copyDir);
/** * Create splits on table and force migration by taking table offline and then bring back online * for test. * * @param conn * Accumulo connector Accumulo connector to test cluster or MAC instance. */ private void addSplits(final Connector conn, final String tableName) { SortedSet<Text> splits = createSplits(); try { conn.tableOperations().addSplits(tableName, splits); conn.tableOperations().offline(tableName, true); sleepUninterruptibly(2, TimeUnit.SECONDS); conn.tableOperations().online(tableName, true); for (Text split : conn.tableOperations().listSplits(tableName)) { log.trace("Split {}", split); } } catch (AccumuloSecurityException e) { throw new IllegalStateException("Initialization failed. Could not add splits to " + tableName, e); } catch (TableNotFoundException e) { throw new IllegalStateException("Initialization failed. Could not add splits to " + tableName, e); } catch (AccumuloException e) { throw new IllegalStateException("Initialization failed. Could not add splits to " + tableName, e); } }
@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); } } }
conn.tableOperations().online(tableName, true);
conn.tableOperations().online(tableName, true);
connector.tableOperations().online(tableName, true); connector.tableOperations().compact(tableName, null, null, false, true);
c.tableOperations().online(tableName, true); TabletLocationState online = getTabletLocationState(c, tableId); assertNull(online.future);