Esempio n. 1
0
 public static void verifySizeCompaction(
     KeyValue[] input,
     int targetCount,
     long targetSize,
     byte[] left,
     byte[] right,
     KeyValue[][] output)
     throws Exception {
   StoreFileWritersCapture writers = new StoreFileWritersCapture();
   StripeCompactor sc = createCompactor(writers, input);
   List<Path> paths =
       sc.compact(
           createDummyRequest(),
           targetCount,
           targetSize,
           left,
           right,
           null,
           null,
           NoLimitCompactionThroughputController.INSTANCE);
   assertEquals(output.length, paths.size());
   writers.verifyKvs(output, true, true);
   List<byte[]> boundaries = new ArrayList<byte[]>();
   boundaries.add(left);
   for (int i = 1; i < output.length; ++i) {
     boundaries.add(CellUtil.cloneRow(output[i][0]));
   }
   boundaries.add(right);
   writers.verifyBoundaries(boundaries.toArray(new byte[][] {}));
 }
Esempio n. 2
0
 public static void verifyBoundaryCompaction(
     KeyValue[] input,
     byte[][] boundaries,
     KeyValue[][] output,
     byte[] majorFrom,
     byte[] majorTo,
     boolean allFiles)
     throws Exception {
   StoreFileWritersCapture writers = new StoreFileWritersCapture();
   StripeCompactor sc = createCompactor(writers, input);
   List<Path> paths =
       sc.compact(
           createDummyRequest(),
           Arrays.asList(boundaries),
           majorFrom,
           majorTo,
           NoLimitCompactionThroughputController.INSTANCE);
   writers.verifyKvs(output, allFiles, true);
   if (allFiles) {
     assertEquals(output.length, paths.size());
     writers.verifyBoundaries(boundaries);
   }
 }