Refine search
if ((scanWithNoLowerBound || isLastRegion || Bytes.compareTo(startRow, endKey) < 0) && (scanWithNoUpperBound || Bytes.compareTo(stopRow, startKey) > 0)) { final byte[] splitStart = scanWithNoLowerBound || Bytes.compareTo(startKey, startRow) >= 0 ? startKey : startRow; final byte[] splitStop = (scanWithNoUpperBound || Bytes.compareTo(endKey, stopRow) <= 0) && !isLastRegion ? endKey : stopRow; int id = splits.size(); final TableInputSplit split = new TableInputSplit(id, hosts, table.getTableName(), splitStart, splitStop); splits.add(split);
Mutation mutation = allMutationList.get(i); long sameRowMutationSizeBytes = PhoenixKeyValueUtil.calculateMutationDiskSize(mutation); sameRowList.add(mutation); while (i + 1 < allMutationList.size() && Bytes.compareTo(allMutationList.get(i + 1).getRow(), mutation.getRow()) == 0) { Mutation sameRowMutation = allMutationList.get(i + 1); sameRowList.add(sameRowMutation); sameRowMutationSizeBytes += PhoenixKeyValueUtil.calculateMutationDiskSize(sameRowMutation); sameRowBatchSize++; currentBatchSizeBytes + sameRowMutationSizeBytes > batchSizeBytes) { if (currentList.size() > 0) { mutationBatchList.add(currentList); currentList = Lists.newArrayList(); currentBatchSizeBytes = 0L;
final boolean reload) throws IOException { final boolean endKeyIsEndOfTable = Bytes.equals(endKey,HConstants.EMPTY_END_ROW); if ((Bytes.compareTo(startKey, endKey) > 0) && !endKeyIsEndOfTable) { throw new IllegalArgumentException( "Invalid range: " + Bytes.toStringBinary(startKey) + do { HRegionLocation regionLocation = getRegionLocator().getRegionLocation(currentKey, reload); keysInRange.add(currentKey); regionsInRange.add(regionLocation); currentKey = regionLocation.getRegionInfo().getEndKey(); } while (!Bytes.equals(currentKey, HConstants.EMPTY_END_ROW) && (endKeyIsEndOfTable || Bytes.compareTo(currentKey, endKey) < 0 || (includeEndKey && Bytes.compareTo(currentKey, endKey) == 0))); return new Pair<>(keysInRange, regionsInRange);
endPos = ScanUtil.searchClosestKeyRangeWithUpperHigherThanPtr(slots.get(0), ptr, startPos); if (endPos == 0 && Bytes.compareTo(upperExclusiveKey, slots.get(0).get(0).getLowerRange()) <= 0) { return false; newSlots.add(slots.get(0).subList(startPos, endPos+1)); newSlots.addAll(slots.subList(1, slots.size())); if (Bytes.compareTo(startKey, 0, startKeyLength, upperExclusiveKey, 0, upperExclusiveKey.length) == 0 && (previousPosition(lastSlot) < 0 || position[0] < lowerPosition[0])) { newSlots.add(newRanges);
invalidRanges.add(ranges.get(0)); if ((Bytes.compareTo(lastStopRow, range.startRow) > 0) || (Bytes.compareTo(lastStopRow, range.startRow) == 0 && !(lastStopRowInclusive == false && range.isStartRowInclusive() == false))) { if(Bytes.equals(range.stopRow, HConstants.EMPTY_BYTE_ARRAY)) { if (Bytes.compareTo(lastStopRow, range.stopRow) >= 0) { if((Bytes.compareTo(lastStopRow, range.stopRow) == 0)) { if(lastStopRowInclusive == true || range.stopRowInclusive == true) { lastStopRowInclusive = true; break; while ((Bytes.compareTo(lastStopRow, range.startRow) > 0) || (Bytes.compareTo(lastStopRow, range.startRow) == 0 && (lastStopRowInclusive == true || range.startRowInclusive==true))) { if(Bytes.equals(range.stopRow, HConstants.EMPTY_BYTE_ARRAY)) { if (Bytes.compareTo(lastStopRow, range.stopRow) >= 0) { if(lastStopRowInclusive == true || range.stopRowInclusive == true) { lastStopRowInclusive = true; if((Bytes.compareTo(lastStopRow, range.startRow) < 0) || (Bytes.compareTo(lastStopRow, range.startRow) == 0 && lastStopRowInclusive == false && range.startRowInclusive == false)) { newRanges.add(new RowRange(lastStartRow, lastStartRowInclusive, lastStopRow,
int pkCount = getVarChars(key, rowKeyMetaData); if (pkCount > COLUMN_NAME_INDEX && Bytes.compareTo(schemaName, rowKeyMetaData[SCHEMA_NAME_INDEX]) == 0 && Bytes.compareTo(tableName, rowKeyMetaData[TABLE_NAME_INDEX]) == 0 ) { PColumn columnToDelete = null; try { additionalTableMetaData.add(new Delete(indexKey, clientTimeStamp, null)); byte[] linkKey = MetaDataUtil.getParentLinkKey(tenantId, schemaName, tableName, index.getTableName().getBytes()); additionalTableMetaData.add(new Delete(linkKey, clientTimeStamp, null)); doDropTable(indexKey, tenantId, index.getSchemaName().getBytes(), index.getTableName().getBytes(), index.getType(), additionalTableMetaData, invalidateList, lids, tableNamesToDelete); invalidateList.add(new ImmutableBytesPtr(indexKey));
tableMaps.put(tableName, scanList); scanList.add(scan); Bytes.compareTo(startRow, keys.getSecond()[i]) < 0) && (stopRow.length == 0 || Bytes.compareTo(stopRow, keys.getFirst()[i]) > 0)) { byte[] splitStart = startRow.length == 0 || Bytes.compareTo(keys.getFirst()[i], startRow) >= 0 ? keys.getFirst()[i] : startRow; byte[] splitStop = (stopRow.length == 0 || Bytes.compareTo(keys.getSecond()[i], stopRow) <= 0) && keys.getSecond()[i].length > 0 ? keys.getSecond()[i] : stopRow; encodedRegionName, regionSize); splits.add(split);
final boolean endKeyIsEndOfTable = Bytes.equals(endKey, HConstants.EMPTY_END_ROW); if ((Bytes.compareTo(startKey, endKey) > 0) && !endKeyIsEndOfTable) { throw new IllegalArgumentException("Invalid range: " + Bytes.toStringBinary(startKey) + " > " HRegionLocation regionLocation = id < rl.size() ? rl.getRegionLocation(id) : null; if (regionLocation != null && regionLocation.getRegionInfo().containsRow(currentKey)) { regionList.add(regionLocation); } else { throw new DoNotRetryIOException("Does hbase:meta exist hole? Locating row " && (endKeyIsEndOfTable || Bytes.compareTo(currentKey, endKey) < 0)); return regionList;
public void addRegionInfo(HbckInfo hir) { if (Bytes.equals(hir.getEndKey(), HConstants.EMPTY_END_ROW)) { // end key is absolute end key, just add it. // ignore replicas other than primary for these checks if (hir.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID) sc.add(hir); return; } // if not the absolute end key, check for cycle if (Bytes.compareTo(hir.getStartKey(), hir.getEndKey()) > 0) { errors.reportError( ERROR_CODE.REGION_CYCLE, String.format("The endkey for this region comes before the " + "startkey, startkey=%s, endkey=%s", Bytes.toStringBinary(hir.getStartKey()), Bytes.toStringBinary(hir.getEndKey())), this, hir); backwards.add(hir); return; } // main case, add to split calculator // ignore replicas other than primary for these checks if (hir.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID) sc.add(hir); }
HConstants.EMPTY_BYTE_ARRAY, HConstants.EMPTY_BYTE_ARRAY, regLoc .getHostnamePort().split(Addressing.HOSTNAME_PORT_SEPARATOR)[0], regionSize); splits.add(split); return splits; Bytes.compareTo(startRow, keys.getSecond()[i]) < 0) && (stopRow.length == 0 || Bytes.compareTo(stopRow, keys.getFirst()[i]) > 0)) { byte[] splitStart = startRow.length == 0 || Bytes.compareTo(keys.getFirst()[i], startRow) >= 0 ? keys.getFirst()[i] : startRow; byte[] splitStop = (stopRow.length == 0 || Bytes.compareTo(keys.getSecond()[i], stopRow) <= 0) && keys.getSecond()[i].length > 0 ? keys.getSecond()[i] : stopRow; TableSplit split = new TableSplit(tableName, scan, splitStart, splitStop, regionLocation, encodedRegionName, regionSize); splits.add(split); if (LOG.isDebugEnabled()) { LOG.debug("getSplits: split -> " + i + " -> " + split);
Put put = new Put(ROW_1); put.addColumn(FAMILYA, QUALIFIER_1, VALUE_1); puts.add(put); put = new Put(ROW_2); put.addColumn(FAMILYA, QUALIFIER_1, VALUE_1); puts.add(put); put = new Put(ROW_3); put.addColumn(FAMILYA, QUALIFIER_1, VALUE_1); puts.add(put); put = new Put(ROW_4); put.addColumn(FAMILYA, QUALIFIER_1, VALUE_1); Result current = iterator.next(); if (lastResult != null) { assertTrue(Bytes.compareTo(lastResult.getRow(), current.getRow()) > 0);
private List<HRegionLocation> getRegionsInRange(TableName tableName, byte[] startKey, byte[] endKey) throws IOException { List<HRegionLocation> regionsInRange = new ArrayList<>(); byte[] currentKey = startKey; final boolean endKeyIsEndOfTable = Bytes.equals(endKey, HConstants.EMPTY_END_ROW); try (RegionLocator r = TEST_UTIL.getConnection().getRegionLocator(tableName)) { do { HRegionLocation regionLocation = r.getRegionLocation(currentKey); regionsInRange.add(regionLocation); currentKey = regionLocation.getRegionInfo().getEndKey(); } while (!Bytes.equals(currentKey, HConstants.EMPTY_END_ROW) && (endKeyIsEndOfTable || Bytes.compareTo(currentKey, endKey) < 0)); return regionsInRange; } }
for (Cell kv : expectedKVs) { if (startRow.length > 0 && Bytes.compareTo(kv.getRowArray(), kv.getRowOffset(), kv.getRowLength(), startRow, 0, startRow.length) < 0) { continue; Bytes.compareTo(kv.getRowArray(), kv.getRowOffset(), kv.getRowLength(), endRow, 0, endRow.length) > 0) { continue; final int newNumVer = curNumVer != null ? (curNumVer + 1) : 1; if (newNumVer <= maxVersions) { filteredKVs.add(kv); verCount.put(rowColStr, newNumVer);
} else { boundedScan.withStartRow( Bytes.compareTo(scan.getStartRow(), sp[i]) > 0 ? scan.getStartRow() : sp[i]); } else { boundedScan.withStopRow( Bytes.compareTo(scan.getStopRow(), sp[i + 1]) < 0 ? scan.getStopRow() : sp[i + 1]); splits.add(new InputSplit(htd, hri, hosts, boundedScan, restoreDir)); List<String> hosts = calculateLocationsForInputSplit(conf, htd, hri, tableDir, localityEnabled); splits.add(new InputSplit(htd, hri, hosts, scan, restoreDir));
Get get = new Get(k); get.addColumn(BYTES_FAMILY, QUALIFIER); gets.add(get); singleRes.add(table.get((Get) get)); for (int j = 0; j < singleKvs.length; j++) { Assert.assertEquals(singleKvs[j], multiKvs[j]); Assert.assertEquals(0, Bytes.compareTo(CellUtil.cloneValue(singleKvs[j]), CellUtil.cloneValue(multiKvs[j])));
try (ResultScanner scanner = table.getScanner(scan)) { for (Result r : scanner) { scanResults.add(r); Cell scanCell = scanResult.rawCells()[i]; Cell getCell = getResult.rawCells()[i]; assertEquals(0, Bytes.compareTo(CellUtil.cloneRow(scanCell), CellUtil.cloneRow(getCell))); assertEquals(0, Bytes.compareTo(CellUtil.cloneFamily(scanCell), CellUtil.cloneFamily(getCell))); assertEquals(0, Bytes.compareTo(CellUtil.cloneQualifier(scanCell), CellUtil.cloneQualifier(getCell))); assertEquals(0, Bytes.compareTo(CellUtil.cloneValue(scanCell), CellUtil.cloneValue(getCell)));