HBASE-23723 Ensure MOB compaction works in optimized mode after snapshot clone (...
[hbase.git] / hbase-server / src / test / java / org / apache / hadoop / hbase / replication / TestReplicationStatusSourceStartedTargetStoppedNoOps.java
blob24c5051ee71d79bae70fa40d34079c52650ca980
1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package org.apache.hadoop.hbase.replication;
20 import static org.junit.Assert.assertEquals;
21 import static org.junit.Assert.assertFalse;
23 import java.util.EnumSet;
24 import java.util.List;
25 import org.apache.hadoop.hbase.ClusterMetrics;
26 import org.apache.hadoop.hbase.ClusterMetrics.Option;
27 import org.apache.hadoop.hbase.HBaseClassTestRule;
28 import org.apache.hadoop.hbase.ServerName;
29 import org.apache.hadoop.hbase.client.Admin;
30 import org.apache.hadoop.hbase.testclassification.MediumTests;
31 import org.apache.hadoop.hbase.testclassification.ReplicationTests;
32 import org.junit.ClassRule;
33 import org.junit.Test;
34 import org.junit.experimental.categories.Category;
36 @Category({ ReplicationTests.class, MediumTests.class })
37 public class TestReplicationStatusSourceStartedTargetStoppedNoOps extends TestReplicationBase {
39 @ClassRule
40 public static final HBaseClassTestRule CLASS_RULE =
41 HBaseClassTestRule.forClass(TestReplicationStatusSourceStartedTargetStoppedNoOps.class);
43 @Test
44 public void testReplicationStatusSourceStartedTargetStoppedNoOps() throws Exception {
45 UTIL2.shutdownMiniHBaseCluster();
46 restartSourceCluster(1);
47 Admin hbaseAdmin = UTIL1.getAdmin();
48 ServerName serverName = UTIL1.getHBaseCluster().getRegionServer(0).getServerName();
49 Thread.sleep(10000);
50 ClusterMetrics metrics = hbaseAdmin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS));
51 List<ReplicationLoadSource> loadSources =
52 metrics.getLiveServerMetrics().get(serverName).getReplicationLoadSourceList();
53 assertEquals(1, loadSources.size());
54 ReplicationLoadSource loadSource = loadSources.get(0);
55 assertFalse(loadSource.hasEditsSinceRestart());
56 assertEquals(0, loadSource.getTimestampOfLastShippedOp());
57 assertEquals(0, loadSource.getReplicationLag());
58 assertFalse(loadSource.isRecovered());