private void doGets(HRegion region) throws IOException { for (int i = 0; i < NUM_ROWS; ++i) { final byte[] rowKey = MultiThreadedWriter.longToByteArrayKey(i); for (int j = 0; j < NUM_COLS_PER_ROW; ++j) { final String qualStr = String.valueOf(j); if (VERBOSE) { System.err.println( "Reading row " + i + ", column " + j + " " + Bytes.toString(rowKey) + "/" + qualStr); } final byte[] qualBytes = Bytes.toBytes(qualStr); Get get = new Get(rowKey); get.addColumn(CF_BYTES, qualBytes); Result result = region.get(get, null); assertEquals(1, result.size()); assertTrue( LoadTestKVGenerator.verify( Bytes.toString(rowKey), qualStr, result.getValue(CF_BYTES, qualBytes))); } } }
private void doPuts(HRegion region) throws IOException { LoadTestKVGenerator dataGenerator = new LoadTestKVGenerator(MIN_VALUE_SIZE, MAX_VALUE_SIZE); for (int i = 0; i < NUM_ROWS; ++i) { byte[] key = MultiThreadedWriter.longToByteArrayKey(i); for (int j = 0; j < NUM_COLS_PER_ROW; ++j) { Put put = new Put(key); String colAsStr = String.valueOf(j); byte[] col = Bytes.toBytes(colAsStr); byte[] value = dataGenerator.generateRandomSizeValue(i, colAsStr); put.add(CF_BYTES, Bytes.toBytes(colAsStr), value); if (VERBOSE) { KeyValue kvPut = new KeyValue(key, CF_BYTES, col, value); System.err.println(Strings.padFront(i + "", ' ', 4) + " " + kvPut); } region.put(put); } if (i % NUM_ROWS_PER_FLUSH == 0) { region.flushcache(); } } }