@Override public Collection<HStoreFile> getFilesForScan(byte[] startRow, boolean includeStartRow, byte[] stopRow, boolean includeStopRow) { if (state.stripeFiles.isEmpty()) { return state.level0Files; // There's just L0. } int firstStripe = findStripeForRow(startRow, true); int lastStripe = findStripeForRow(stopRow, false); assert firstStripe <= lastStripe; if (firstStripe == lastStripe && state.level0Files.isEmpty()) { return state.stripeFiles.get(firstStripe); // There's just one stripe we need. } if (firstStripe == 0 && lastStripe == (state.stripeFiles.size() - 1)) { return state.allFilesCached; // We need to read all files. } ConcatenatedLists<HStoreFile> result = new ConcatenatedLists<>(); result.addAllSublists(state.stripeFiles.subList(firstStripe, lastStripe + 1)); result.addSublist(state.level0Files); return result; }
private Optional<byte[]> getSplitPointFromAllFiles() throws IOException { ConcatenatedLists<HStoreFile> sfs = new ConcatenatedLists<>(); sfs.addSublist(state.level0Files); sfs.addAllSublists(state.stripeFiles); return StoreUtils.getSplitPoint(sfs, cellComparator); }
@Test @SuppressWarnings("unchecked") public void testManyMany() { ConcatenatedLists<Long> c = new ConcatenatedLists<>(); c.addAllSublists(Arrays.asList(Arrays.asList(0L, 1L))); c.addSublist(Arrays.asList(2L, 3L, 4L)); c.addAllSublists(Arrays.asList(Arrays.asList(5L), Arrays.asList(6L, 7L))); verify(c, 7); }
@Test @SuppressWarnings("unchecked") public void testManyOne() { ConcatenatedLists<Long> c = new ConcatenatedLists<>(); c.addSublist(Arrays.asList(0L)); c.addAllSublists(Arrays.asList(Arrays.asList(1L), Arrays.asList(2L))); verify(c, 2); }
sfs.addAllSublists(stripes); sfs.addSublist(l0Files); when(si.getStorefiles()).thenReturn(sfs);
int endIndex = bestStart + bestLength - 1; ConcatenatedLists<HStoreFile> sfs = new ConcatenatedLists<>(); sfs.addAllSublists(stripes.subList(bestStart, endIndex + 1)); SplitStripeCompactionRequest result = new SplitStripeCompactionRequest(sfs, si.getStartRow(bestStart), si.getEndRow(endIndex), 1, Long.MAX_VALUE);
@Override public Collection<StoreFile> getFilesForScanOrGet( boolean isGet, byte[] startRow, byte[] stopRow) { if (state.stripeFiles.isEmpty()) { return state.level0Files; // There's just L0. } int firstStripe = findStripeForRow(startRow, true); int lastStripe = findStripeForRow(stopRow, false); assert firstStripe <= lastStripe; if (firstStripe == lastStripe && state.level0Files.isEmpty()) { return state.stripeFiles.get(firstStripe); // There's just one stripe we need. } if (firstStripe == 0 && lastStripe == (state.stripeFiles.size() - 1)) { return state.allFilesCached; // We need to read all files. } ConcatenatedLists<StoreFile> result = new ConcatenatedLists<StoreFile>(); result.addAllSublists(state.stripeFiles.subList(firstStripe, lastStripe + 1)); result.addSublist(state.level0Files); return result; }
@Test @SuppressWarnings("unchecked") public void testManyMany() { ConcatenatedLists<Long> c = new ConcatenatedLists<>(); c.addAllSublists(Arrays.asList(Arrays.asList(0L, 1L))); c.addSublist(Arrays.asList(2L, 3L, 4L)); c.addAllSublists(Arrays.asList(Arrays.asList(5L), Arrays.asList(6L, 7L))); verify(c, 7); }
@Test @SuppressWarnings("unchecked") public void testManyMany() { ConcatenatedLists<Long> c = new ConcatenatedLists<>(); c.addAllSublists(Arrays.asList(Arrays.asList(0L, 1L))); c.addSublist(Arrays.asList(2L, 3L, 4L)); c.addAllSublists(Arrays.asList(Arrays.asList(5L), Arrays.asList(6L, 7L))); verify(c, 7); }
@Test @SuppressWarnings("unchecked") public void testManyOne() { ConcatenatedLists<Long> c = new ConcatenatedLists<>(); c.addSublist(Arrays.asList(0L)); c.addAllSublists(Arrays.asList(Arrays.asList(1L), Arrays.asList(2L))); verify(c, 2); }
private byte[] getSplitPointFromAllFiles() throws IOException { ConcatenatedLists<StoreFile> sfs = new ConcatenatedLists<StoreFile>(); sfs.addSublist(state.level0Files); sfs.addAllSublists(state.stripeFiles); if (sfs.isEmpty()) return null; return StoreUtils.getLargestFile(sfs).getFileSplitPoint(this.kvComparator); }
@Test @SuppressWarnings("unchecked") public void testManyOne() { ConcatenatedLists<Long> c = new ConcatenatedLists<>(); c.addSublist(Arrays.asList(0L)); c.addAllSublists(Arrays.asList(Arrays.asList(1L), Arrays.asList(2L))); verify(c, 2); }
sfs.addAllSublists(stripes); sfs.addSublist(l0Files); when(si.getStorefiles()).thenReturn(sfs);
int endIndex = bestStart + bestLength - 1; ConcatenatedLists<StoreFile> sfs = new ConcatenatedLists<StoreFile>(); sfs.addAllSublists(stripes.subList(bestStart, endIndex + 1)); SplitStripeCompactionRequest result = new SplitStripeCompactionRequest(sfs, si.getStartRow(bestStart), si.getEndRow(endIndex), 1, Long.MAX_VALUE);