NameNode.LOG.info("Caching file names occurring more than " + threshold + " times"); nameCache = new NameCache<ByteArray>(threshold); namesystem = ns; this.editLog = ns.getEditLog();
FSDirectory(FSImage fsImage, FSNamesystem ns, Configuration conf) { rootDir = new INodeDirectoryWithQuota(INodeDirectory.ROOT_NAME, ns.createFsOwnerPermissions(new FsPermission((short)0755)), Integer.MAX_VALUE, Long.MAX_VALUE); this.fsImage = fsImage; this.fsImage.setFSNamesystem(ns); int configuredLimit = conf.getInt( "dfs.ls.limit", 1000); this.lsLimit = configuredLimit>0 ? configuredLimit : 1000; int threshold = conf.getInt( "dfs.namenode.name.cache.threshold", 10); NameNode.LOG.info("Caching file names occuring more than " + threshold + " times "); nameCache = new NameCache<ByteArray>(threshold); initialize(conf); }
NameNode.LOG.info("Caching file names occuring more than " + threshold + " times"); nameCache = new NameCache<ByteArray>(threshold); namesystem = ns; this.editLog = ns.getEditLog();
NameNode.LOG.info("Caching file names occuring more than " + threshold + " times"); nameCache = new NameCache<ByteArray>(threshold); namesystem = ns; this.editLog = ns.getEditLog();
@Test public void testDictionary() throws Exception { // Create dictionary with useThreshold 2 NameCache<String> cache = new NameCache<String>(2); String[] matching = {"part1", "part10000000", "fileabc", "abc", "filepart"}; String[] notMatching = {"spart1", "apart", "abcd", "def"}; for (String s : matching) { // Add useThreshold times so the names are promoted to dictionary cache.put(s); assertTrue(s == cache.put(s)); } for (String s : notMatching) { // Add < useThreshold times so the names are not promoted to dictionary cache.put(s); } // Mark dictionary as initialized cache.initialized(); for (String s : matching) { verifyNameReuse(cache, s, true); } // Check dictionary size assertEquals(matching.length, cache.size()); for (String s : notMatching) { verifyNameReuse(cache, s, false); } }
new NameCache<String>(2); String[] matching = {"part1", "part10000000", "fileabc", "abc", "filepart"}; String[] notMatching = {"spart1", "apart", "abcd", "def"};