/** * @param maxSize the target size of elements in the queue * @param blockSize expected average size of blocks */ public LruCachedBlockQueue(long maxSize, long blockSize) { int initialSize = (int)(maxSize / blockSize); if(initialSize == 0) initialSize++; queue = MinMaxPriorityQueue.expectedSize(initialSize).create(); heapSize = 0; this.maxSize = maxSize; }
@Override public void insertNewFiles(Collection<HStoreFile> sfs) throws IOException { this.storefiles = ImmutableList.sortedCopyOf(storeFileComparator, Iterables.concat(this.storefiles, sfs)); }
@Override public Collection<HStoreFile> clearCompactedFiles() { List<HStoreFile> result = compactedfiles; compactedfiles = ImmutableList.of(); return result; }
synchronized List<LogMessage> getMessages() { // defensive copy return Lists.newArrayList(messages); }
@Override protected Set<String> getColumnFamilies() { return Sets.newHashSet(FAMILY_NAME); }
/** * Returns a view of all tables that reside in a namespace with a namespace * quota, grouped by the namespace itself. */ public Multimap<String,TableName> getTablesByNamespace() { Multimap<String,TableName> tablesByNS = HashMultimap.create(); for (TableName tn : tablesWithNamespaceQuotas) { tablesByNS.put(tn.getNamespaceAsString(), tn); } return tablesByNS; }
protected Map<String, Collection<Scan>> getSnapshotScanMapping(final List<Scan> scans) { return Multimaps.index(scans, new Function<Scan, String>() { @Nullable @Override public String apply(Scan input) { return snapshotNameForTable( Bytes.toStringBinary(input.getAttribute(Scan.SCAN_ATTRIBUTES_TABLE_NAME))); } }).asMap(); }
@Override public Iterable<FileStatus> getDeletableFiles(Iterable<FileStatus> files) { return Iterables.filter(files, this::isFileDeletable); }
@Override public int getCompactedFilesCount() { return state.allCompactedFilesCached.size(); }
private <K,V> Entry<K,V> entry(K k, V v) { return Maps.immutableEntry(k, v); } }
/** * @return The last element in this queue, or {@code null} if the queue is * empty. */ public LruCachedBlock pollLast() { return queue.pollLast(); }
/** * Is the znode of any meta replica * @param node * @return true or false */ public boolean isAnyMetaReplicaZNode(String node) { if (metaReplicaZNodes.containsValue(node)) { return true; } return false; }
public CreateTableProcedure(final MasterProcedureEnv env, final TableDescriptor tableDescriptor, final RegionInfo[] newRegions, final ProcedurePrepareLatch syncLatch) { super(env, syncLatch); this.tableDescriptor = tableDescriptor; this.newRegions = newRegions != null ? Lists.newArrayList(newRegions) : null; }
@Override public final int getCompactedFilesCount() { return compactedfiles.size(); }
/** * @return The last element in this queue, or {@code null} if the queue is * empty. */ public Map.Entry<BlockCacheKey, BucketEntry> pollLast() { return queue.pollLast(); }
@Override public int getStorefileCount() { return state.allFilesCached.size(); }
@Override public final int getStorefileCount() { return storefiles.size(); }
@Override public int getStoreCompactionPriority() { int priority = blockingFileCount - storefiles.size(); return (priority == HStore.PRIORITY_USER) ? priority + 1 : priority; }