public void renameAccumuloTable(String oldName, String newName) { try { connector.tableOperations().rename(oldName, newName); } catch (AccumuloSecurityException | AccumuloException e) { throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to rename table", e); } catch (TableNotFoundException e) { throw new PrestoException(ACCUMULO_TABLE_DNE, "Failed to rename table, old table does not exist", e); } catch (TableExistsException e) { throw new PrestoException(ACCUMULO_TABLE_EXISTS, "Failed to rename table, new table already exists", e); } } }
@Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException { shellState.getAccumuloClient().tableOperations().rename(cl.getArgs()[0], cl.getArgs()[1]); if (shellState.getTableName().equals(Tables.qualified(cl.getArgs()[0]))) { shellState.setTableName(cl.getArgs()[1]); } return 0; }
@Override protected void doTableOp() throws Exception { c.tableOperations().rename(table, table + "_renamed"); } }));
@Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException { shellState.getConnector().tableOperations().rename(cl.getArgs()[0], cl.getArgs()[1]); if (shellState.getTableName().equals(Tables.qualified(cl.getArgs()[0]))) { shellState.setTableName(cl.getArgs()[1]); } return 0; }
conn.tableOperations().rename(srcTableName, newTableName); log.debug("Renamed table " + srcTableName + " " + newTableName); } catch (TableExistsException e) {
@Override public void renameTable(ByteBuffer login, String oldTableName, String newTableName) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, org.apache.accumulo.proxy.thrift.TableExistsException, TException { try { getConnector(login).tableOperations().rename(oldTableName, newTableName); } catch (Exception e) { handleExceptionTEE(e); } }
@Override public void visit(State state, Environment env, Properties props) throws Exception { String indexTableName = (String) state.get("indexTableName"); String tmpIndexTableName = indexTableName + "_tmp"; // scan new and old index and verify identical Scanner indexScanner1 = env.getConnector().createScanner(tmpIndexTableName, Authorizations.EMPTY); Scanner indexScanner2 = env.getConnector().createScanner(indexTableName, Authorizations.EMPTY); Iterator<Entry<Key,Value>> iter = indexScanner2.iterator(); int count = 0; for (Entry<Key,Value> entry : indexScanner1) { if (!iter.hasNext()) throw new Exception("index rebuild mismatch " + entry.getKey() + " " + indexTableName); Key key1 = entry.getKey(); Key key2 = iter.next().getKey(); if (!key1.equals(key2, PartialKey.ROW_COLFAM_COLQUAL)) throw new Exception("index rebuild mismatch " + key1 + " " + key2 + " " + indexTableName + " " + tmpIndexTableName); count++; if (count % 1000 == 0) makingProgress(); } if (iter.hasNext()) throw new Exception( "index rebuild mismatch " + iter.next().getKey() + " " + tmpIndexTableName); log.debug("Verified " + count + " index entries "); env.getConnector().tableOperations().delete(indexTableName); env.getConnector().tableOperations().rename(tmpIndexTableName, indexTableName); }
tops.rename(table1, table2); tops.create(table1);
} catch (AccumuloSecurityException ex) {} try { auditConnector.tableOperations().rename(OLD_TEST_TABLE_NAME, NEW_TEST_TABLE_NAME); } catch (AccumuloSecurityException ex) {} try {
instanceConnector.tableOperations().rename(tempTableName, tableName); log.info("Cached " + count + " k,v for table: " + tableName); } catch (Exception e) {
auditConnector.tableOperations().rename(OLD_TEST_TABLE_NAME, NEW_TEST_TABLE_NAME); Map<String,String> emptyMap = Collections.emptyMap(); Set<String> emptySet = Collections.emptySet();
public static void renameTable(Connector conn, State state, Environment env, String oldName, String newName, boolean hasPermission, boolean tableExists) throws AccumuloSecurityException, AccumuloException, TableExistsException { try { conn.tableOperations().rename(oldName, newName); } catch (AccumuloSecurityException ae) { if (ae.getSecurityErrorCode().equals(SecurityErrorCode.PERMISSION_DENIED)) { if (hasPermission) throw new AccumuloException("Got a security exception when I should have had permission.", ae); else return; } else if (ae.getSecurityErrorCode().equals(SecurityErrorCode.BAD_CREDENTIALS)) { if (WalkingSecurity.get(state, env).userPassTransient(conn.whoami())) return; } throw new AccumuloException("Got unexpected ae error code", ae); } catch (TableNotFoundException tnfe) { if (tableExists) throw new TableExistsException(null, oldName, "Got a TableNotFoundException but it should exist", tnfe); else return; } WalkingSecurity.get(state, env).setTableName(newName); if (!hasPermission) throw new AccumuloException("Didn't get Security Exception when we should have"); } }
try { loginAs(testUser); test_user_conn.tableOperations().rename(tableName, table2); throw new IllegalStateException("Should NOT be able to rename a table"); } catch (AccumuloSecurityException e) {
throw new IllegalStateException("Should be able to remove a table property"); loginAs(testUser); test_user_conn.tableOperations().rename(tableName, table2); loginAs(rootUser); if (root_conn.tableOperations().list().contains(tableName)
c.tableOperations().rename(name1, name2); TestIngest.ingest(c, opts, bwOpts); VerifyIngest.Opts vopts = new VerifyIngest.Opts(); VerifyIngest.verifyIngest(c, vopts, scanOpts); c.tableOperations().delete(name1); c.tableOperations().rename(name2, name1); vopts.setTableName(name1); VerifyIngest.verifyIngest(c, vopts, scanOpts);
c.tableOperations().rename(names[0], names[1]); VerifyIngest.Opts vopts = new VerifyIngest.Opts(); vopts.setTableName(names[1]);