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 2022/03/18 16:50:07 UTC
[hbase] branch branch-2.4 updated (c4f5460 -> 7acfbc0)
This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a change to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git.
from c4f5460 HBASE-26833 Addendum fix NPE in TestReplicationSource.testTerminateClearsBuffer
new 2b2308a HBASE-26858 Refactor TestMasterRegionOnTwoFileSystems to avoid dead loop (#4238)
new 7acfbc0 HBASE-26861 Fix flaky TestSnapshotFromMaster.testSnapshotHFileArchiving (#4242)
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../master/cleaner/TestSnapshotFromMaster.java | 28 ++++++++++++++++------
.../region/TestMasterRegionOnTwoFileSystems.java | 7 +++++-
2 files changed, 27 insertions(+), 8 deletions(-)
[hbase] 01/02: HBASE-26858 Refactor TestMasterRegionOnTwoFileSystems to avoid dead loop (#4238)
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git
commit 2b2308afc7dc32fa5e0501aa8b5773e8b34d0144
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Fri Mar 18 23:09:09 2022 +0800
HBASE-26858 Refactor TestMasterRegionOnTwoFileSystems to avoid dead loop (#4238)
Signed-off-by: Xiaolin Ha <ha...@apache.org>
(cherry picked from commit 31db8e3b3b8cfbc395200ae55ab7f6c52a6d4c76)
---
.../hbase/master/region/TestMasterRegionOnTwoFileSystems.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/region/TestMasterRegionOnTwoFileSystems.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/region/TestMasterRegionOnTwoFileSystems.java
index 4e49cb4..c577a07 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/region/TestMasterRegionOnTwoFileSystems.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/region/TestMasterRegionOnTwoFileSystems.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.master.region;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -183,7 +184,7 @@ public class TestMasterRegionOnTwoFileSystems {
LOG.info("wal archive dir {}", walArchiveDir);
AbstractFSWAL<?> wal = (AbstractFSWAL<?>) region.region.getWAL();
Path currentWALFile = wal.getCurrentFileName();
- for (;;) {
+ for (int i = 0; ; i++) {
region.requestRollAll();
region.waitUntilWalRollFinished();
Path newWALFile = wal.getCurrentFileName();
@@ -191,6 +192,10 @@ public class TestMasterRegionOnTwoFileSystems {
if (!newWALFile.equals(currentWALFile)) {
break;
}
+ if (i == 10) {
+ fail("Can not roll wal after " + i + " times");
+ }
+ Thread.sleep(1000);
}
HFILE_UTIL.waitFor(15000, () -> {
try {
[hbase] 02/02: HBASE-26861 Fix flaky TestSnapshotFromMaster.testSnapshotHFileArchiving (#4242)
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git
commit 7acfbc0bea83e5d2ad9929175c33cdffeec9fef3
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Fri Mar 18 23:28:30 2022 +0800
HBASE-26861 Fix flaky TestSnapshotFromMaster.testSnapshotHFileArchiving (#4242)
Signed-off-by: Xiaolin Ha <ha...@apache.org>
(cherry picked from commit 520ad638d9dbc3cdf0d3f0706610dcf3f0a43f1e)
---
.../master/cleaner/TestSnapshotFromMaster.java | 28 ++++++++++++++++------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestSnapshotFromMaster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestSnapshotFromMaster.java
index fd309ec..f2d1afa 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestSnapshotFromMaster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestSnapshotFromMaster.java
@@ -36,6 +36,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.Waiter;
+import org.apache.hadoop.hbase.Waiter.ExplainingPredicate;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
import org.apache.hadoop.hbase.client.Put;
@@ -488,14 +489,27 @@ public class TestSnapshotFromMaster {
}
}
// run the cleaner again
- LOG.debug("Running hfile cleaners");
- ensureHFileCleanersRun();
- LOG.info("After delete snapshot cleaners run File-System state");
- CommonFSUtils.logFileSystemState(fs, rootDir, LOG);
+ // In SnapshotFileCache, we use lock.tryLock to avoid being blocked by snapshot operation, if we
+ // fail to get the lock, we will not archive any files. This is not a big deal in real world, so
+ // here we will try to run the cleaner multiple times to make the test more stable.
+ // See HBASE-26861
+ UTIL.waitFor(60000, 1000, new ExplainingPredicate<Exception>() {
+
+ @Override
+ public boolean evaluate() throws Exception {
+ LOG.debug("Running hfile cleaners");
+ ensureHFileCleanersRun();
+ LOG.info("After delete snapshot cleaners run File-System state");
+ CommonFSUtils.logFileSystemState(fs, rootDir, LOG);
+ return getHFiles(archiveDir, fs, TABLE_NAME).isEmpty();
+ }
- archives = getHFiles(archiveDir, fs, TABLE_NAME);
- assertEquals("Still have some hfiles in the archive, when their snapshot has been deleted.", 0,
- archives.size());
+ @Override
+ public String explainFailure() throws Exception {
+ return "Still have some hfiles in the archive, when their snapshot has been deleted: "
+ + getHFiles(archiveDir, fs, TABLE_NAME);
+ }
+ });
}
/**