From commits-return-74915-archive-asf-public=cust-asf.ponee.io@hbase.apache.org Wed Jun 27 05:37:08 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 8C5E2180636 for ; Wed, 27 Jun 2018 05:37:07 +0200 (CEST) Received: (qmail 29656 invoked by uid 500); 27 Jun 2018 03:37:06 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 28988 invoked by uid 99); 27 Jun 2018 03:37:05 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Jun 2018 03:37:05 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 061B0E1137; Wed, 27 Jun 2018 03:37:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: zhangduo@apache.org To: commits@hbase.apache.org Date: Wed, 27 Jun 2018 03:37:10 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [07/38] hbase git commit: HBASE-20425 Do not write the cluster id of the current active cluster when writing remote WAL HBASE-20425 Do not write the cluster id of the current active cluster when writing remote WAL Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/016b805e Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/016b805e Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/016b805e Branch: refs/heads/HBASE-19064 Commit: 016b805e36fc536518058e3fdfe0279f97a923bf Parents: c68fc31 Author: huzheng Authored: Mon Apr 23 17:20:55 2018 +0800 Committer: zhangduo Committed: Wed Jun 27 11:35:53 2018 +0800 ---------------------------------------------------------------------- .../replication/TestSyncReplicationActive.java | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/016b805e/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestSyncReplicationActive.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestSyncReplicationActive.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestSyncReplicationActive.java index bff4572..f9020a0 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestSyncReplicationActive.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestSyncReplicationActive.java @@ -17,9 +17,17 @@ */ package org.apache.hadoop.hbase.replication; +import org.apache.hadoop.fs.FileStatus; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseClassTestRule; +import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.testclassification.ReplicationTests; +import org.apache.hadoop.hbase.wal.WAL.Entry; +import org.apache.hadoop.hbase.wal.WAL.Reader; +import org.apache.hadoop.hbase.wal.WALFactory; +import org.junit.Assert; import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -49,6 +57,9 @@ public class TestSyncReplicationActive extends SyncReplicationTestBase { // peer is disabled so no data have been replicated verifyNotReplicatedThroughRegion(UTIL2, 0, 100); + // Ensure that there's no cluster id in remote log entries. + verifyNoClusterIdInRemoteLog(UTIL2, PEER_ID); + UTIL2.getAdmin().transitReplicationPeerSyncReplicationState(PEER_ID, SyncReplicationState.DOWNGRADE_ACTIVE); // confirm that peer with state DA will reject replication request. @@ -72,4 +83,25 @@ public class TestSyncReplicationActive extends SyncReplicationTestBase { verifyReplicationRequestRejection(UTIL2, true); write(UTIL2, 200, 300); } + + private void verifyNoClusterIdInRemoteLog(HBaseTestingUtility utility, String peerId) + throws Exception { + FileSystem fs2 = utility.getTestFileSystem(); + Path remoteDir = + new Path(utility.getMiniHBaseCluster().getMaster().getMasterFileSystem().getRootDir(), + "remoteWALs").makeQualified(fs2.getUri(), fs2.getWorkingDirectory()); + FileStatus[] files = fs2.listStatus(new Path(remoteDir, peerId)); + Assert.assertTrue(files.length > 0); + for (FileStatus file : files) { + try (Reader reader = + WALFactory.createReader(fs2, file.getPath(), utility.getConfiguration())) { + Entry entry = reader.next(); + Assert.assertTrue(entry != null); + while (entry != null) { + Assert.assertEquals(entry.getKey().getClusterIds().size(), 0); + entry = reader.next(); + } + } + } + } }