Refine search
private static List<RegionInfo> getListOfRegionInfos( final List<Pair<RegionInfo, ServerName>> pairs) { if (pairs == null || pairs.isEmpty()) { return Collections.emptyList(); } List<RegionInfo> result = new ArrayList<>(pairs.size()); for (Pair<RegionInfo, ServerName> pair : pairs) { result.add(pair.getFirst()); } return result; }
private static void getSortedTagOrdinals(List<List<Integer>> fullTagsList, Tag tag) throws IOException { List<Integer> tagsOrdinalInSortedOrder = new ArrayList<>(); int offset = tag.getValueOffset(); int endOffset = offset + tag.getValueLength(); while (offset < endOffset) { Pair<Integer, Integer> result = TagUtil.readVIntValuePart(tag, offset); tagsOrdinalInSortedOrder.add(result.getFirst()); offset += result.getSecond(); } Collections.sort(tagsOrdinalInSortedOrder); fullTagsList.add(tagsOrdinalInSortedOrder); }
private static List<RegionInfo> testGettingTableRegions(final Connection connection, final TableName name, final int regionCount) throws IOException, InterruptedException { List<RegionInfo> regions = MetaTableAccessor.getTableRegions(connection, name); assertEquals(regionCount, regions.size()); Pair<RegionInfo, ServerName> pair = MetaTableAccessor.getRegion(connection, regions.get(0).getRegionName()); assertEquals(regions.get(0).getEncodedName(), pair.getFirst().getEncodedName()); return regions; }
List<RegionInfo> initialRegions = new ArrayList<>(); for (Pair<RegionInfo, ServerName> p : initialRegionToServers) { initialRegions.add(p.getFirst()); currentRegions.add(p.getFirst()); assertTrue(!initialRegions.contains(currentRegions.get(0))); //this is the new region assertTrue(!initialRegions.contains(RegionReplicaUtil.getRegionInfoForReplica( currentRegions.get(0), 1))); //replica of the new region assertTrue(currentRegions.contains(RegionReplicaUtil.getRegionInfoForReplica( currentRegions.get(0), 1))); //replica of the new region assertTrue(!currentRegions.contains(RegionReplicaUtil.getRegionInfoForReplica( mergedRegions.getFirst(), 1))); //replica of the merged region
if (!filesCompacting.isEmpty()) { LOG.debug("Not selecting compaction: " + filesCompacting.size() + " files compacting"); return null; if (StoreUtils.hasReferences(allFiles)) { LOG.debug("There are references in the store; compacting all files"); long targetKvs = estimateTargetKvs(allFiles, config.getInitialCount()).getFirst(); SplitStripeCompactionRequest request = new SplitStripeCompactionRequest( allFiles, OPEN_KEY, OPEN_KEY, targetKvs); boolean shouldCompactL0 = (this.config.getLevel0MinFiles() <= l0Files.size()); if (stripeCount == 0) { if (!shouldCompactL0) return null; // nothing to do. boolean canDropDeletesNoL0 = l0Files.isEmpty(); if (shouldCompactL0) { if (!canDropDeletesNoL0) { if (result != null) return result; LOG.debug("Selecting L0 compaction with " + l0Files.size() + " files"); return new BoundaryStripeCompactionRequest(l0Files, si.getStripeBoundaries());
/** * Used to get all region locations for the specific table. * @param metaTable * @param tableName table we're looking for, can be null for getting all regions * @return the list of region locations. The return value will be wrapped by a * {@link CompletableFuture}. */ public static CompletableFuture<List<HRegionLocation>> getTableHRegionLocations( AsyncTable<AdvancedScanResultConsumer> metaTable, Optional<TableName> tableName) { CompletableFuture<List<HRegionLocation>> future = new CompletableFuture<>(); getTableRegionsAndLocations(metaTable, tableName, true).whenComplete( (locations, err) -> { if (err != null) { future.completeExceptionally(err); } else if (locations == null || locations.isEmpty()) { future.complete(Collections.emptyList()); } else { List<HRegionLocation> regionLocations = locations.stream() .map(loc -> new HRegionLocation(loc.getFirst(), loc.getSecond())) .collect(Collectors.toList()); future.complete(regionLocations); } }); return future; }
@Override protected Pair<List<LoadQueueItem>, String> groupOrSplit( Multimap<ByteBuffer, LoadQueueItem> regionGroups, final LoadQueueItem item, final Table htable, final Pair<byte[][], byte[][]> startEndKeys) throws IOException { Pair<List<LoadQueueItem>, String> lqis = super.groupOrSplit(regionGroups, item, htable, startEndKeys); if (lqis != null && lqis.getFirst() != null) { countedLqis.addAndGet(lqis.getFirst().size()); } return lqis; } };
/** * This is the client side interface/handle for calling the std method for a * given cf-cq combination. It was necessary to add one more call stack as its * return type should be a decimal value, irrespective of what * columninterpreter says. So, this methods collects the necessary parameters * to compute the std and returns the double value. * @param table table to scan. * @param ci the user's ColumnInterpreter implementation * @param scan the HBase scan object to use to read data from HBase * @return <R, S> * @throws Throwable The caller is supposed to handle the exception as they are thrown * & propagated to it. */ public <R, S, P extends Message, Q extends Message, T extends Message> double std( final Table table, ColumnInterpreter<R, S, P, Q, T> ci, Scan scan) throws Throwable { Pair<List<S>, Long> p = getStdArgs(table, ci, scan); double res = 0d; double avg = ci.divideForAvg(p.getFirst().get(0), p.getSecond()); double avgOfSumSq = ci.divideForAvg(p.getFirst().get(1), p.getSecond()); res = avgOfSumSq - (avg) * (avg); // variance res = Math.pow(res, 0.5); return res; }
private static List<RegionInfo> getListOfRegionInfos( final List<Pair<RegionInfo, ServerName>> pairs) { if (pairs == null || pairs.isEmpty()) { return Collections.emptyList(); } List<RegionInfo> result = new ArrayList<>(pairs.size()); for (Pair<RegionInfo, ServerName> pair : pairs) { result.add(pair.getFirst()); } return result; }
logsToArchive = new ArrayList<>(); logsToArchive.add(Pair.newPair(log, e.getValue().logSize)); if (LOG.isTraceEnabled()) { LOG.trace("WAL file ready for archiving " + log); this.totalLogSize.addAndGet(-logAndSize.getSecond()); archiveLogFile(logAndSize.getFirst()); this.walFile2Props.remove(logAndSize.getFirst());
private void moveRegion(Table table, int index) throws IOException{ List<Pair<RegionInfo, ServerName>> regions = MetaTableAccessor .getTableRegionsAndLocations(TEST_UTIL.getConnection(), table.getName()); assertEquals(1, regions.size()); RegionInfo regionInfo = regions.get(0).getFirst(); ServerName name = TEST_UTIL.getHBaseCluster().getRegionServer(index).getServerName(); TEST_UTIL.getAdmin().move(regionInfo.getEncodedNameAsBytes(), Bytes.toBytes(name.getServerName())); }
ReplicationStorageFactory.getReplicationQueueStorage(server.getZooKeeper(), conf); files.add("log1"); files.add("log2"); for (String file : files) { queueStorage.addWAL(server.getServerName(), "1", file); queueStorage.claimQueue(serverName, unclaimed.get(0), s1.getServerName()); queueStorage.removeReplicatorIfQueueIsEmpty(serverName); queueStorage.claimQueue(serverName, unclaimed.get(0), s2.getServerName()); queueStorage.removeReplicatorIfQueueIsEmpty(serverName); unclaimed = queueStorage.getAllQueues(serverName); String queue3 = queueStorage.claimQueue(serverName, unclaimed.get(0), s3.getServerName()).getFirst(); queueStorage.removeReplicatorIfQueueIsEmpty(serverName);
private StripeCompactionRequest selectNewStripesCompaction(StripeInformationProvider si) { List<HStoreFile> l0Files = si.getLevel0Files(); Pair<Long, Integer> kvsAndCount = estimateTargetKvs(l0Files, config.getInitialCount()); LOG.debug("Creating " + kvsAndCount.getSecond() + " initial stripes with " + kvsAndCount.getFirst() + " kvs each via L0 compaction of " + l0Files.size() + " files"); SplitStripeCompactionRequest request = new SplitStripeCompactionRequest( si.getLevel0Files(), OPEN_KEY, OPEN_KEY, kvsAndCount.getSecond(), kvsAndCount.getFirst()); request.setMajorRangeFull(); // L0 only, can drop deletes. return request; }
if (!masterRegions.isEmpty()) { for (RegionInfo region: masterRegions) { regionSet.remove(region); Map<ServerName, List<RegionInfo>> regionsWithFavoredNodesMap = segregatedRegions.getFirst(); Map<ServerName, List<RegionInfo>> regionsWithoutFN = generateFNForRegionsWithoutFN(helper, segregatedRegions.getSecond());
@Override protected Pair<List<LoadQueueItem>, String> groupOrSplit( Multimap<ByteBuffer, LoadQueueItem> regionGroups, final LoadQueueItem item, final Table htable, final Pair<byte[][], byte[][]> startEndKeys) throws IOException { Pair<List<LoadQueueItem>, String> lqis = super.groupOrSplit(regionGroups, item, htable, startEndKeys); if (lqis != null && lqis.getFirst() != null) { countedLqis.addAndGet(lqis.getFirst().size()); } return lqis; } };
regionsToMerge[0] = tableRegions.get(0); regionsToMerge[1] = tableRegions.get(1); MetaTableAccessor.getRegionsFromMergeQualifier(UTIL.getConnection(), proc.getMergedRegion().getRegionName()); assertTrue(pair.getFirst() != null && pair.getSecond() != null); while (pair != null && pair.getFirst() != null && pair.getSecond() != null) { pair = MetaTableAccessor.getRegionsFromMergeQualifier(UTIL.getConnection(), proc.getMergedRegion().getRegionName());