/** * @param splitRow * @return A {@link Reference} that points at top half of a an hfile */ public static Reference createTopReference(final byte [] splitRow) { return new Reference(splitRow, Range.top); }
/** * @param splitRow * @return A {@link Reference} that points at the bottom half of a an hfile */ public static Reference createBottomReference(final byte [] splitRow) { return new Reference(splitRow, Range.bottom); }
public static Reference convert(final FSProtos.Reference r) { Reference result = new Reference(); result.splitkey = r.getSplitkey().toByteArray(); result.region = r.getRange() == FSProtos.Reference.Range.TOP? Range.top: Range.bottom; return result; }
Reference r = new Reference(); DataInputStream dis = new DataInputStream(in);
/** * @param splitRow * @return A {@link Reference} that points at top half of a an hfile */ public static Reference createTopReference(final byte [] splitRow) { return new Reference(splitRow, Range.top); }
/** * @param splitRow * @return A {@link Reference} that points at the bottom half of a an hfile */ public static Reference createBottomReference(final byte [] splitRow) { return new Reference(splitRow, Range.bottom); }
/** * Split a storefile into a top and bottom half, maintaining * the metadata, recreating bloom filters, etc. */ static void splitStoreFile( Configuration conf, Path inFile, HColumnDescriptor familyDesc, byte[] splitKey, Path bottomOut, Path topOut) throws IOException { // Open reader with no block cache, and not in-memory Reference topReference = new Reference(splitKey, Range.top); Reference bottomReference = new Reference(splitKey, Range.bottom); copyHFileHalf(conf, inFile, topOut, topReference, familyDesc); copyHFileHalf(conf, inFile, bottomOut, bottomReference, familyDesc); }
/** * Read a Reference from FileSystem. * @param fs * @param p * @return New Reference made from passed <code>p</code> * @throws IOException */ public static Reference read(final FileSystem fs, final Path p) throws IOException { FSDataInputStream in = fs.open(p); try { Reference r = new Reference(); r.readFields(in); return r; } finally { in.close(); } } }
/** * Write out a split reference. Package local so it doesnt leak out of * regionserver. * @param fs * @param splitDir Presumes path format is actually * <code>SOME_DIRECTORY/REGIONNAME/FAMILY</code>. * @param f File to split. * @param splitRow * @param range * @return Path to created reference. * @throws IOException */ static Path split(final FileSystem fs, final Path splitDir, final StoreFile f, final byte [] splitRow, final Reference.Range range) throws IOException { // A reference to the bottom half of the hsf store file. Reference r = new Reference(splitRow, range); // Add the referred-to regions name as a dot separated suffix. // See REF_NAME_REGEX regex above. The referred-to regions name is // up in the path of the passed in <code>f</code> -- parentdir is family, // then the directory above is the region name. String parentRegionName = f.getPath().getParent().getParent().getName(); // Write reference with same file id only with the other region name as // suffix and into the new region location (under same family). Path p = new Path(splitDir, f.getPath().getName() + "." + parentRegionName); return r.write(fs, p); }
public static Reference convert(final FSProtos.Reference r) { Reference result = new Reference(); result.splitkey = r.getSplitkey().toByteArray(); result.region = r.getRange() == FSProtos.Reference.Range.TOP? Range.top: Range.bottom; return result; }
Reference r = new Reference(); DataInputStream dis = new DataInputStream(in);