static Map<Table.ID,Integer> tabletCountsPerTable(TabletServerStatus status) { Map<Table.ID,Integer> result = new HashMap<>(); if (status != null && status.tableMap != null) { Map<String,TableInfo> tableMap = status.tableMap; for (Entry<String,TableInfo> entry : tableMap.entrySet()) { result.put(Table.ID.of(entry.getKey()), entry.getValue().onlineTablets); } } return result; }
private Set<Table.ID> parseTableIDs(String tableIDs) { if (tableIDs == null) return null; Set<Table.ID> result = new HashSet<>(); for (String tableID : tableIDs.split(",")) result.add(Table.ID.of(tableID)); return result; }
private static String format(Map<TabletId,Set<SecurityErrorCode>> hashMap, ClientContext context) { Map<String,Set<SecurityErrorCode>> result = new HashMap<>(); for (Entry<TabletId,Set<SecurityErrorCode>> entry : hashMap.entrySet()) { TabletId tabletId = entry.getKey(); String tableInfo = Tables.getPrintableTableInfoFromId(context, Table.ID.of(tabletId.getTableId().toString())); if (!result.containsKey(tableInfo)) { result.put(tableInfo, new HashSet<>()); } result.get(tableInfo).addAll(hashMap.get(tabletId)); } return result.toString(); }
@Override public TSummaries startGetSummariesForPartition(TInfo tinfo, TCredentials credentials, TSummaryRequest request, int modulus, int remainder) throws ThriftSecurityException, TException { // do not expect users to call this directly, expect other tservers to call this method if (!security.canPerformSystemActions(credentials)) { throw new AccumuloSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED).asThriftException(); } ServerConfigurationFactory factory = context.getServerConfFactory(); ExecutorService spe = resourceManager.getSummaryRemoteExecutor(); Future<SummaryCollection> future = new Gatherer(context, request, factory.getTableConfiguration(Table.ID.of(request.getTableId())), context.getCryptoService()).processPartition(spe, modulus, remainder); return startSummaryOperation(credentials, future); }
protected Table.ID getTableId(AccumuloClient client, String tableName) throws TableNotFoundException { TableOperations tops = client.tableOperations(); if (!client.tableOperations().exists(tableName)) { throw new TableNotFoundException(null, tableName, null); } String tableId = null; while (tableId == null) { tableId = tops.tableIdMap().get(tableName); if (tableId == null) { sleepUninterruptibly(200, TimeUnit.MILLISECONDS); } } return Table.ID.of(tableId); }
private static Table.ID busiest(Map<String,TableInfo> tables) { Table.ID result = null; double busiest = Double.NEGATIVE_INFINITY; for (Entry<String,TableInfo> entry : tables.entrySet()) { TableInfo info = entry.getValue(); double busy = info.ingestRate + info.queryRate; if (busy > busiest) { busiest = busy; result = Table.ID.of(entry.getKey()); } } return result; }
public static Table.ID toTableId(ByteBuffer bytes) { return Table.ID.of(toString(bytes)); }
@Override public void readFields(DataInput in) throws IOException { if (in.readBoolean()) { this.peerName = WritableUtils.readString(in); } if (in.readBoolean()) { this.remoteIdentifier = WritableUtils.readString(in); } if (in.readBoolean()) { this.sourceTableId = Table.ID.of(WritableUtils.readString(in)); } }
public static void addBulkLoadInProgressFlag(ServerContext 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(Table.ID.of("anythingNotMetadata"), null, null)); }
/** * Extract the table ID from the colfam * * @param k * Key to extract from */ public static Table.ID getTableId(Key k) { requireNonNull(k); return Table.ID.of(k.getColumnQualifier().toString()); }
public static ProblemReport decodeMetadataEntry(Entry<Key,Value> entry) throws IOException { Table.ID tableId = Table.ID.of(entry.getKey().getRow().toString().substring("~err_".length())); String problemType = entry.getKey().getColumnFamily().toString(); String resource = entry.getKey().getColumnQualifier().toString(); return new ProblemReport(tableId, ProblemType.valueOf(problemType), resource, entry.getValue().get()); }
/** * Extract the table ID from the key (inefficiently if called repeatedly) * * @param k * Key to extract from * @return The table ID */ public static Table.ID getTableId(Key k) { requireNonNull(k); return Table.ID.of(k.getColumnQualifier().toString()); }
@Override public Path getFullPath(Key key) { // TODO sanity check col fam String relPath = key.getColumnQualifierData().toString(); byte[] tableId = KeyExtent.tableOfMetadataRow(key.getRow()); return getFullPath(Table.ID.of(new String(tableId)), relPath); }
@VisibleForTesting static TabletMetadata create(String id, String prevEndRow, String endRow) { TabletMetadata te = new TabletMetadata(); te.tableId = Table.ID.of(id); te.sawPrevEndRow = true; te.prevEndRow = prevEndRow == null ? null : new Text(prevEndRow); te.endRow = endRow == null ? null : new Text(endRow); te.fetchedCols = EnumSet.of(FetchedColumns.PREV_ROW); return te; } }
public static void removeBulkLoadInProgressFlag(ServerContext 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(Table.ID.of("anythingNotMetadata"), null, null)); }
public static MetadataServicer forTableName(ClientContext context, String tableName) throws AccumuloException, AccumuloSecurityException { checkArgument(tableName != null, "tableName is null"); return forTableId(context, Table.ID.of(context.tableOperations().tableIdMap().get(tableName))); }
static ProblemReport decodeZooKeeperEntry(ServerContext context, String node) throws IOException, KeeperException, InterruptedException { byte bytes[] = Encoding.decodeBase64FileName(node); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); DataInputStream dis = new DataInputStream(bais); Table.ID tableId = Table.ID.of(dis.readUTF()); String problemType = dis.readUTF(); String resource = dis.readUTF(); String zpath = context.getZooKeeperRoot() + Constants.ZPROBLEMS + "/" + node; byte[] enc = context.getZooReaderWriter().getData(zpath, null); return new ProblemReport(tableId, ProblemType.valueOf(problemType), resource, enc); }
public KeyExtent(TKeyExtent tke) { this.setTableId(Table.ID.of(new String(ByteBufferUtil.toBytes(tke.table), UTF_8))); this.setEndRow(tke.endRow == null ? null : new Text(ByteBufferUtil.toBytes(tke.endRow)), false, false); this.setPrevEndRow( tke.prevEndRow == null ? null : new Text(ByteBufferUtil.toBytes(tke.prevEndRow)), false, false); check(); }
private void updateTableStateCache() { synchronized (tableStateCache) { for (String tableId : zooStateCache.getChildren(zkRoot + Constants.ZTABLES)) if (zooStateCache .get(zkRoot + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_STATE) != null) updateTableStateCache(Table.ID.of(tableId)); } }