@Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException { Map<String,String> props = ShellUtil.parseMapOpt(cl, setPropsOption); final HashSet<String> exclude = new HashSet<>(); boolean flush = true; if (cl.hasOption(excludePropsOption.getOpt())) { String[] keys = cl.getOptionValue(excludePropsOption.getOpt()).split(","); for (String key : keys) { exclude.add(key); } } if (cl.hasOption(noFlushOption.getOpt())) { flush = false; } shellState.getAccumuloClient().tableOperations().clone(cl.getArgs()[0], cl.getArgs()[1], flush, props, exclude); return 0; }
public void CloneTable(String t1, String t2, boolean logDur)throws TableExistsException, AccumuloSecurityException, TableNotFoundException, AccumuloException { System.out.println("Clone " + t1 + " to "+t2); Map<String,String> propsToSet = logDur ? Collections.singletonMap("table.durability", "log") : null; connector.tableOperations().clone(t1, t2, true, propsToSet, null); }
@Override protected void doTableOp() throws Exception { Map<String,String> m = Collections.emptyMap(); Set<String> s = Collections.emptySet(); c.tableOperations().clone(table, table + "_clone", true, m, s); } }));
@Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException { final HashMap<String,String> props = new HashMap<>(); final HashSet<String> exclude = new HashSet<>(); boolean flush = true; if (cl.hasOption(setPropsOption.getOpt())) { String[] keyVals = cl.getOptionValue(setPropsOption.getOpt()).split(","); for (String keyVal : keyVals) { String[] sa = keyVal.split("="); props.put(sa[0], sa[1]); } } if (cl.hasOption(excludePropsOption.getOpt())) { String[] keys = cl.getOptionValue(excludePropsOption.getOpt()).split(","); for (String key : keys) { exclude.add(key); } } if (cl.hasOption(noFlushOption.getOpt())) { flush = false; } shellState.getConnector().tableOperations().clone(cl.getArgs()[0], cl.getArgs()[1], flush, props, exclude); return 0; }
conn.tableOperations().clone(srcTableName, newTableName, flush, new HashMap<String,String>(), new HashSet<String>()); } catch (TableExistsException e) {
@Override public void visit(State state, Environment env, Properties props) throws Exception { String indexTableName = (String) state.get("indexTableName"); String tmpIndexTableName = indexTableName + "_tmp"; long t1 = System.currentTimeMillis(); env.getConnector().tableOperations().flush(indexTableName, null, null, true); long t2 = System.currentTimeMillis(); env.getConnector().tableOperations().clone(indexTableName, tmpIndexTableName, false, new HashMap<String,String>(), new HashSet<String>()); long t3 = System.currentTimeMillis(); log.debug("Cloned " + tmpIndexTableName + " from " + indexTableName + " flush: " + (t2 - t1) + "ms clone: " + (t3 - t2) + "ms"); }
@Override public void cloneTable(ByteBuffer login, String tableName, String newTableName, boolean flush, Map<String,String> propertiesToSet, Set<String> propertiesToExclude) 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 { propertiesToExclude = propertiesToExclude == null ? new HashSet<String>() : propertiesToExclude; propertiesToSet = propertiesToSet == null ? new HashMap<String,String>() : propertiesToSet; getConnector(login).tableOperations().clone(tableName, newTableName, flush, propertiesToSet, propertiesToExclude); } catch (Exception e) { handleExceptionTEE(e); } }
private void cloneMetadataTable(String cloned) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException { try { dropTables(cloned); } catch (TableNotFoundException ex) { // ignored } getConnector().tableOperations().clone(MetadataTable.NAME, cloned, true, null, null); }
conn = zki.getConnector(args[2], args[3].getBytes()); clone = table + "_" + jobName; conn.tableOperations().clone(table, clone, true, new HashMap<String,String>(), new HashSet<String>()); conn.tableOperations().offline(clone);
tops.clone(originalTable, clonedTable, true, null, null); tops.merge(clonedTable, null, new Text("b"));
@Test public void testCloneWithSplits() throws Exception { Connector conn = getConnector(); List<Mutation> mutations = new ArrayList<>(); TreeSet<Text> splits = new TreeSet<>(); for (int i = 0; i < 10; i++) { splits.add(new Text(Integer.toString(i))); Mutation m = new Mutation(Integer.toString(i)); m.put("", "", ""); mutations.add(m); } String[] tables = getUniqueNames(2); conn.tableOperations().create(tables[0]); conn.tableOperations().addSplits(tables[0], splits); BatchWriter bw = conn.createBatchWriter(tables[0], new BatchWriterConfig()); bw.addMutations(mutations); bw.close(); conn.tableOperations().clone(tables[0], tables[1], true, null, null); conn.tableOperations().deleteRows(tables[1], new Text("4"), new Text("8")); List<String> rows = Arrays.asList("0", "1", "2", "3", "4", "9"); List<String> actualRows = new ArrayList<>(); for (Entry<Key,Value> entry : conn.createScanner(tables[1], Authorizations.EMPTY)) { actualRows.add(entry.getKey().getRow().toString()); } Assert.assertEquals(rows, actualRows); }
rootTabletDir.startsWith(v8.toString()) || rootTabletDir.startsWith(v9.toString())); getConnector().tableOperations().clone(tableNames[1], tableNames[2], true, new HashMap<String,String>(), new HashSet<String>());
Assert.assertTrue(rootTabletDir.startsWith(v2.toString())); conn.tableOperations().clone(tableNames[0], tableNames[1], true, new HashMap<String,String>(), new HashSet<String>());
+ String.format("%016x", (random.nextLong() & 0x7fffffffffffffffl)); conn = opts.getConnector(); conn.tableOperations().clone(opts.getTableName(), clone, true, new HashMap<String,String>(), new HashSet<String>()); ranges = conn.tableOperations().splitRangeByTablets(opts.getTableName(), new Range(),
private Scanner newOfflineScanner(Connector conn, String tableName, String clone, SamplerConfiguration sc) throws Exception { if (conn.tableOperations().exists(clone)) { conn.tableOperations().delete(clone); } Map<String,String> em = Collections.emptyMap(); Set<String> es = Collections.emptySet(); conn.tableOperations().clone(tableName, clone, false, em, es); conn.tableOperations().offline(clone, true); String cloneID = conn.tableOperations().tableIdMap().get(clone); OfflineScanner oScanner = new OfflineScanner(conn.getInstance(), new Credentials(getAdminPrincipal(), getAdminToken()), cloneID, Authorizations.EMPTY); if (sc != null) { oScanner.setSamplerConfiguration(sc); } return oScanner; }
exclude.add(Property.TABLE_FILE_MAX.getKey()); c.tableOperations().clone(table1, table2, true, props, exclude);
conn.tableOperations().clone(tableName, tableName + "_clone", true, new HashMap<String,String>(), new HashSet<String>());
exclude.add(Property.TABLE_FILE_MAX.getKey()); c.tableOperations().clone(table1, table2, true, props, exclude);
Map<String,String> emptyMap = Collections.emptyMap(); Set<String> emptySet = Collections.emptySet(); auditConnector.tableOperations().clone(NEW_TEST_TABLE_NAME, OLD_TEST_TABLE_NAME, true, emptyMap, emptySet); auditConnector.tableOperations().delete(OLD_TEST_TABLE_NAME);
@Test public void testConstraints() throws Exception { // ensure constraint violations are properly reported Connector conn = getConnector(); String tableName = getUniqueNames(1)[0]; conn.tableOperations().create(tableName); conn.tableOperations().addConstraint(tableName, AlphaNumKeyConstraint.class.getName()); conn.tableOperations().clone(tableName, tableName + "_clone", true, new HashMap<String,String>(), new HashSet<String>()); Scanner scanner = conn.createScanner(tableName + "_clone", new Authorizations()); try (ConditionalWriter cw = conn.createConditionalWriter(tableName + "_clone", new ConditionalWriterConfig())) { ConditionalMutation cm0 = new ConditionalMutation("99006+", new Condition("tx", "seq")); cm0.put("tx", "seq", "1"); Assert.assertEquals(Status.VIOLATED, cw.write(cm0).getStatus()); Assert.assertFalse("Should find no results in the table is mutation result was violated", scanner.iterator().hasNext()); ConditionalMutation cm1 = new ConditionalMutation("99006", new Condition("tx", "seq")); cm1.put("tx", "seq", "1"); Assert.assertEquals(Status.ACCEPTED, cw.write(cm1).getStatus()); Assert.assertTrue("Accepted result should be returned when reading table", scanner.iterator().hasNext()); } }