Search in sources :

Example 56 with WALFactory

use of org.apache.hadoop.hbase.wal.WALFactory in project hbase by apache.

the class AbstractTestWALReplay method setUp.

@Before
public void setUp() throws Exception {
    this.conf = HBaseConfiguration.create(TEST_UTIL.getConfiguration());
    this.fs = TEST_UTIL.getDFSCluster().getFileSystem();
    this.hbaseRootDir = CommonFSUtils.getRootDir(this.conf);
    this.oldLogDir = new Path(this.hbaseRootDir, HConstants.HREGION_OLDLOGDIR_NAME);
    String serverName = ServerName.valueOf(currentTest.getMethodName() + "-manual", 16010, EnvironmentEdgeManager.currentTime()).toString();
    this.logName = AbstractFSWALProvider.getWALDirectoryName(serverName);
    this.logDir = new Path(this.hbaseRootDir, logName);
    if (TEST_UTIL.getDFSCluster().getFileSystem().exists(this.hbaseRootDir)) {
        TEST_UTIL.getDFSCluster().getFileSystem().delete(this.hbaseRootDir, true);
    }
    this.wals = new WALFactory(conf, currentTest.getMethodName());
}
Also used : Path(org.apache.hadoop.fs.Path) WALFactory(org.apache.hadoop.hbase.wal.WALFactory) Before(org.junit.Before)

Example 57 with WALFactory

use of org.apache.hadoop.hbase.wal.WALFactory in project hbase by apache.

the class TestCombinedAsyncWriter method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    EVENT_LOOP_GROUP = new NioEventLoopGroup();
    CHANNEL_CLASS = NioSocketChannel.class;
    UTIL.startMiniDFSCluster(3);
    UTIL.getTestFileSystem().mkdirs(UTIL.getDataTestDirOnTestFS());
    WALS = new WALFactory(UTIL.getConfiguration(), TestCombinedAsyncWriter.class.getSimpleName());
}
Also used : WALFactory(org.apache.hadoop.hbase.wal.WALFactory) NioEventLoopGroup(org.apache.hbase.thirdparty.io.netty.channel.nio.NioEventLoopGroup) BeforeClass(org.junit.BeforeClass)

Example 58 with WALFactory

use of org.apache.hadoop.hbase.wal.WALFactory in project hbase by apache.

the class TestWALConfiguration method testBlocksizeDefaultsToTwiceHDFSBlockSize.

/**
 * Test blocksize change from HBASE-20520 takes on both asycnfs and old wal provider.
 * Hard to verify more than this given the blocksize is passed down to HDFS on create -- not
 * kept local to the streams themselves.
 */
@Test
public void testBlocksizeDefaultsToTwiceHDFSBlockSize() throws IOException {
    TableName tableName = TableName.valueOf("test");
    final WALFactory walFactory = new WALFactory(TEST_UTIL.getConfiguration(), this.walProvider);
    Configuration conf = TEST_UTIL.getConfiguration();
    WALProvider provider = walFactory.getWALProvider();
    // Get a WAL instance from the provider. Check its blocksize.
    WAL wal = provider.getWAL(null);
    if (wal instanceof AbstractFSWAL) {
        long expectedDefaultBlockSize = WALUtil.getWALBlockSize(conf, FileSystem.get(conf), TEST_UTIL.getDataTestDir());
        long blocksize = ((AbstractFSWAL) wal).blocksize;
        assertEquals(expectedDefaultBlockSize, blocksize);
        LOG.info("Found blocksize of {} on {}", blocksize, wal);
    } else {
        fail("Unknown provider " + provider);
    }
}
Also used : TableName(org.apache.hadoop.hbase.TableName) WAL(org.apache.hadoop.hbase.wal.WAL) Configuration(org.apache.hadoop.conf.Configuration) WALFactory(org.apache.hadoop.hbase.wal.WALFactory) WALProvider(org.apache.hadoop.hbase.wal.WALProvider) Test(org.junit.Test)

Example 59 with WALFactory

use of org.apache.hadoop.hbase.wal.WALFactory in project hbase by apache.

the class TestHRegion method createWALFactory.

static WALFactory createWALFactory(Configuration conf, Path rootDir) throws IOException {
    Configuration confForWAL = new Configuration(conf);
    confForWAL.set(HConstants.HBASE_DIR, rootDir.toString());
    return new WALFactory(confForWAL, "hregion-" + RandomStringUtils.randomNumeric(8));
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) WALFactory(org.apache.hadoop.hbase.wal.WALFactory)

Example 60 with WALFactory

use of org.apache.hadoop.hbase.wal.WALFactory in project hbase by apache.

the class TestHRegion method createWALCompatibleWithFaultyFileSystem.

/**
 * Create a WAL outside of the usual helper in
 * {@link HBaseTestingUtil#createWal(Configuration, Path, RegionInfo)} because that method
 * doesn't play nicely with FaultyFileSystem. Call this method before overriding
 * {@code fs.file.impl}.
 * @param callingMethod a unique component for the path, probably the name of the test method.
 */
private static WAL createWALCompatibleWithFaultyFileSystem(String callingMethod, Configuration conf, TableName tableName) throws IOException {
    final Path logDir = TEST_UTIL.getDataTestDirOnTestFS(callingMethod + ".log");
    final Configuration walConf = new Configuration(conf);
    CommonFSUtils.setRootDir(walConf, logDir);
    return new WALFactory(walConf, callingMethod).getWAL(RegionInfoBuilder.newBuilder(tableName).build());
}
Also used : Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) WALFactory(org.apache.hadoop.hbase.wal.WALFactory)

Aggregations

WALFactory (org.apache.hadoop.hbase.wal.WALFactory)64 Path (org.apache.hadoop.fs.Path)42 Configuration (org.apache.hadoop.conf.Configuration)33 WAL (org.apache.hadoop.hbase.wal.WAL)28 Test (org.junit.Test)23 FileSystem (org.apache.hadoop.fs.FileSystem)22 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)13 HRegion (org.apache.hadoop.hbase.regionserver.HRegion)13 RegionInfo (org.apache.hadoop.hbase.client.RegionInfo)12 WALEdit (org.apache.hadoop.hbase.wal.WALEdit)12 IOException (java.io.IOException)11 HRegionInfo (org.apache.hadoop.hbase.HRegionInfo)11 KeyValue (org.apache.hadoop.hbase.KeyValue)11 WALKeyImpl (org.apache.hadoop.hbase.wal.WALKeyImpl)10 TableDescriptor (org.apache.hadoop.hbase.client.TableDescriptor)9 WALProvider (org.apache.hadoop.hbase.wal.WALProvider)9 TreeMap (java.util.TreeMap)8 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)8 Before (org.junit.Before)8 Result (org.apache.hadoop.hbase.client.Result)7