Java 类org.apache.hadoop.hbase.util.HFileArchiveTestingUtil 实例源码

项目:c5    文件:TestHFileArchiving.java   
@Test
public void testRemovesRegionDirOnArchive() throws Exception {
  final HBaseAdmin admin = UTIL.getHBaseAdmin();

  // get the current store files for the region
  List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME);
  // make sure we only have 1 region serving this table
  assertEquals(1, servingRegions.size());
  HRegion region = servingRegions.get(0);

  // and load the table
  UTIL.loadRegion(region, TEST_FAM);

  // shutdown the table so we can manipulate the files
  admin.disableTable(STRING_TABLE_NAME);

  FileSystem fs = UTIL.getTestFileSystem();

  // now attempt to depose the region
  Path rootDir = region.getRegionFileSystem().getTableDir().getParent();
  Path regionDir = HRegion.getRegionDir(rootDir, region.getRegionInfo());

  HFileArchiver.archiveRegion(UTIL.getConfiguration(), fs, region.getRegionInfo());

  // check for the existence of the archive directory and some files in it
  Path archiveDir = HFileArchiveTestingUtil.getRegionArchiveDir(UTIL.getConfiguration(), region);
  assertTrue(fs.exists(archiveDir));

  // check to make sure the store directory was copied
  FileStatus[] stores = fs.listStatus(archiveDir);
  assertTrue(stores.length == 1);

  // make sure we archived the store files
  FileStatus[] storeFiles = fs.listStatus(stores[0].getPath());
  assertTrue(storeFiles.length > 0);

  // then ensure the region's directory isn't present
  assertFalse(fs.exists(regionDir));
}
项目:DominoHBase    文件:TestHFileArchiving.java   
@Test
public void testRemovesRegionDirOnArchive() throws Exception {
  final HBaseAdmin admin = UTIL.getHBaseAdmin();

  // get the current store files for the region
  List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME);
  // make sure we only have 1 region serving this table
  assertEquals(1, servingRegions.size());
  HRegion region = servingRegions.get(0);

  // and load the table
  UTIL.loadRegion(region, TEST_FAM);

  // shutdown the table so we can manipulate the files
  admin.disableTable(STRING_TABLE_NAME);

  FileSystem fs = UTIL.getTestFileSystem();

  // now attempt to depose the region
  Path regionDir = HRegion.getRegionDir(region.getTableDir().getParent(), region.getRegionInfo());

  HFileArchiver.archiveRegion(UTIL.getConfiguration(), fs, region.getRegionInfo());

  // check for the existence of the archive directory and some files in it
  Path archiveDir = HFileArchiveTestingUtil.getRegionArchiveDir(UTIL.getConfiguration(), region);
  assertTrue(fs.exists(archiveDir));

  // check to make sure the store directory was copied
  FileStatus[] stores = fs.listStatus(archiveDir);
  assertTrue(stores.length == 1);

  // make sure we archived the store files
  FileStatus[] storeFiles = fs.listStatus(stores[0].getPath());
  assertTrue(storeFiles.length > 0);

  // then ensure the region's directory isn't present
  assertFalse(fs.exists(regionDir));
}
项目:ditb    文件:TestHFileArchiving.java   
@Test
public void testRemovesRegionDirOnArchive() throws Exception {
  TableName TABLE_NAME =
      TableName.valueOf("testRemovesRegionDirOnArchive");
  UTIL.createTable(TABLE_NAME, TEST_FAM);

  final Admin admin = UTIL.getHBaseAdmin();

  // get the current store files for the region
  List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME);
  // make sure we only have 1 region serving this table
  assertEquals(1, servingRegions.size());
  HRegion region = servingRegions.get(0);

  // and load the table
  UTIL.loadRegion(region, TEST_FAM);

  // shutdown the table so we can manipulate the files
  admin.disableTable(TABLE_NAME);

  FileSystem fs = UTIL.getTestFileSystem();

  // now attempt to depose the region
  Path rootDir = region.getRegionFileSystem().getTableDir().getParent();
  Path regionDir = HRegion.getRegionDir(rootDir, region.getRegionInfo());

  HFileArchiver.archiveRegion(UTIL.getConfiguration(), fs, region.getRegionInfo());

  // check for the existence of the archive directory and some files in it
  Path archiveDir = HFileArchiveTestingUtil.getRegionArchiveDir(UTIL.getConfiguration(), region);
  assertTrue(fs.exists(archiveDir));

  // check to make sure the store directory was copied
  // check to make sure the store directory was copied
  FileStatus[] stores = fs.listStatus(archiveDir, new PathFilter() {
    @Override
    public boolean accept(Path p) {
      if (p.getName().contains(HConstants.RECOVERED_EDITS_DIR)) {
        return false;
      }
      return true;
    }
  });
  assertTrue(stores.length == 1);

  // make sure we archived the store files
  FileStatus[] storeFiles = fs.listStatus(stores[0].getPath());
  assertTrue(storeFiles.length > 0);

  // then ensure the region's directory isn't present
  assertFalse(fs.exists(regionDir));

  UTIL.deleteTable(TABLE_NAME);
}
项目:LCIndex-HBase-0.94.16    文件:TestHFileArchiving.java   
@Test
public void testRemovesRegionDirOnArchive() throws Exception {
  byte[] TABLE_NAME = Bytes.toBytes("testRemovesRegionDirOnArchive");
  UTIL.createTable(TABLE_NAME, TEST_FAM);

  final HBaseAdmin admin = UTIL.getHBaseAdmin();

  // get the current store files for the region
  List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME);
  // make sure we only have 1 region serving this table
  assertEquals(1, servingRegions.size());
  HRegion region = servingRegions.get(0);

  // and load the table
  UTIL.loadRegion(region, TEST_FAM);

  // shutdown the table so we can manipulate the files
  admin.disableTable(TABLE_NAME);

  FileSystem fs = UTIL.getTestFileSystem();

  // now attempt to depose the region
  Path regionDir = HRegion.getRegionDir(region.getTableDir().getParent(), region.getRegionInfo());

  HFileArchiver.archiveRegion(UTIL.getConfiguration(), fs, region.getRegionInfo());

  // check for the existence of the archive directory and some files in it
  Path archiveDir = HFileArchiveTestingUtil.getRegionArchiveDir(UTIL.getConfiguration(), region);
  assertTrue(fs.exists(archiveDir));

  // check to make sure the store directory was copied
  FileStatus[] stores = fs.listStatus(archiveDir);
  assertTrue(stores.length == 1);

  // make sure we archived the store files
  FileStatus[] storeFiles = fs.listStatus(stores[0].getPath());
  assertTrue(storeFiles.length > 0);

  // then ensure the region's directory isn't present
  assertFalse(fs.exists(regionDir));

  UTIL.deleteTable(TABLE_NAME);
}
项目:pbase    文件:TestHFileArchiving.java   
@Test
public void testRemovesRegionDirOnArchive() throws Exception {
  TableName TABLE_NAME =
      TableName.valueOf("testRemovesRegionDirOnArchive");
  UTIL.createTable(TABLE_NAME, TEST_FAM);

  final Admin admin = UTIL.getHBaseAdmin();

  // get the current store files for the region
  List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME);
  // make sure we only have 1 region serving this table
  assertEquals(1, servingRegions.size());
  HRegion region = servingRegions.get(0);

  // and load the table
  UTIL.loadRegion(region, TEST_FAM);

  // shutdown the table so we can manipulate the files
  admin.disableTable(TABLE_NAME);

  FileSystem fs = UTIL.getTestFileSystem();

  // now attempt to depose the region
  Path rootDir = region.getRegionFileSystem().getTableDir().getParent();
  Path regionDir = HRegion.getRegionDir(rootDir, region.getRegionInfo());

  HFileArchiver.archiveRegion(UTIL.getConfiguration(), fs, region.getRegionInfo());

  // check for the existence of the archive directory and some files in it
  Path archiveDir = HFileArchiveTestingUtil.getRegionArchiveDir(UTIL.getConfiguration(), region);
  assertTrue(fs.exists(archiveDir));

  // check to make sure the store directory was copied
  // check to make sure the store directory was copied
  FileStatus[] stores = fs.listStatus(archiveDir, new PathFilter() {
    @Override
    public boolean accept(Path p) {
      if (p.getName().contains(HConstants.RECOVERED_EDITS_DIR)) {
        return false;
      }
      return true;
    }
  });
  assertTrue(stores.length == 1);

  // make sure we archived the store files
  FileStatus[] storeFiles = fs.listStatus(stores[0].getPath());
  assertTrue(storeFiles.length > 0);

  // then ensure the region's directory isn't present
  assertFalse(fs.exists(regionDir));

  UTIL.deleteTable(TABLE_NAME);
}
项目:HIndex    文件:TestHFileArchiving.java   
@Test
public void testRemovesRegionDirOnArchive() throws Exception {
  TableName TABLE_NAME =
      TableName.valueOf("testRemovesRegionDirOnArchive");
  UTIL.createTable(TABLE_NAME, TEST_FAM);

  final HBaseAdmin admin = UTIL.getHBaseAdmin();

  // get the current store files for the region
  List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME);
  // make sure we only have 1 region serving this table
  assertEquals(1, servingRegions.size());
  HRegion region = servingRegions.get(0);

  // and load the table
  UTIL.loadRegion(region, TEST_FAM);

  // shutdown the table so we can manipulate the files
  admin.disableTable(TABLE_NAME);

  FileSystem fs = UTIL.getTestFileSystem();

  // now attempt to depose the region
  Path rootDir = region.getRegionFileSystem().getTableDir().getParent();
  Path regionDir = HRegion.getRegionDir(rootDir, region.getRegionInfo());

  HFileArchiver.archiveRegion(UTIL.getConfiguration(), fs, region.getRegionInfo());

  // check for the existence of the archive directory and some files in it
  Path archiveDir = HFileArchiveTestingUtil.getRegionArchiveDir(UTIL.getConfiguration(), region);
  assertTrue(fs.exists(archiveDir));

  // check to make sure the store directory was copied
  FileStatus[] stores = fs.listStatus(archiveDir);
  assertTrue(stores.length == 1);

  // make sure we archived the store files
  FileStatus[] storeFiles = fs.listStatus(stores[0].getPath());
  assertTrue(storeFiles.length > 0);

  // then ensure the region's directory isn't present
  assertFalse(fs.exists(regionDir));

  UTIL.deleteTable(TABLE_NAME);
}
项目:IRIndex    文件:TestHFileArchiving.java   
@Test
public void testRemovesRegionDirOnArchive() throws Exception {
  byte[] TABLE_NAME = Bytes.toBytes("testRemovesRegionDirOnArchive");
  UTIL.createTable(TABLE_NAME, TEST_FAM);

  final HBaseAdmin admin = UTIL.getHBaseAdmin();

  // get the current store files for the region
  List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME);
  // make sure we only have 1 region serving this table
  assertEquals(1, servingRegions.size());
  HRegion region = servingRegions.get(0);

  // and load the table
  UTIL.loadRegion(region, TEST_FAM);

  // shutdown the table so we can manipulate the files
  admin.disableTable(TABLE_NAME);

  FileSystem fs = UTIL.getTestFileSystem();

  // now attempt to depose the region
  Path regionDir = HRegion.getRegionDir(region.getTableDir().getParent(), region.getRegionInfo());

  HFileArchiver.archiveRegion(UTIL.getConfiguration(), fs, region.getRegionInfo());

  // check for the existence of the archive directory and some files in it
  Path archiveDir = HFileArchiveTestingUtil.getRegionArchiveDir(UTIL.getConfiguration(), region);
  assertTrue(fs.exists(archiveDir));

  // check to make sure the store directory was copied
  FileStatus[] stores = fs.listStatus(archiveDir);
  assertTrue(stores.length == 1);

  // make sure we archived the store files
  FileStatus[] storeFiles = fs.listStatus(stores[0].getPath());
  assertTrue(storeFiles.length > 0);

  // then ensure the region's directory isn't present
  assertFalse(fs.exists(regionDir));

  UTIL.deleteTable(TABLE_NAME);
}
项目:hbase    文件:TestHFileArchiving.java   
@Test
public void testRemovesRegionDirOnArchive() throws Exception {
  final TableName tableName = TableName.valueOf(name.getMethodName());
  UTIL.createTable(tableName, TEST_FAM);

  final Admin admin = UTIL.getAdmin();

  // get the current store files for the region
  List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(tableName);
  // make sure we only have 1 region serving this table
  assertEquals(1, servingRegions.size());
  HRegion region = servingRegions.get(0);

  // and load the table
  UTIL.loadRegion(region, TEST_FAM);

  // shutdown the table so we can manipulate the files
  admin.disableTable(tableName);

  FileSystem fs = UTIL.getTestFileSystem();

  // now attempt to depose the region
  Path rootDir = region.getRegionFileSystem().getTableDir().getParent();
  Path regionDir = HRegion.getRegionDir(rootDir, region.getRegionInfo());

  HFileArchiver.archiveRegion(UTIL.getConfiguration(), fs, region.getRegionInfo());

  // check for the existence of the archive directory and some files in it
  Path archiveDir = HFileArchiveTestingUtil.getRegionArchiveDir(UTIL.getConfiguration(), region);
  assertTrue(fs.exists(archiveDir));

  // check to make sure the store directory was copied
  // check to make sure the store directory was copied
  FileStatus[] stores = fs.listStatus(archiveDir, new PathFilter() {
    @Override
    public boolean accept(Path p) {
      if (p.getName().contains(HConstants.RECOVERED_EDITS_DIR)) {
        return false;
      }
      return true;
    }
  });
  assertTrue(stores.length == 1);

  // make sure we archived the store files
  FileStatus[] storeFiles = fs.listStatus(stores[0].getPath());
  assertTrue(storeFiles.length > 0);

  // then ensure the region's directory isn't present
  assertFalse(fs.exists(regionDir));

  UTIL.deleteTable(tableName);
}
项目:PyroDB    文件:TestHFileArchiving.java   
@Test
public void testRemovesRegionDirOnArchive() throws Exception {
  TableName TABLE_NAME =
      TableName.valueOf("testRemovesRegionDirOnArchive");
  UTIL.createTable(TABLE_NAME, TEST_FAM);

  final HBaseAdmin admin = UTIL.getHBaseAdmin();

  // get the current store files for the region
  List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME);
  // make sure we only have 1 region serving this table
  assertEquals(1, servingRegions.size());
  HRegion region = servingRegions.get(0);

  // and load the table
  UTIL.loadRegion(region, TEST_FAM);

  // shutdown the table so we can manipulate the files
  admin.disableTable(TABLE_NAME);

  FileSystem fs = UTIL.getTestFileSystem();

  // now attempt to depose the region
  Path rootDir = region.getRegionFileSystem().getTableDir().getParent();
  Path regionDir = HRegion.getRegionDir(rootDir, region.getRegionInfo());

  HFileArchiver.archiveRegion(UTIL.getConfiguration(), fs, region.getRegionInfo());

  // check for the existence of the archive directory and some files in it
  Path archiveDir = HFileArchiveTestingUtil.getRegionArchiveDir(UTIL.getConfiguration(), region);
  assertTrue(fs.exists(archiveDir));

  // check to make sure the store directory was copied
  FileStatus[] stores = fs.listStatus(archiveDir);
  assertTrue(stores.length == 1);

  // make sure we archived the store files
  FileStatus[] storeFiles = fs.listStatus(stores[0].getPath());
  assertTrue(storeFiles.length > 0);

  // then ensure the region's directory isn't present
  assertFalse(fs.exists(regionDir));

  UTIL.deleteTable(TABLE_NAME);
}
项目:HBase-Research    文件:TestHFileArchiving.java   
@Test
public void testRemovesRegionDirOnArchive() throws Exception {
  byte[] TABLE_NAME = Bytes.toBytes("testRemovesRegionDirOnArchive");
  UTIL.createTable(TABLE_NAME, TEST_FAM);

  final HBaseAdmin admin = UTIL.getHBaseAdmin();

  // get the current store files for the region
  List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME);
  // make sure we only have 1 region serving this table
  assertEquals(1, servingRegions.size());
  HRegion region = servingRegions.get(0);

  // and load the table
  UTIL.loadRegion(region, TEST_FAM);

  // shutdown the table so we can manipulate the files
  admin.disableTable(TABLE_NAME);

  FileSystem fs = UTIL.getTestFileSystem();

  // now attempt to depose the region
  Path regionDir = HRegion.getRegionDir(region.getTableDir().getParent(), region.getRegionInfo());

  HFileArchiver.archiveRegion(UTIL.getConfiguration(), fs, region.getRegionInfo());

  // check for the existence of the archive directory and some files in it
  Path archiveDir = HFileArchiveTestingUtil.getRegionArchiveDir(UTIL.getConfiguration(), region);
  assertTrue(fs.exists(archiveDir));

  // check to make sure the store directory was copied
  FileStatus[] stores = fs.listStatus(archiveDir);
  assertTrue(stores.length == 1);

  // make sure we archived the store files
  FileStatus[] storeFiles = fs.listStatus(stores[0].getPath());
  assertTrue(storeFiles.length > 0);

  // then ensure the region's directory isn't present
  assertFalse(fs.exists(regionDir));

  UTIL.deleteTable(TABLE_NAME);
}
项目:hbase-0.94.8-qod    文件:TestHFileArchiving.java   
@Test
public void testRemovesRegionDirOnArchive() throws Exception {
  byte[] TABLE_NAME = Bytes.toBytes("testRemovesRegionDirOnArchive");
  UTIL.createTable(TABLE_NAME, TEST_FAM);

  final HBaseAdmin admin = UTIL.getHBaseAdmin();

  // get the current store files for the region
  List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME);
  // make sure we only have 1 region serving this table
  assertEquals(1, servingRegions.size());
  HRegion region = servingRegions.get(0);

  // and load the table
  UTIL.loadRegion(region, TEST_FAM);

  // shutdown the table so we can manipulate the files
  admin.disableTable(TABLE_NAME);

  FileSystem fs = UTIL.getTestFileSystem();

  // now attempt to depose the region
  Path regionDir = HRegion.getRegionDir(region.getTableDir().getParent(), region.getRegionInfo());

  HFileArchiver.archiveRegion(UTIL.getConfiguration(), fs, region.getRegionInfo());

  // check for the existence of the archive directory and some files in it
  Path archiveDir = HFileArchiveTestingUtil.getRegionArchiveDir(UTIL.getConfiguration(), region);
  assertTrue(fs.exists(archiveDir));

  // check to make sure the store directory was copied
  FileStatus[] stores = fs.listStatus(archiveDir);
  assertTrue(stores.length == 1);

  // make sure we archived the store files
  FileStatus[] storeFiles = fs.listStatus(stores[0].getPath());
  assertTrue(storeFiles.length > 0);

  // then ensure the region's directory isn't present
  assertFalse(fs.exists(regionDir));

  UTIL.deleteTable(TABLE_NAME);
}
项目:hbase-0.94.8-qod    文件:TestHFileArchiving.java   
@Test
public void testRemovesRegionDirOnArchive() throws Exception {
  byte[] TABLE_NAME = Bytes.toBytes("testRemovesRegionDirOnArchive");
  UTIL.createTable(TABLE_NAME, TEST_FAM);

  final HBaseAdmin admin = UTIL.getHBaseAdmin();

  // get the current store files for the region
  List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME);
  // make sure we only have 1 region serving this table
  assertEquals(1, servingRegions.size());
  HRegion region = servingRegions.get(0);

  // and load the table
  UTIL.loadRegion(region, TEST_FAM);

  // shutdown the table so we can manipulate the files
  admin.disableTable(TABLE_NAME);

  FileSystem fs = UTIL.getTestFileSystem();

  // now attempt to depose the region
  Path regionDir = HRegion.getRegionDir(region.getTableDir().getParent(), region.getRegionInfo());

  HFileArchiver.archiveRegion(UTIL.getConfiguration(), fs, region.getRegionInfo());

  // check for the existence of the archive directory and some files in it
  Path archiveDir = HFileArchiveTestingUtil.getRegionArchiveDir(UTIL.getConfiguration(), region);
  assertTrue(fs.exists(archiveDir));

  // check to make sure the store directory was copied
  FileStatus[] stores = fs.listStatus(archiveDir);
  assertTrue(stores.length == 1);

  // make sure we archived the store files
  FileStatus[] storeFiles = fs.listStatus(stores[0].getPath());
  assertTrue(storeFiles.length > 0);

  // then ensure the region's directory isn't present
  assertFalse(fs.exists(regionDir));

  UTIL.deleteTable(TABLE_NAME);
}
项目:hindex    文件:TestHFileArchiving.java   
@Test
public void testRemovesRegionDirOnArchive() throws Exception {
  byte[] TABLE_NAME = Bytes.toBytes("testRemovesRegionDirOnArchive");
  UTIL.createTable(TABLE_NAME, TEST_FAM);

  final HBaseAdmin admin = UTIL.getHBaseAdmin();

  // get the current store files for the region
  List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME);
  // make sure we only have 1 region serving this table
  assertEquals(1, servingRegions.size());
  HRegion region = servingRegions.get(0);

  // and load the table
  UTIL.loadRegion(region, TEST_FAM);

  // shutdown the table so we can manipulate the files
  admin.disableTable(TABLE_NAME);

  FileSystem fs = UTIL.getTestFileSystem();

  // now attempt to depose the region
  Path regionDir = HRegion.getRegionDir(region.getTableDir().getParent(), region.getRegionInfo());

  HFileArchiver.archiveRegion(UTIL.getConfiguration(), fs, region.getRegionInfo());

  // check for the existence of the archive directory and some files in it
  Path archiveDir = HFileArchiveTestingUtil.getRegionArchiveDir(UTIL.getConfiguration(), region);
  assertTrue(fs.exists(archiveDir));

  // check to make sure the store directory was copied
  FileStatus[] stores = fs.listStatus(archiveDir);
  assertTrue(stores.length == 1);

  // make sure we archived the store files
  FileStatus[] storeFiles = fs.listStatus(stores[0].getPath());
  assertTrue(storeFiles.length > 0);

  // then ensure the region's directory isn't present
  assertFalse(fs.exists(regionDir));

  UTIL.deleteTable(TABLE_NAME);
}