private static byte[][] getMetricsTableSplits(int splits) { RowKeyDistributorByHashPrefix rowKeyDistributor = new RowKeyDistributorByHashPrefix( new RowKeyDistributorByHashPrefix.OneByteSimpleHash(splits)); return rowKeyDistributor.getSplitKeys(splits, splits); }
private boolean hasNext() throws IOException { if (next != null) { return true; } next = nextInternal(); return next != null; }
@Override public Result next() throws IOException { if (hasNext()) { Result toReturn = next; next = null; return toReturn; } return null; }
/** * Creates a {@link AbstractRowKeyDistributor} based on the meta data in the given {@link HTableDescriptor}. */ private AbstractRowKeyDistributor createKeyDistributor(HTableDescriptor htd) { int buckets = QueueConstants.DEFAULT_ROW_KEY_BUCKETS; String value = htd.getValue(QueueConstants.DISTRIBUTOR_BUCKETS); if (value != null) { buckets = Integer.parseInt(value); } return new RowKeyDistributorByHashPrefix( new RowKeyDistributorByHashPrefix.OneByteSimpleHash(buckets)); } }
public IdentityHashDistributorTestRun() { super(new RowKeyDistributorByHashPrefix(new IdentityHash())); }
public MultiBytesPrefixHashDistributorTestRun() { super(new RowKeyDistributorByHashPrefix(new MultiBytesPrefixHash())); }
@Override public byte[] apply(byte[] input) { return rowKeyDistributor.getOriginalKey(input); } };
@Override public byte[] getActualRowKey(ConsumerConfig consumerConfig, byte[] originalRowKey) { return rowKeyDistributor.getDistributedKey(originalRowKey); }
@Override public byte[][] getAllDistributedKeys(byte[] originalKey) { return getAllDistributedKeys(originalKey, maxPrefix); }
@Override public Result next() { // since hasNext() does the real advancing, we call this to determine // if there is a next before proceeding. if (!hasNext()) { return null; } // if we get to here, then hasNext() has given us an item to return. // we want to return the item and then null out the next pointer, so // we use a temporary variable. Result temp = next; next = null; return temp; }
public RowKeyDistributorByOneBytePrefixTestRun() { super(new RowKeyDistributorByOneBytePrefix((byte) 12)); } }
@BeforeClass public static void init() throws Exception { RowKeyDistributorTestBase.beforeClass(); RowKeyDistributorTestBase.runBefore = false; RowKeyDistributorTestBase.runAfter = false; }
private static byte[][] getV3MetricsTableSplits(int splits) { RowKeyDistributorByHashPrefix rowKeyDistributor = new RowKeyDistributorByHashPrefix( new RowKeyDistributorByHashPrefix.OneByteSimpleHash(splits)); return rowKeyDistributor.getSplitKeys(splits, splits); }
public OneByteSimpleHashDistributorTestRun() { super(new RowKeyDistributorByHashPrefix(new RowKeyDistributorByHashPrefix.OneByteSimpleHash(15))); } }
private byte[] createDistributedRowKey(byte[] row) { return rowKeyDistributor == null ? row : rowKeyDistributor.getDistributedKey(row); }
private boolean hasNext() throws IOException { if (next != null) { return true; } next = nextInternal(); return next != null; }
@Override public Result next() throws IOException { if (hasNext()) { Result toReturn = next; next = null; return toReturn; } return null; }
@Override public byte[][] getAllDistributedKeys(byte[] originalKey) { return getAllDistributedKeys(originalKey, maxPrefix); }
@Override public Result next() { // since hasNext() does the real advancing, we call this to determine // if there is a next before proceeding. if (!hasNext()) { return null; } // if we get to here, then hasNext() has given us an item to return. // we want to return the item and then null out the next pointer, so // we use a temporary variable. Result temp = next; next = null; return temp; }
private byte[] createDistributedRowKey(byte[] row) { return rowKeyDistributor == null ? row : rowKeyDistributor.getDistributedKey(row); }