try { reader.loadFileInfo(); first = reader.getFirstRowKey().get(); last = reader.getLastRowKey().get(); LOG.debug("Trying to figure out region boundaries hfile=" + hfile + " first="
@Override public void bulkHFile(ColumnFamilyDescriptorBuilder builder, FileStatus hfileStatus) throws IOException { Path hfile = hfileStatus.getPath(); try (HFile.Reader reader = HFile.createReader(fs, hfile, CacheConfig.DISABLED, true, getConf())) { if (builder.getCompressionType() != reader.getFileContext().getCompression()) { builder.setCompressionType(reader.getFileContext().getCompression()); LOG.info("Setting compression " + reader.getFileContext().getCompression().name() + " for family " + builder.getNameAsString()); } reader.loadFileInfo(); byte[] first = reader.getFirstRowKey().get(); byte[] last = reader.getLastRowKey().get(); LOG.info("Trying to figure out region boundaries hfile=" + hfile + " first=" + Bytes.toStringBinary(first) + " last=" + Bytes.toStringBinary(last)); // To eventually infer start key-end key boundaries Integer value = map.containsKey(first) ? map.get(first) : 0; map.put(first, value + 1); value = map.containsKey(last) ? map.get(last) : 0; map.put(last, value - 1); } } });
CacheConfig.DISABLED, true, getConf())) { hfr.loadFileInfo(); first = hfr.getFirstRowKey(); last = hfr.getLastRowKey(); } catch (FileNotFoundException fnfe) {
try { hfr.loadFileInfo(); first = hfr.getFirstRowKey(); last = hfr.getLastRowKey(); } finally {
first = reader.getFirstRowKey(); last = reader.getLastRowKey();
reader.loadFileInfo(); byte[] firstKey = reader.getFirstRowKey(); Preconditions.checkState(firstKey != null, "First key can not be null"); byte[] lk = reader.getLastKey();
try { hfr.loadFileInfo(); first = hfr.getFirstRowKey(); last = hfr.getLastRowKey(); } finally {
reader.loadFileInfo(); byte[] firstKey = reader.getFirstRowKey(); byte[] lk = reader.getLastKey(); byte[] lastKey =
@Override public void bulkHFile(final HColumnDescriptor hcd, final FileStatus hfileStatus) throws IOException { Path hfile = hfileStatus.getPath(); HFile.Reader reader = HFile.createReader(fs, hfile, new CacheConfig(getConf()), getConf()); try { if (hcd.getCompressionType() != reader.getFileContext().getCompression()) { hcd.setCompressionType(reader.getFileContext().getCompression()); LOG.info("Setting compression " + hcd.getCompressionType().name() + " for family " + hcd.toString()); } reader.loadFileInfo(); byte[] first = reader.getFirstRowKey(); byte[] last = reader.getLastRowKey(); LOG.info("Trying to figure out region boundaries hfile=" + hfile + " first=" + Bytes.toStringBinary(first) + " last=" + Bytes.toStringBinary(last)); // To eventually infer start key-end key boundaries Integer value = map.containsKey(first)? map.get(first):0; map.put(first, value+1); value = map.containsKey(last)? map.get(last):0; map.put(last, value-1); } finally { reader.close(); } } });
delId.setStartKey(reader.getFirstRowKey().get()); delId.setEndKey(reader.getLastRowKey().get()); compactionPartition.setStartKey(reader.getFirstRowKey().get()); compactionPartition.setEndKey(reader.getLastRowKey().get());
reader.loadFileInfo(); Optional<byte[]> firstKey = reader.getFirstRowKey(); Preconditions.checkState(firstKey.isPresent(), "First key can not be null"); Optional<Cell> lk = reader.getLastKey();