public KeyExtent(Text table, Text endRow, Text prevEndRow) { this.wrapped = new org.apache.accumulo.core.data.impl.KeyExtent(table.toString(), endRow, prevEndRow); }
private static void checkFailures(HostAndPort server, HashSet<KeyExtent> failures, MultiScanResult scanResult) { for (TKeyExtent tke : scanResult.failures.keySet()) { KeyExtent ke = new KeyExtent(tke); System.out.println(" Tablet " + ke + " failed at " + server); failures.add(ke); } }
@Override public List<Range> binRanges(ClientContext context, List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { binnedRanges.put("", Collections.singletonMap(new KeyExtent("", null, null), ranges)); return Collections.emptyList(); }
private KeyExtent nke(String table, String endRow, String prevEndRow) { return new KeyExtent(table, endRow == null ? null : new Text(endRow), prevEndRow == null ? null : new Text(prevEndRow)); }
private static TabletId newTabletId(String tableId, String endRow, String prevRow) { return new TabletIdImpl(new KeyExtent(tableId, endRow == null ? null : new Text(endRow), prevRow == null ? null : new Text(prevRow))); }
public static byte[] tableOfMetadataRow(Text row) { KeyExtent ke = new KeyExtent(); ke.decodeMetadataRow(row); return ke.getTableId().getBytes(UTF_8); }
@Override public <T extends Mutation> void binMutations(ClientContext context, List<T> mutations, Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { TabletServerMutations<T> tsm = new TabletServerMutations<>("5"); for (T m : mutations) tsm.addMutation(new KeyExtent(), m); binnedMutations.put("", tsm); }
@Override public Collection<MergeInfo> merges() { String tableIdToModify = getConnector().tableOperations().tableIdMap().get(t3); return Collections.singletonList( new MergeInfo(new KeyExtent(tableIdToModify, null, null), MergeInfo.Operation.MERGE)); } };
@Override public void readFields(DataInput in) throws IOException { extent = new KeyExtent(); extent.readFields(in); state = MergeState.values()[in.readInt()]; operation = Operation.values()[in.readInt()]; }
public static void rollBackSplit(Text metadataEntry, Text oldPrevEndRow, ClientContext context, ZooLock zooLock) { KeyExtent ke = new KeyExtent(metadataEntry, oldPrevEndRow); Mutation m = ke.getPrevRowUpdateMutation(); TabletsSection.TabletColumnFamily.SPLIT_RATIO_COLUMN.putDelete(m); TabletsSection.TabletColumnFamily.OLD_PREV_ROW_COLUMN.putDelete(m); update(context, zooLock, m, new KeyExtent(metadataEntry, (Text) null)); }
private static Mutation deleteTablet(String tid, String endRow, String prevRow, String dir, String file) throws Exception { KeyExtent ke = new KeyExtent(tid, endRow == null ? null : new Text(endRow), prevRow == null ? null : new Text(prevRow)); Mutation mut = new Mutation(ke.getMetadataEntry()); TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.putDelete(mut); TabletsSection.ServerColumnFamily.TIME_COLUMN.putDelete(mut); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.putDelete(mut); mut.putDelete(DataFileColumnFamily.NAME.toString(), file); return mut; }
@Override @Deprecated public org.apache.accumulo.core.data.KeyExtent getExtent() { KeyExtent ke = new KeyExtent(tac.getExtent()); org.apache.accumulo.core.data.KeyExtent oke = new org.apache.accumulo.core.data.KeyExtent( new Text(ke.getTableId()), ke.getEndRow(), ke.getPrevEndRow()); return oke; }
private static Mutation createTablet(String tid, String endRow, String prevRow, String dir, String file) throws Exception { KeyExtent ke = new KeyExtent(tid, endRow == null ? null : new Text(endRow), prevRow == null ? null : new Text(prevRow)); Mutation mut = ke.getPrevRowUpdateMutation(); TabletsSection.ServerColumnFamily.TIME_COLUMN.put(mut, new Value("M0".getBytes())); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut, new Value(dir.getBytes())); mut.put(DataFileColumnFamily.NAME.toString(), file, new DataFileValue(10, 200).encodeAsString()); return mut; }
@Override public String getTable() throws TableNotFoundException { return Tables.getTableName(instance, new KeyExtent(tac.getExtent()).getTableId()); }
@Override public void unloadTablet(TInfo tinfo, TCredentials credentials, String lock, TKeyExtent textent, TUnloadTabletGoal goal, long requestTime) { try { checkPermission(credentials, lock, "unloadTablet"); } catch (ThriftSecurityException e) { log.error("Caller doesn't have permission to unload a tablet", e); throw new RuntimeException(e); } KeyExtent extent = new KeyExtent(textent); resourceManager.addMigration(extent, new LoggingRunnable(log, new UnloadTabletHandler(extent, goal, requestTime))); }
private void addDuplicateLocation(String table, String tableNameToModify) throws TableNotFoundException, MutationsRejectedException { String tableIdToModify = getConnector().tableOperations().tableIdMap().get(tableNameToModify); Mutation m = new Mutation(new KeyExtent(tableIdToModify, null, null).getMetadataEntry()); m.put(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME, new Text("1234567"), new Value("fake:9005".getBytes(UTF_8))); BatchWriter bw = getConnector().createBatchWriter(table, null); bw.addMutation(m); bw.close(); }
public static void removeBulkLoadInProgressFlag(AccumuloServerContext context, String path) { Mutation m = new Mutation(MetadataSchema.BlipSection.getRowPrefix() + path); m.putDelete(EMPTY_TEXT, EMPTY_TEXT); // new KeyExtent is only added to force update to write to the metadata table, not the root // table // because bulk loads aren't supported to the metadata table update(context, m, new KeyExtent("anythingNotMetadata", null, null)); }
public static void addBulkLoadInProgressFlag(AccumuloServerContext context, String path) { Mutation m = new Mutation(MetadataSchema.BlipSection.getRowPrefix() + path); m.put(EMPTY_TEXT, EMPTY_TEXT, new Value(new byte[] {})); // new KeyExtent is only added to force update to write to the metadata table, not the root // table // because bulk loads aren't supported to the metadata table update(context, m, new KeyExtent("anythingNotMetadata", null, null)); }
private void removeLocation(String table, String tableNameToModify) throws TableNotFoundException, MutationsRejectedException { String tableIdToModify = getConnector().tableOperations().tableIdMap().get(tableNameToModify); BatchDeleter deleter = getConnector().createBatchDeleter(table, Authorizations.EMPTY, 1, new BatchWriterConfig()); deleter.setRanges( Collections.singleton(new KeyExtent(tableIdToModify, null, null).toMetadataRange())); deleter.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME); deleter.delete(); deleter.close(); }
static public LogEntry fromBytes(byte bytes[]) throws IOException { DataInputBuffer inp = new DataInputBuffer(); inp.reset(bytes, bytes.length); KeyExtent extent = new KeyExtent(); extent.readFields(inp); long timestamp = inp.readLong(); String server = inp.readUTF(); String filename = inp.readUTF(); return new LogEntry(extent, timestamp, server, filename); }