@Test public void heartbeatFileUnderReplicatedAndLost() throws Exception { mFileContext.getOptions().setReplicationMin(2); long blockId = createBlockHelper(TEST_FILE_1, mFileContext, ""); long workerId = mBlockMaster.getWorkerId(new WorkerNetAddress().setHost("localhost") .setRpcPort(80).setDataPort(81).setWebPort(82)); mBlockMaster.workerRegister(workerId, Collections.singletonList("MEM"), ImmutableMap.of("MEM", 100L), ImmutableMap.of("MEM", 0L), NO_BLOCKS_ON_LOCATION, NO_LOST_STORAGE, RegisterWorkerPOptions.getDefaultInstance()); mBlockMaster.commitBlock(workerId, 50L, "MEM", "MEM", blockId, 20L); mBlockMaster.workerHeartbeat(workerId, null, ImmutableMap.of("MEM", 0L), ImmutableList.of(blockId), NO_BLOCKS_ON_LOCATION, NO_LOST_STORAGE, NO_METRICS); mReplicationChecker.heartbeat(); Assert.assertEquals(EMPTY, mMockReplicationHandler.getEvictRequests()); Assert.assertEquals(EMPTY, mMockReplicationHandler.getReplicateRequests()); }
@Override public void heartbeat() throws InterruptedException { if (mSafeModeManager.isInSafeMode()) { return; } TimeUnit.SECONDS.sleep(mQuietPeriodSeconds); Set<Long> inodes; inodes = mInodeTree.getPinIdSet(); check(inodes, mReplicationHandler, Mode.REPLICATE); inodes = mInodeTree.getReplicationLimitedFileIds(); check(inodes, mReplicationHandler, Mode.EVICT); inodes = mInodeTree.getPinIdSet(); checkMisreplicated(inodes, mReplicationHandler); }
ReplicationChecker implements HeartbeatExecutor { @Override public void heartbeat() throws InterruptedException { if (mSafeModeManager.isInSafeMode()) { return; } TimeUnit.SECONDS.sleep(mQuietPeriodSeconds); Set<Long> inodes; inodes = mInodeTree.getPinIdSet(); check(inodes, mReplicationHandler, Mode.REPLICATE); inodes = mInodeTree.getReplicationLimitedFileIds(); check(inodes, mReplicationHandler, Mode.EVICT); inodes = mInodeTree.getPinIdSet(); checkMisreplicated(inodes, mReplicationHandler); } }
ReplicationChecker implements HeartbeatExecutor { @Override public void heartbeat() throws InterruptedException { if (mSafeModeManager.isInSafeMode()) { return; } TimeUnit.SECONDS.sleep(mQuietPeriodSeconds); Set<Long> inodes; inodes = mInodeTree.getPinIdSet(); check(inodes, mReplicationHandler, Mode.REPLICATE); inodes = mInodeTree.getReplicationLimitedFileIds(); check(inodes, mReplicationHandler, Mode.EVICT); inodes = mInodeTree.getPinIdSet(); checkMisreplicated(inodes, mReplicationHandler); } ReplicationChecker(InodeTree inodeTree, BlockMaster blockMaster,
      SafeModeManager safeModeManager, JobMasterClientPool jobMasterClientPool);  ReplicationChecker(InodeTree inodeTree, BlockMaster blockMaster,
      SafeModeManager safeModeManager, ReplicationHandler replicationHandler); }
ReplicationChecker implements HeartbeatExecutor { @Override public void heartbeat() throws InterruptedException { if (mSafeModeManager.isInSafeMode()) { return; } TimeUnit.SECONDS.sleep(mQuietPeriodSeconds); Set<Long> inodes; inodes = mInodeTree.getPinIdSet(); check(inodes, mReplicationHandler, Mode.REPLICATE); inodes = mInodeTree.getReplicationLimitedFileIds(); check(inodes, mReplicationHandler, Mode.EVICT); inodes = mInodeTree.getPinIdSet(); checkMisreplicated(inodes, mReplicationHandler); } ReplicationChecker(InodeTree inodeTree, BlockMaster blockMaster,
      SafeModeManager safeModeManager, JobMasterClientPool jobMasterClientPool);  ReplicationChecker(InodeTree inodeTree, BlockMaster blockMaster,
      SafeModeManager safeModeManager, ReplicationHandler replicationHandler); @Override void heartbeat(); @Override void close(); }
ReplicationChecker implements HeartbeatExecutor { @Override public void heartbeat() throws InterruptedException { if (mSafeModeManager.isInSafeMode()) { return; } TimeUnit.SECONDS.sleep(mQuietPeriodSeconds); Set<Long> inodes; inodes = mInodeTree.getPinIdSet(); check(inodes, mReplicationHandler, Mode.REPLICATE); inodes = mInodeTree.getReplicationLimitedFileIds(); check(inodes, mReplicationHandler, Mode.EVICT); inodes = mInodeTree.getPinIdSet(); checkMisreplicated(inodes, mReplicationHandler); } ReplicationChecker(InodeTree inodeTree, BlockMaster blockMaster,
      SafeModeManager safeModeManager, JobMasterClientPool jobMasterClientPool);  ReplicationChecker(InodeTree inodeTree, BlockMaster blockMaster,
      SafeModeManager safeModeManager, ReplicationHandler replicationHandler); @Override void heartbeat(); @Override void close();  }