@Test public void testHLogRollWriting() throws Exception { setUpforLogRolling(); String className = this.getClass().getName(); StringBuilder v = new StringBuilder(className); while (v.length() < 1000) { v.append(className); } byte[] value = Bytes.toBytes(v.toString()); HRegionServer regionServer = startAndWriteData("TestLogRolling", value); LOG.info("after writing there are " + HLogUtilsForTests.getNumLogFiles(regionServer.getWAL()) + " log files"); // flush all regions List<HRegion> regions = new ArrayList<HRegion>(regionServer .getOnlineRegionsLocalContext()); for (HRegion r : regions) { r.flushcache(); } admin.rollHLogWriter(regionServer.getServerName().getServerName()); int count = HLogUtilsForTests.getNumLogFiles(regionServer.getWAL()); LOG.info("after flushing all regions and rolling logs there are " + count + " log files"); assertTrue(("actual count: " + count), count <= 3); }
@Test (timeout=300000) public void testHLogRollWriting() throws Exception { setUpforLogRolling(); String className = this.getClass().getName(); StringBuilder v = new StringBuilder(className); while (v.length() < 1000) { v.append(className); } byte[] value = Bytes.toBytes(v.toString()); HRegionServer regionServer = startAndWriteData("TestLogRolling", value); LOG.info("after writing there are " + HLogUtilsForTests.getNumRolledLogFiles(regionServer.getWAL()) + " log files"); // flush all regions List<HRegion> regions = new ArrayList<HRegion>(regionServer .getOnlineRegionsLocalContext()); for (HRegion r : regions) { r.flushcache(); } admin.rollHLogWriter(regionServer.getServerName().getServerName()); int count = HLogUtilsForTests.getNumRolledLogFiles(regionServer.getWAL()); LOG.info("after flushing all regions and rolling logs there are " + count + " log files"); assertTrue(("actual count: " + count), count <= 2); }
@Test (timeout=300000) public void testHLogRollWriting() throws Exception { setUpforLogRolling(); String className = this.getClass().getName(); StringBuilder v = new StringBuilder(className); while (v.length() < 1000) { v.append(className); } byte[] value = Bytes.toBytes(v.toString()); HRegionServer regionServer = startAndWriteData("TestLogRolling", value); LOG.info("after writing there are " + HLogUtilsForTests.getNumLogFiles(regionServer.getWAL()) + " log files"); // flush all regions List<HRegion> regions = new ArrayList<HRegion>(regionServer .getOnlineRegionsLocalContext()); for (HRegion r : regions) { r.flushcache(); } admin.rollHLogWriter(regionServer.getServerName().getServerName()); int count = HLogUtilsForTests.getNumLogFiles(regionServer.getWAL()); LOG.info("after flushing all regions and rolling logs there are " + count + " log files"); assertTrue(("actual count: " + count), count <= 2); }
@Test public void testHLogRollWriting() throws Exception { setUpforLogRolling(); String className = this.getClass().getName(); StringBuilder v = new StringBuilder(className); while (v.length() < 1000) { v.append(className); } byte[] value = Bytes.toBytes(v.toString()); HRegionServer regionServer = startAndWriteData("TestLogRolling", value); LOG.info("after writing there are " + HLogUtilsForTests.getNumLogFiles(regionServer.getWAL()) + " log files"); // flush all regions List<HRegion> regions = new ArrayList<HRegion>(regionServer .getOnlineRegionsLocalContext()); for (HRegion r : regions) { r.flushcache(); } admin.rollHLogWriter(regionServer.getServerName().getServerName()); int count = HLogUtilsForTests.getNumLogFiles(regionServer.getWAL()); LOG.info("after flushing all regions and rolling logs there are " + count + " log files"); assertTrue(("actual count: " + count), count <= 2); }