private TabletMetadata getTabletFiles(Range nextRange) { try (TabletsMetadata tablets = TabletsMetadata.builder().scanMetadataTable() .overRange(nextRange).fetchFiles().fetchLocation().fetchPrev().build(context)) { return tablets.iterator().next(); } }
public boolean hasCurrent() { ensureFetched(FetchedColumns.LOCATION); return location != null && location.getType() == LocationType.CURRENT; }
/** * Obtain tablet metadata by scanning the metadata table. Defaults to the range * {@link TabletsSection#getRange()} */ default RangeOptions scanMetadataTable() { return scanTable(MetadataTable.NAME); }
private static Iterable<TabletMetadata> createCloneScanner(String testTableName, Table.ID tableId, AccumuloClient client) throws TableNotFoundException { String tableName; Range range; if (testTableName != null) { tableName = testTableName; range = TabletsSection.getRange(tableId); } else if (tableId.equals(MetadataTable.ID)) { tableName = RootTable.NAME; range = TabletsSection.getRange(); } else { tableName = MetadataTable.NAME; range = TabletsSection.getRange(tableId); } return TabletsMetadata.builder().scanTable(tableName).overRange(range).checkConsistency() .saveKeyValues().fetchFiles().fetchLocation().fetchLast().fetchCloned().fetchPrev() .fetchTime().build(client); }
private int countFiles() { // TODO use a batch scanner + iterator to parallelize counting files return TabletsMetadata.builder().forTable(tableId).overlapping(startRow, endRow).fetchFiles() .fetchPrev().build(ctx).stream().mapToInt(tm -> tm.getFiles().size()).sum(); }
@VisibleForTesting protected Stream<KeyExtent> lookupExtents(Text row) throws TableNotFoundException, AccumuloException, AccumuloSecurityException { return TabletsMetadata.builder().forTable(tableId).overlapping(row, null).checkConsistency() .fetchPrev().build(ctx).stream().limit(100).map(TabletMetadata::getExtent); }
@Override public RangeOptions scanTable(String tableName) { this.table = tableName; this.range = TabletsSection.getRange(); return this; } }
public TServerInstance(Location location) { this(location.getHostAndPort(), location.getSession()); }
public Location getLast() { ensureFetched(FetchedColumns.LAST); return last; }
public String getTime() { ensureFetched(FetchedColumns.TIME); return time; }
public boolean sawPrevEndRow() { ensureFetched(FetchedColumns.PREV_ROW); return sawPrevEndRow; }
public Map<String,DataFileValue> getFilesMap() { ensureFetched(FetchedColumns.FILES); return files; }
public String getDir() { ensureFetched(FetchedColumns.DIR); return dir; }
public Set<String> getLoaded() { ensureFetched(FetchedColumns.LOADED); return loadedFiles; }
public Collection<LogEntry> getLogs() { ensureFetched(FetchedColumns.LOGS); return logs; }
public OptionalLong getFlushId() { ensureFetched(FetchedColumns.FLUSH_ID); return flush; }
public OptionalLong getCompactId() { ensureFetched(FetchedColumns.COMPACT_ID); return compact; }
public Location getLocation() { ensureFetched(FetchedColumns.LOCATION); return location; }
public List<String> getScans() { ensureFetched(FetchedColumns.SCANS); return scans; }
public String getCloned() { ensureFetched(FetchedColumns.CLONED); return cloned; }