long size = -1; try { if (fs.exists(link.getArchivePath())) { inArchive = true; size = fs.getFileStatus(link.getArchivePath()).getLen(); hfilesArchiveSize.addAndGet(size); hfilesArchiveCount.incrementAndGet(); !isArchivedFileStillReferenced(link.getArchivePath(), filesMap)) { nonSharedHfilesArchiveSize.addAndGet(size);
int c = 0; if (fs.exists(link.getArchivePath())) { p = link.getArchivePath(); al = uniqueHFilesArchiveSize; size = fs.getFileStatus(p).getLen();
link.getOriginPath() + ") or archive (" + link.getArchivePath() + ") directory for the primary table."; LOG.error(msg);
@Test public void testMobFilePath() throws IOException { final TableName tableName = TableName.valueOf(name.getMethodName()); Configuration conf = HBaseConfiguration.create(); FileSystem fs = FileSystem.get(conf); Path rootDir = FSUtils.getRootDir(conf); Path tableDir = FSUtils.getTableDir(rootDir, tableName); Path archiveDir = FSUtils.getTableDir(HFileArchiveUtil.getArchivePath(conf), tableName); String fileName = "mobFile"; String encodedRegionName = MobUtils.getMobRegionInfo(tableName).getEncodedName(); String columnFamily = "columnFamily"; Path regionDir = new Path(tableDir, encodedRegionName); Path archivedRegionDir = new Path(archiveDir, encodedRegionName); Path expectedMobFilePath = new Path(MobUtils.getMobFamilyPath(conf, tableName, columnFamily), fileName).makeQualified(fs.getUri(), fs.getWorkingDirectory()); Path expectedOriginPath = new Path(new Path(regionDir, columnFamily), fileName).makeQualified( fs.getUri(), fs.getWorkingDirectory()); Path expectedArchivePath = new Path(new Path(archivedRegionDir, columnFamily), fileName) .makeQualified(fs.getUri(), fs.getWorkingDirectory()); String hfileLinkName = tableName.getNameAsString() + "=" + encodedRegionName + "-" + fileName; Path hfileLinkPath = new Path(columnFamily, hfileLinkName); HFileLink hfileLink = HFileLink.buildFromHFileLinkPattern(conf, hfileLinkPath); Assert.assertEquals(expectedMobFilePath, hfileLink.getMobPath()); Assert.assertEquals(expectedOriginPath, hfileLink.getOriginPath()); Assert.assertEquals(expectedArchivePath, hfileLink.getArchivePath()); } }
public void storeFile (final String region, final String family, final String hfile) throws IOException { Path path = new Path(family, HFileLink.createHFileLinkName(table, region, hfile)); HFileLink link = new HFileLink(conf, path); boolean inArchive = false; long size = -1; try { if ((inArchive = fs.exists(link.getArchivePath()))) { size = fs.getFileStatus(link.getArchivePath()).getLen(); hfileArchiveSize.addAndGet(size); hfileArchiveCount.addAndGet(1); } else { size = link.getFileStatus(fs).getLen(); hfileSize.addAndGet(size); hfilesCount.addAndGet(1); } } catch (FileNotFoundException e) { hfilesMissing.addAndGet(1); } if (showFiles) { System.out.printf("%8s %s/%s/%s/%s %s%n", (size < 0 ? "-" : StringUtils.humanReadableInt(size)), table, region, family, hfile, (inArchive ? "(archive)" : (size < 0) ? "(NOT FOUND)" : "")); } }
long size = -1; try { if ((inArchive = fs.exists(link.getArchivePath()))) { size = fs.getFileStatus(link.getArchivePath()).getLen(); hfileArchiveSize.addAndGet(size); hfileArchiveCount.incrementAndGet();
link.getOriginPath() + ") or archive (" + link.getArchivePath() + ") directory for the primary table."; LOG.error(msg);
@Test public void testMobFilePath() throws IOException { final TableName tableName = TableName.valueOf(name.getMethodName()); Configuration conf = HBaseConfiguration.create(); FileSystem fs = FileSystem.get(conf); Path rootDir = FSUtils.getRootDir(conf); Path tableDir = FSUtils.getTableDir(rootDir, tableName); Path archiveDir = FSUtils.getTableDir(HFileArchiveUtil.getArchivePath(conf), tableName); String fileName = "mobFile"; String encodedRegionName = MobUtils.getMobRegionInfo(tableName).getEncodedName(); String columnFamily = "columnFamily"; Path regionDir = new Path(tableDir, encodedRegionName); Path archivedRegionDir = new Path(archiveDir, encodedRegionName); Path expectedMobFilePath = new Path(MobUtils.getMobFamilyPath(conf, tableName, columnFamily), fileName).makeQualified(fs.getUri(), fs.getWorkingDirectory()); Path expectedOriginPath = new Path(new Path(regionDir, columnFamily), fileName).makeQualified( fs.getUri(), fs.getWorkingDirectory()); Path expectedArchivePath = new Path(new Path(archivedRegionDir, columnFamily), fileName) .makeQualified(fs.getUri(), fs.getWorkingDirectory()); String hfileLinkName = tableName.getNameAsString() + "=" + encodedRegionName + "-" + fileName; Path hfileLinkPath = new Path(columnFamily, hfileLinkName); HFileLink hfileLink = HFileLink.buildFromHFileLinkPattern(conf, hfileLinkPath); Assert.assertEquals(expectedMobFilePath, hfileLink.getMobPath()); Assert.assertEquals(expectedOriginPath, hfileLink.getOriginPath()); Assert.assertEquals(expectedArchivePath, hfileLink.getArchivePath()); } }