• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ReplicationSourceManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager的典型用法代码示例。如果您正苦于以下问题:Java ReplicationSourceManager类的具体用法?Java ReplicationSourceManager怎么用?Java ReplicationSourceManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ReplicationSourceManager类属于org.apache.hadoop.hbase.replication.regionserver包,在下文中一共展示了ReplicationSourceManager类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setUpBeforeClass

import org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager; //导入依赖的package包/类
/**
 * @throws java.lang.Exception
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniZKCluster();
  Configuration conf = TEST_UTIL.getConfiguration();
  conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, true);
  admin = new ReplicationAdmin(conf);
  Path oldLogDir = new Path(TEST_UTIL.getDataTestDir(),
      HConstants.HREGION_OLDLOGDIR_NAME);
  Path logDir = new Path(TEST_UTIL.getDataTestDir(),
      HConstants.HREGION_LOGDIR_NAME);
  manager = new ReplicationSourceManager(admin.getReplicationZk(), conf,
      // The following stopper never stops so that we can respond
      // to zk notification
      new Stoppable() {
        @Override
        public void stop(String why) {}
        @Override
        public boolean isStopped() {return false;}
      }, FileSystem.get(conf), replicating, logDir, oldLogDir);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:24,代码来源:TestReplicationAdmin.java


示例2: init

import org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager; //导入依赖的package包/类
@Override
public void init(Configuration conf, FileSystem fs, ReplicationSourceManager manager,
    ReplicationQueues rq, ReplicationPeers rp, Stoppable stopper, String peerClusterId,
    UUID clusterId, ReplicationEndpoint replicationEndpoint, MetricsSource metrics)
        throws IOException {

  this.manager = manager;
  this.peerClusterId = peerClusterId;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:10,代码来源:ReplicationSourceDummy.java


示例3: init

import org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager; //导入依赖的package包/类
@Override
public void init(Configuration conf, FileSystem fs,
                 ReplicationSourceManager manager, Stoppable stopper,
                 AtomicBoolean replicating, String peerClusterId)
    throws IOException {
  this.manager = manager;
  this.peerClusterId = peerClusterId;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:9,代码来源:ReplicationSourceDummy.java


示例4: init

import org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager; //导入依赖的package包/类
@Override
public void init(Configuration conf, FileSystem fs, ReplicationSourceManager manager,
    ReplicationQueues rq, ReplicationPeers rp, Stoppable stopper, String peerClusterId,
    UUID clusterId) throws IOException {

  this.manager = manager;
  this.peerClusterId = peerClusterId;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:9,代码来源:ReplicationSourceDummy.java


示例5: init

import org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager; //导入依赖的package包/类
@Override
public void init(Configuration conf, FileSystem fs, ReplicationSourceManager manager,
    ReplicationQueueStorage rq, ReplicationPeer rp, Server server, String peerClusterId,
    UUID clusterId, WALFileLengthProvider walFileLengthProvider, MetricsSource metrics)
    throws IOException {
  this.manager = manager;
  this.peerClusterId = peerClusterId;
  this.metrics = metrics;
  this.walFileLengthProvider = walFileLengthProvider;
}
 
开发者ID:apache,项目名称:hbase,代码行数:11,代码来源:ReplicationSourceDummy.java


示例6: testTerminateTimeout

import org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager; //导入依赖的package包/类
/**
 * Tests that {@link ReplicationSource#terminate(String)} will timeout properly
 */
@Test
public void testTerminateTimeout() throws Exception {
  ReplicationSource source = new ReplicationSource();
  ReplicationEndpoint replicationEndpoint = new HBaseInterClusterReplicationEndpoint() {
    @Override
    protected void doStart() {
      notifyStarted();
    }

    @Override
    protected void doStop() {
      // not calling notifyStopped() here causes the caller of stop() to get a Future that never
      // completes
    }
  };
  replicationEndpoint.start();
  ReplicationPeer mockPeer = Mockito.mock(ReplicationPeer.class);
  Mockito.when(mockPeer.getPeerBandwidth()).thenReturn(0L);
  Configuration testConf = HBaseConfiguration.create();
  testConf.setInt("replication.source.maxretriesmultiplier", 1);
  ReplicationSourceManager manager = Mockito.mock(ReplicationSourceManager.class);
  Mockito.when(manager.getTotalBufferUsed()).thenReturn(new AtomicLong());
  source.init(testConf, null, manager, null, mockPeer, null, "testPeer", null,
    p -> OptionalLong.empty(), null);
  ExecutorService executor = Executors.newSingleThreadExecutor();
  Future<?> future = executor.submit(new Runnable() {

    @Override
    public void run() {
      source.terminate("testing source termination");
    }
  });
  long sleepForRetries = testConf.getLong("replication.source.sleepforretries", 1000);
  Waiter.waitFor(testConf, sleepForRetries * 2, new Predicate<Exception>() {

    @Override
    public boolean evaluate() throws Exception {
      return future.isDone();
    }

  });

}
 
开发者ID:apache,项目名称:hbase,代码行数:47,代码来源:TestReplicationSource.java


示例7: testServerShutdownRecoveredQueue

import org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager; //导入依赖的package包/类
/**
 * Tests that recovered queues are preserved on a regionserver shutdown.
 * See HBASE-18192
 * @throws Exception
 */
@Test
public void testServerShutdownRecoveredQueue() throws Exception {
  try {
    // Ensure single-threaded WAL
    conf.set("hbase.wal.provider", "defaultProvider");
    conf.setInt("replication.sleep.before.failover", 2000);
    // Introduces a delay in regionserver shutdown to give the race condition a chance to kick in.
    conf.set(HConstants.REGION_SERVER_IMPL, ShutdownDelayRegionServer.class.getName());
    MiniHBaseCluster cluster = TEST_UTIL.startMiniCluster(2);
    TEST_UTIL_PEER.startMiniCluster(1);

    HRegionServer serverA = cluster.getRegionServer(0);
    final ReplicationSourceManager managerA =
        ((Replication) serverA.getReplicationSourceService()).getReplicationManager();
    HRegionServer serverB = cluster.getRegionServer(1);
    final ReplicationSourceManager managerB =
        ((Replication) serverB.getReplicationSourceService()).getReplicationManager();
    final Admin admin = TEST_UTIL.getAdmin();

    final String peerId = "TestPeer";
    admin.addReplicationPeer(peerId,
        new ReplicationPeerConfig().setClusterKey(TEST_UTIL_PEER.getClusterKey()));
    // Wait for replication sources to come up
    Waiter.waitFor(conf, 20000, new Waiter.Predicate<Exception>() {
      @Override public boolean evaluate() throws Exception {
        return !(managerA.getSources().isEmpty() || managerB.getSources().isEmpty());
      }
    });
    // Disabling peer makes sure there is at least one log to claim when the server dies
    // The recovered queue will also stay there until the peer is disabled even if the
    // WALs it contains have no data.
    admin.disableReplicationPeer(peerId);

    // Stopping serverA
    // It's queues should be claimed by the only other alive server i.e. serverB
    cluster.stopRegionServer(serverA.getServerName());
    Waiter.waitFor(conf, 20000, new Waiter.Predicate<Exception>() {
      @Override public boolean evaluate() throws Exception {
        return managerB.getOldSources().size() == 1;
      }
    });

    final HRegionServer serverC = cluster.startRegionServer().getRegionServer();
    serverC.waitForServerOnline();
    Waiter.waitFor(conf, 20000, new Waiter.Predicate<Exception>() {
      @Override public boolean evaluate() throws Exception {
        return serverC.getReplicationSourceService() != null;
      }
    });
    final ReplicationSourceManager managerC =
        ((Replication) serverC.getReplicationSourceService()).getReplicationManager();
    // Sanity check
    assertEquals(0, managerC.getOldSources().size());

    // Stopping serverB
    // Now serverC should have two recovered queues:
    // 1. The serverB's normal queue
    // 2. serverA's recovered queue on serverB
    cluster.stopRegionServer(serverB.getServerName());
    Waiter.waitFor(conf, 20000, new Waiter.Predicate<Exception>() {
      @Override public boolean evaluate() throws Exception {
        return managerC.getOldSources().size() == 2;
      }
    });
    admin.enableReplicationPeer(peerId);
    Waiter.waitFor(conf, 20000, new Waiter.Predicate<Exception>() {
      @Override public boolean evaluate() throws Exception {
        return managerC.getOldSources().size() == 0;
      }
    });
  } finally {
    conf.set(HConstants.REGION_SERVER_IMPL, HRegionServer.class.getName());
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:80,代码来源:TestReplicationSource.java


示例8: getSourceManager

import org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager; //导入依赖的package包/类
@Override
public ReplicationSourceManager getSourceManager() {
  return manager;
}
 
开发者ID:apache,项目名称:hbase,代码行数:5,代码来源:ReplicationSourceDummy.java



注:本文中的org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ModelStandardDirector类代码示例发布时间:2022-05-21
下一篇:
Java ScheduledExecutorScheduler类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap