static Comparator<TableDescriptor> getComparator(Comparator<ColumnFamilyDescriptor> cfComparator) { return (TableDescriptor lhs, TableDescriptor rhs) -> { int result = lhs.getTableName().compareTo(rhs.getTableName()); if (result != 0) { return result; } Collection<ColumnFamilyDescriptor> lhsFamilies = Arrays.asList(lhs.getColumnFamilies()); Collection<ColumnFamilyDescriptor> rhsFamilies = Arrays.asList(rhs.getColumnFamilies()); result = Integer.compare(lhsFamilies.size(), rhsFamilies.size()); if (result != 0) { return result; } for (Iterator<ColumnFamilyDescriptor> it = lhsFamilies.iterator(), it2 = rhsFamilies.iterator(); it.hasNext();) { result = cfComparator.compare(it.next(), it2.next()); if (result != 0) { return result; } } // punt on comparison for ordering, just calculate difference return Integer.compare(lhs.getValues().hashCode(), rhs.getValues().hashCode()); }; }
@Override public boolean visit(Result r) throws IOException { if (r == null || r.isEmpty()) return true; count.incrementAndGet(); RegionInfo info = MetaTableAccessor.getRegionInfo(r); if (info == null) return true; // Keep scanning if (isTableSpecified && info.getTable().compareTo(tableName) > 0) { // Another table, stop scanning return false; } if (LOG.isTraceEnabled()) LOG.trace("" + info + " IS-SPLIT_PARENT=" + info.isSplitParent()); if (info.isSplitParent()) splitParents.put(info, r); if (r.getValue(HConstants.CATALOG_FAMILY, HConstants.MERGEA_QUALIFIER) != null) { mergedRegions.put(info, r); } // Returning true means "keep scanning" return true; } };
if (name.compareTo(TableName.META_TABLE_NAME) == 0) { continue;
/** * Compares this split against the given one. * * @param split The split to compare to. * @return The result of the comparison. * @see java.lang.Comparable#compareTo(java.lang.Object) */ @Override public int compareTo(TableSplit split) { // If The table name of the two splits is the same then compare start row // otherwise compare based on table names int tableNameComparison = getTable().compareTo(split.getTable()); return tableNameComparison != 0 ? tableNameComparison : Bytes.compareTo( getStartRow(), split.getStartRow()); }
@Override public int compare(RegionInfo left, RegionInfo right) { // This comparator differs from the one RegionInfo in that it sorts // parent before daughters. if (left == null) return -1; if (right == null) return 1; // Same table name. int result = left.getTable().compareTo(right.getTable()); if (result != 0) return result; // Compare start keys. result = Bytes.compareTo(left.getStartKey(), right.getStartKey()); if (result != 0) return result; // Compare end keys, but flip the operands so parent comes first result = rowEndKeyComparator.compare(right.getEndKey(), left.getEndKey()); return result; } }
int tableCompare = l.getTableName().compareTo(r.getTableName()); if (tableCompare != 0) { return tableCompare;
private static int compareRegionInfosWithoutReplicaId(RegionInfo regionInfoA, RegionInfo regionInfoB) { int result = regionInfoA.getTable().compareTo(regionInfoB.getTable()); if (result != 0) { return result;
static Comparator<TableDescriptor> getComparator(Comparator<ColumnFamilyDescriptor> cfComparator) { return (TableDescriptor lhs, TableDescriptor rhs) -> { int result = lhs.getTableName().compareTo(rhs.getTableName()); if (result != 0) { return result; } Collection<ColumnFamilyDescriptor> lhsFamilies = Arrays.asList(lhs.getColumnFamilies()); Collection<ColumnFamilyDescriptor> rhsFamilies = Arrays.asList(rhs.getColumnFamilies()); result = Integer.compare(lhsFamilies.size(), rhsFamilies.size()); if (result != 0) { return result; } for (Iterator<ColumnFamilyDescriptor> it = lhsFamilies.iterator(), it2 = rhsFamilies.iterator(); it.hasNext();) { result = cfComparator.compare(it.next(), it2.next()); if (result != 0) { return result; } } // punt on comparison for ordering, just calculate difference return Integer.compare(lhs.getValues().hashCode(), rhs.getValues().hashCode()); }; }
int result = lhs.getTable().compareTo(rhs.getTable()); if (result != 0) { return result;
private static int compareRegionInfosWithoutReplicaId(RegionInfo regionInfoA, RegionInfo regionInfoB) { int result = regionInfoA.getTable().compareTo(regionInfoB.getTable()); if (result != 0) { return result;
static Comparator<TableDescriptor> getComparator(Comparator<ColumnFamilyDescriptor> cfComparator) { return (TableDescriptor lhs, TableDescriptor rhs) -> { int result = lhs.getTableName().compareTo(rhs.getTableName()); if (result != 0) { return result; } Collection<ColumnFamilyDescriptor> lhsFamilies = Arrays.asList(lhs.getColumnFamilies()); Collection<ColumnFamilyDescriptor> rhsFamilies = Arrays.asList(rhs.getColumnFamilies()); result = Integer.compare(lhsFamilies.size(), rhsFamilies.size()); if (result != 0) { return result; } for (Iterator<ColumnFamilyDescriptor> it = lhsFamilies.iterator(), it2 = rhsFamilies.iterator(); it.hasNext();) { result = cfComparator.compare(it.next(), it2.next()); if (result != 0) { return result; } } // punt on comparison for ordering, just calculate difference return Integer.compare(lhs.getValues().hashCode(), rhs.getValues().hashCode()); }; }
@Override public boolean processRow(Result r) throws IOException { if (r == null || r.isEmpty()) return true; count.incrementAndGet(); HRegionInfo info = HRegionInfo.getHRegionInfo(r); if (info == null) return true; // Keep scanning if (isTableSpecified && info.getTable().compareTo(tableName) > 0) { // Another table, stop scanning return false; } if (info.isSplitParent()) splitParents.put(info, r); if (r.getValue(HConstants.CATALOG_FAMILY, HConstants.MERGEA_QUALIFIER) != null) { mergedRegions.put(info, r); } // Returning true means "keep scanning" return true; } };
@Override public boolean processRow(Result row) throws IOException { HRegionInfo info = MetaScanner.getHRegionInfo(row); if (info != null && !info.isSplitParent()) { if (tableName.equals(info.getTable())) { ServerName server = HRegionInfo.getServerName(row); if (server == null) { available.set(false); return false; } regionCount.incrementAndGet(); } else if (tableName.compareTo(info.getTable()) < 0) { // Return if we are done with the current table return false; } } return true; } };
int result = lhs.getTable().compareTo(rhs.getTable()); if (result != 0) { return result;
/** * Compares this split against the given one. * * @param split The split to compare to. * @return The result of the comparison. * @see java.lang.Comparable#compareTo(java.lang.Object) */ @Override public int compareTo(TableSplit split) { // If The table name of the two splits is the same then compare start row // otherwise compare based on table names int tableNameComparison = getTable().compareTo(split.getTable()); return tableNameComparison != 0 ? tableNameComparison : Bytes.compareTo( getStartRow(), split.getStartRow()); }
/** * Compares this split against the given one. * * @param split The split to compare to. * @return The result of the comparison. * @see java.lang.Comparable#compareTo(java.lang.Object) */ @Override public int compareTo(TableSplit split) { // If The table name of the two splits is the same then compare start row // otherwise compare based on table names int tableNameComparison = getTable().compareTo(split.getTable()); return tableNameComparison != 0 ? tableNameComparison : Bytes.compareTo( getStartRow(), split.getStartRow()); }
@Override public int compare(HRegionInfo left, HRegionInfo right) { // This comparator differs from the one HRegionInfo in that it sorts // parent before daughters. if (left == null) return -1; if (right == null) return 1; // Same table name. int result = left.getTable().compareTo(right.getTable()); if (result != 0) return result; // Compare start keys. result = Bytes.compareTo(left.getStartKey(), right.getStartKey()); if (result != 0) return result; // Compare end keys, but flip the operands so parent comes first result = rowEndKeyComparator.compare(right.getEndKey(), left.getEndKey()); return result; } }
@Override public boolean processRow(Result row) throws IOException { HRegionInfo info = MetaScanner.getHRegionInfo(row); if (info != null && !info.isSplitParent()) { if (tableName.equals(info.getTable())) { ServerName server = HRegionInfo.getServerName(row); if (server == null) { available.set(false); return false; } if (!Bytes.equals(info.getStartKey(), HConstants.EMPTY_BYTE_ARRAY)) { for (byte[] splitKey : splitKeys) { // Just check if the splitkey is available if (Bytes.equals(info.getStartKey(), splitKey)) { regionCount.incrementAndGet(); break; } } } else { // Always empty start row should be counted regionCount.incrementAndGet(); } } else if (tableName.compareTo(info.getTable()) < 0) { // Return if we are done with the current table return false; } } return true; } };
@Override public int compareTo(BigtableExtendedScanSplit o) { // If The table name of the two splits is the same then compare start row // otherwise compare based on table names int tableNameComparison = name.compareTo(o.name); return tableNameComparison != 0 ? tableNameComparison : Bytes.compareTo( scan.getRowSet().getRowRanges(0).getStartKeyClosed().toByteArray(), o.scan.getRowSet().getRowRanges(0).getStartKeyClosed().toByteArray()); }
private static int compareRegionInfosWithoutReplicaId(RegionInfo regionInfoA, RegionInfo regionInfoB) { int result = regionInfoA.getTable().compareTo(regionInfoB.getTable()); if (result != 0) { return result;