You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2020/05/27 03:27:10 UTC
[hbase] branch branch-2 updated: HBASE-24437 Addendum just start
mini dfs cluster, and make the log roll more robust (#1787)
This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2 by this push:
new 441935a HBASE-24437 Addendum just start mini dfs cluster, and make the log roll more robust (#1787)
441935a is described below
commit 441935a9d9f0df22f2d1b1c4ee57b13dacc00e7f
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Wed May 27 11:25:25 2020 +0800
HBASE-24437 Addendum just start mini dfs cluster, and make the log roll more robust (#1787)
Signed-off-by: stack <st...@apache.org>
---
.../store/TestLocalRegionOnTwoFileSystems.java | 29 ++++++++++++++--------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/store/TestLocalRegionOnTwoFileSystems.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/store/TestLocalRegionOnTwoFileSystems.java
index 0aa1362..7274bd4 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/store/TestLocalRegionOnTwoFileSystems.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/store/TestLocalRegionOnTwoFileSystems.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
@@ -49,12 +50,12 @@ import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
import org.apache.hadoop.hbase.regionserver.MemStoreLAB;
import org.apache.hadoop.hbase.regionserver.RegionScanner;
+import org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL;
import org.apache.hadoop.hbase.testclassification.MasterTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.CommonFSUtils;
import org.apache.hadoop.hbase.util.HFileArchiveUtil;
-import org.apache.hadoop.hbase.util.Threads;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -64,6 +65,7 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.apache.hbase.thirdparty.com.google.common.collect.Iterables;
@Category({ MasterTests.class, MediumTests.class })
@@ -92,7 +94,7 @@ public class TestLocalRegionOnTwoFileSystems {
@BeforeClass
public static void setUp() throws Exception {
- WAL_UTIL.startMiniCluster(3);
+ WAL_UTIL.startMiniDFSCluster(3);
Configuration conf = HFILE_UTIL.getConfiguration();
conf.setBoolean(MemStoreLAB.USEMSLAB_KEY, false);
Path rootDir = HFILE_UTIL.getDataTestDir();
@@ -154,9 +156,7 @@ public class TestLocalRegionOnTwoFileSystems {
.update(r -> r.put(new Put(Bytes.toBytes(index)).addColumn(CF, CQ, Bytes.toBytes(index))));
region.flush(true);
}
- region.requestRollAll();
- region.waitUntilWalRollFinished();
- byte [] bytes = Bytes.toBytes(compactMinMinusOne);
+ byte[] bytes = Bytes.toBytes(compactMinMinusOne);
region.update(r -> r.put(new Put(bytes).addColumn(CF, CQ, bytes)));
region.flusherAndCompactor.requestFlush();
@@ -182,18 +182,25 @@ public class TestLocalRegionOnTwoFileSystems {
Path walArchiveDir = new Path(CommonFSUtils.getWALRootDir(HFILE_UTIL.getConfiguration()),
HConstants.HREGION_OLDLOGDIR_NAME);
LOG.info("wal archive dir {}", walArchiveDir);
- region.requestRollAll();
- region.waitUntilWalRollFinished();
+ AbstractFSWAL<?> wal = (AbstractFSWAL<?>) region.region.getWAL();
+ Path currentWALFile = wal.getCurrentFileName();
+ for (;;) {
+ region.requestRollAll();
+ region.waitUntilWalRollFinished();
+ Path newWALFile = wal.getCurrentFileName();
+ // make sure we actually rolled the wal
+ if (!newWALFile.equals(currentWALFile)) {
+ break;
+ }
+ }
HFILE_UTIL.waitFor(15000, () -> {
try {
FileStatus[] fses = WAL_UTIL.getTestFileSystem().listStatus(walArchiveDir);
- if (fses != null) {
+ if (fses != null && fses.length > 0) {
LOG.info("wal archive dir content {}",
- Arrays.stream(fses).map(f -> f.getPath().toString()).
- collect(Collectors.joining(",")));
+ Arrays.stream(fses).map(f -> f.getPath().toString()).collect(Collectors.joining(",")));
} else {
LOG.info("none found");
- Threads.sleep(100);
}
return fses != null && fses.length >= 1;
} catch (FileNotFoundException e) {