@Test public void testJustFindLogsDirectory() throws Exception { long period = Long.MAX_VALUE; Path snapshotDir = SnapshotDescriptionUtils.getSnapshotsDir(rootDir); SnapshotFileCache cache = new SnapshotFileCache(fs, rootDir, period, 10000000, "test-snapshot-file-cache-refresh", new SnapshotFileCache.SnapshotFileInspector() { public Collection<String> filesUnderSnapshot(final Path snapshotDir) throws IOException { return SnapshotReferenceUtil.getHLogNames(fs, snapshotDir); } }); SnapshotDescription desc = SnapshotDescription.newBuilder().setName("snapshot").build(); Path snapshot = SnapshotDescriptionUtils.getCompletedSnapshotDir(desc, rootDir); SnapshotDescriptionUtils.writeSnapshotInfo(desc, snapshot, fs); Path file1 = new Path(new Path(new Path(snapshot, "7e91021"), "fam"), "file1"); fs.createNewFile(file1); Path logs = getSnapshotHLogsDir(snapshot, "server"); Path log = new Path(logs, "me.hbase.com%2C58939%2C1350424310315.1350424315552"); fs.createNewFile(log); FSUtils.logFileSystemState(fs, rootDir, LOG); assertFalse("Cache found '" + file1 + "', but it shouldn't have.", cache.contains(file1.getName())); assertTrue("Cache didn't find:" + log, cache.contains(log.getName())); }
public synchronized boolean contains(String fileName) throws IOException { boolean hasFile = this.cache.contains(fileName); if (!hasFile) { refreshCache(); hasFile = this.cache.contains(fileName); } return hasFile; }
SnapshotFileCache implements Stoppable { public synchronized boolean contains(String fileName) throws IOException { boolean hasFile = this.cache.contains(fileName); if (!hasFile) { refreshCache(); hasFile = this.cache.contains(fileName); } return hasFile; } }
SnapshotFileCache implements Stoppable { public synchronized boolean contains(String fileName) throws IOException { boolean hasFile = this.cache.contains(fileName); if (!hasFile) { refreshCache(); hasFile = this.cache.contains(fileName); } return hasFile; } SnapshotFileCache(Configuration conf, long cacheRefreshPeriod, String refreshThreadName,
      SnapshotFileInspector inspectSnapshotFiles);  SnapshotFileCache(FileSystem fs, Path rootDir, long cacheRefreshPeriod,
      long cacheRefreshDelay, String refreshThreadName, SnapshotFileInspector inspectSnapshotFiles); }
SnapshotFileCache implements Stoppable { public synchronized boolean contains(String fileName) throws IOException { boolean hasFile = this.cache.contains(fileName); if (!hasFile) { refreshCache(); hasFile = this.cache.contains(fileName); } return hasFile; } SnapshotFileCache(Configuration conf, long cacheRefreshPeriod, String refreshThreadName,
      SnapshotFileInspector inspectSnapshotFiles);  SnapshotFileCache(FileSystem fs, Path rootDir, long cacheRefreshPeriod,
      long cacheRefreshDelay, String refreshThreadName, SnapshotFileInspector inspectSnapshotFiles); void triggerCacheRefreshForTesting(); synchronized boolean contains(String fileName); @Override void stop(String why); @Override boolean isStopped(); }
SnapshotFileCache implements Stoppable { public synchronized boolean contains(String fileName) throws IOException { boolean hasFile = this.cache.contains(fileName); if (!hasFile) { refreshCache(); hasFile = this.cache.contains(fileName); } return hasFile; } SnapshotFileCache(Configuration conf, long cacheRefreshPeriod, String refreshThreadName,
      SnapshotFileInspector inspectSnapshotFiles);  SnapshotFileCache(FileSystem fs, Path rootDir, long cacheRefreshPeriod,
      long cacheRefreshDelay, String refreshThreadName, SnapshotFileInspector inspectSnapshotFiles); void triggerCacheRefreshForTesting(); synchronized boolean contains(String fileName); @Override void stop(String why); @Override boolean isStopped();  }