@Test public void testClearFiles() throws Exception { StripeStoreFileManager manager = createManager(); manager.insertNewFiles(al(createFile())); manager.insertNewFiles(al(createFile())); manager.addCompactionResults(al(), al(createFile(OPEN_KEY, KEY_B), createFile(KEY_B, OPEN_KEY))); assertEquals(4, manager.getStorefileCount()); Collection<StoreFile> allFiles = manager.clearFiles(); assertEquals(4, allFiles.size()); assertEquals(0, manager.getStorefileCount()); assertEquals(0, manager.getStorefiles().size()); }
@Override public ImmutableCollection<StoreFile> clearFiles() { ImmutableCollection<StoreFile> result = state.allFilesCached; this.state = new State(); this.fileStarts.clear(); this.fileEnds.clear(); return result; }
StripeStoreFileManager implements StoreFileManager, StripeCompactionPolicy.StripeInformationProvider { @Override public ImmutableCollection<StoreFile> clearFiles() { ImmutableCollection<StoreFile> result = state.allFilesCached; this.state = new State(); this.fileStarts.clear(); this.fileEnds.clear(); return result; } }
StripeStoreFileManager implements StoreFileManager, StripeCompactionPolicy.StripeInformationProvider { @Override public ImmutableCollection<StoreFile> clearFiles() { ImmutableCollection<StoreFile> result = state.allFilesCached; this.state = new State(); this.fileStarts.clear(); this.fileEnds.clear(); return result; } StripeStoreFileManager(
      KVComparator kvComparator, Configuration conf, StripeStoreConfig config); }
StripeStoreFileManager implements StoreFileManager, StripeCompactionPolicy.StripeInformationProvider { @Override public ImmutableCollection<StoreFile> clearFiles() { ImmutableCollection<StoreFile> result = state.allFilesCached; this.state = new State(); this.fileStarts.clear(); this.fileEnds.clear(); return result; } StripeStoreFileManager(
      KVComparator kvComparator, Configuration conf, StripeStoreConfig config); @Override void loadFiles(List<StoreFile> storeFiles); @Override Collection<StoreFile> getStorefiles(); @Override void insertNewFiles(Collection<StoreFile> sfs); @Override ImmutableCollection<StoreFile> clearFiles(); @Override int getStorefileCount(); @Override Iterator<StoreFile> getCandidateFilesForRowKeyBefore(final KeyValue targetKey); @Override Iterator<StoreFile> updateCandidateFilesForRowKeyBefore(
      Iterator<StoreFile> candidateFiles, final KeyValue targetKey, final KeyValue candidate); @Override /** * Override of getSplitPoint that determines the split point as the boundary between two * stripes, unless it causes significant imbalance between split sides' sizes. In that * case, the split boundary will be chosen from the middle of one of the stripes to * minimize imbalance. * @return The split point, or null if no split is possible. */ byte[] getSplitPoint(); @Override Collection<StoreFile> getFilesForScanOrGet(
      boolean isGet, byte[] startRow, byte[] stopRow); @Override void addCompactionResults(
    Collection<StoreFile> compactedFiles, Collection<StoreFile> results); @Override int getStoreCompactionPriority(); @Override final byte[] getStartRow(int stripeIndex); @Override final byte[] getEndRow(int stripeIndex); @Override List<StoreFile> getLevel0Files(); @Override List<byte[]> getStripeBoundaries(); @Override ArrayList<ImmutableList<StoreFile>> getStripes(); @Override int getStripeCount(); @Override Collection<StoreFile> getUnneededFiles(long maxTs, List<StoreFile> filesCompacting); }
StripeStoreFileManager implements StoreFileManager, StripeCompactionPolicy.StripeInformationProvider { @Override public ImmutableCollection<StoreFile> clearFiles() { ImmutableCollection<StoreFile> result = state.allFilesCached; this.state = new State(); this.fileStarts.clear(); this.fileEnds.clear(); return result; } StripeStoreFileManager(
      KVComparator kvComparator, Configuration conf, StripeStoreConfig config); @Override void loadFiles(List<StoreFile> storeFiles); @Override Collection<StoreFile> getStorefiles(); @Override void insertNewFiles(Collection<StoreFile> sfs); @Override ImmutableCollection<StoreFile> clearFiles(); @Override int getStorefileCount(); @Override Iterator<StoreFile> getCandidateFilesForRowKeyBefore(final KeyValue targetKey); @Override Iterator<StoreFile> updateCandidateFilesForRowKeyBefore(
      Iterator<StoreFile> candidateFiles, final KeyValue targetKey, final KeyValue candidate); @Override /** * Override of getSplitPoint that determines the split point as the boundary between two * stripes, unless it causes significant imbalance between split sides' sizes. In that * case, the split boundary will be chosen from the middle of one of the stripes to * minimize imbalance. * @return The split point, or null if no split is possible. */ byte[] getSplitPoint(); @Override Collection<StoreFile> getFilesForScanOrGet(
      boolean isGet, byte[] startRow, byte[] stopRow); @Override void addCompactionResults(
    Collection<StoreFile> compactedFiles, Collection<StoreFile> results); @Override int getStoreCompactionPriority(); @Override final byte[] getStartRow(int stripeIndex); @Override final byte[] getEndRow(int stripeIndex); @Override List<StoreFile> getLevel0Files(); @Override List<byte[]> getStripeBoundaries(); @Override ArrayList<ImmutableList<StoreFile>> getStripes(); @Override int getStripeCount(); @Override Collection<StoreFile> getUnneededFiles(long maxTs, List<StoreFile> filesCompacting); static final byte[] STRIPE_START_KEY; static final byte[] STRIPE_END_KEY; final static byte[] OPEN_KEY; }