@Override public boolean test(String tableName) { return !Namespace.ACCUMULO.equals(qualify(tableName).getFirst()); }
double calculateRate() { double totalRate = 0; for (Entry<String,Pair<Long,Long>> entry : prevSamples.entrySet()) { Pair<Long,Long> prevSample = entry.getValue(); Pair<Long,Long> sample = samples.get(entry.getKey()); totalRate += (sample.getSecond() - prevSample.getSecond()) / ((sample.getFirst() - prevSample.getFirst()) / (double) 1000); } return totalRate; }
/** * @param tableName * the original specified table * @param e * indicates that a table wasn't found because the namespace specified in the table name * wasn't found */ public TableNotFoundException(String tableName, NamespaceNotFoundException e) { this(null, tableName, "Namespace " + Tables.qualify(tableName).getFirst() + " does not exist.", e); }
@Override protected void pruneTables(Set<String> tables) { Iterator<String> tableNames = tables.iterator(); while (tableNames.hasNext()) { String table = tableNames.next(); Pair<String,String> qualifiedName = Tables.qualify(table); if (Namespace.ACCUMULO.equals(qualifiedName.getFirst())) { log.trace("Removing table from deletion set: {}", table); tableNames.remove(); } } } }
public Entry<A,B> toMapEntry() { return new SimpleImmutableEntry<>(getFirst(), getSecond()); }
@Override public Key getTopKey() { return hasTop() ? keys.get(keyPos).getFirst() : null; }
public Map<String,String> toTablePropertiesMap() { LinkedHashMap<String,String> propsMap = new LinkedHashMap<>(); for (Pair<String,String> pair : toTableProperties()) { propsMap.put(pair.getFirst(), pair.getSecond()); } return propsMap; }
public Map<Path,WalState> getAllState() throws WalMarkerException { Map<Path,WalState> result = new HashMap<>(); for (Entry<TServerInstance,List<UUID>> entry : getAllMarkers().entrySet()) { for (UUID id : entry.getValue()) { // This function is called by the Accumulo GC which deletes WAL markers. Therefore we do not // expect the following call to fail because the WAL info in ZK was deleted. Pair<WalState,Path> state = state(entry.getKey(), id); result.put(state.getSecond(), state.getFirst()); } } return result; }
public static List<Table.ID> getTableIds(ClientContext context, Namespace.ID namespaceId) throws NamespaceNotFoundException { String namespace = getNamespaceName(context, namespaceId); List<Table.ID> tableIds = new LinkedList<>(); for (Entry<String,Table.ID> nameToId : Tables.getNameToIdMap(context).entrySet()) if (namespace.equals(Tables.qualify(nameToId.getKey()).getFirst())) tableIds.add(nameToId.getValue()); return tableIds; }
private long removeFiles(Collection<Pair<WalState,Path>> collection, final GCStatus status) { for (Pair<WalState,Path> stateFile : collection) { Path path = stateFile.getSecond(); log.debug("Removing {} WAL {}", stateFile.getFirst(), path); status.currentLog.deleted += removeFile(path); } return status.currentLog.deleted; }
private AccumuloConfiguration createSampleConfig(AccumuloConfiguration siteConf) { ConfigurationCopy confCopy = new ConfigurationCopy(Iterables.filter(siteConf, input -> !input.getKey().startsWith(Property.TABLE_SAMPLER.getKey()))); for (Entry<String,String> entry : samplerRef.get().getFirst().toTablePropertiesMap() .entrySet()) { confCopy.set(entry.getKey(), entry.getValue()); } siteConf = confCopy; return siteConf; }
public static List<String> getTableNames(ClientContext context, Namespace.ID namespaceId) throws NamespaceNotFoundException { String namespace = getNamespaceName(context, namespaceId); List<String> names = new LinkedList<>(); for (String name : Tables.getNameToIdMap(context).keySet()) if (namespace.equals(Tables.qualify(name).getFirst())) names.add(name); return names; }
public CloneZookeeper(CloneInfo cloneInfo, ClientContext context) throws NamespaceNotFoundException { this.cloneInfo = cloneInfo; this.cloneInfo.namespaceId = Namespaces.getNamespaceId(context, Tables.qualify(this.cloneInfo.tableName).getFirst()); }
public Pair<B,A> swap() { return new Pair<>(getSecond(), getFirst()); }
public static String qualified(String tableName, String defaultNamespace) { Pair<String,String> qualifiedTableName = qualify(tableName, defaultNamespace); if (Namespace.DEFAULT.equals(qualifiedTableName.getFirst())) return qualifiedTableName.getSecond(); else return qualifiedTableName.toString("", ".", ""); }
private void writeBuffer(String destPath, List<Pair<LogFileKey,LogFileValue>> buffer, int part) throws IOException { Path path = new Path(destPath, String.format("part-r-%05d", part)); FileSystem ns = fs.getVolumeByPath(path).getFileSystem(); try (MapFile.Writer output = new MapFile.Writer(ns.getConf(), ns.makeQualified(path), MapFile.Writer.keyClass(LogFileKey.class), MapFile.Writer.valueClass(LogFileValue.class))) { Collections.sort(buffer, Comparator.comparing(Pair::getFirst)); for (Pair<LogFileKey,LogFileValue> entry : buffer) { output.append(entry.getFirst(), entry.getSecond()); } } }
@Override public void setSamplerConfiguration(String tableName, SamplerConfiguration samplerConfiguration) throws AccumuloException, TableNotFoundException, AccumuloSecurityException { clearSamplerOptions(tableName); List<Pair<String,String>> props = new SamplerConfigurationImpl(samplerConfiguration) .toTableProperties(); for (Pair<String,String> pair : props) { setProperty(tableName, pair.getFirst(), pair.getSecond()); } }