/** * @return whether at least first block report has been received */ public boolean checkBlockReportReceived() { if(this.getStorageInfos().length == 0) { return false; } for(DatanodeStorageInfo storageInfo: this.getStorageInfos()) { if(storageInfo.getBlockReportCount() == 0 ) return false; } return true; }
private void processProvidedStorageReport() throws IOException { assert lock.hasWriteLock() : "Not holding write lock"; if (providedStorageInfo.getBlockReportCount() == 0 || providedDescriptor.activeProvidedDatanodes() == 0) { LOG.info("Calling process first blk report from storage: " + providedStorageInfo); // first pass; periodic refresh should call bm.processReport BlockAliasMap.Reader<BlockAlias> reader = aliasMap.getReader(null, bm.getBlockPoolId()); if (reader != null) { bm.processFirstBlockReport(providedStorageInfo, new ProvidedBlockList(reader.iterator())); } } }
&& storageInfo.getBlockReportCount() > 0) { blockLog.info("BLOCK* processReport 0x{}: " + "discarded non-initial block report from {}" if (storageInfo.getBlockReportCount() == 0) {
@Override public Boolean get() { return lastCount != storage.getBlockReportCount(); } }, 10, 2000);
if (report == null) return; assert (namesystem.hasWriteLock()); assert (storageInfo.getBlockReportCount() == 0);
/** * checks whether atleast first block report has been received * @return */ public boolean checkBlockReportReceived() { if(this.getStorageInfos().length == 0) { return false; } for(DatanodeStorageInfo storageInfo: this.getStorageInfos()) { if(storageInfo.getBlockReportCount() == 0 ) return false; } return true; }
/** * checks whether atleast first block report has been received * @return */ public boolean checkBlockReportReceived() { if(this.getStorageInfos().length == 0) { return false; } for(DatanodeStorageInfo storageInfo: this.getStorageInfos()) { if(storageInfo.getBlockReportCount() == 0 ) return false; } return true; }
&& storageInfo.getBlockReportCount() > 0) { blockLog.info("BLOCK* processReport 0x{}: " + "discarded non-initial block report from {}" if (storageInfo.getBlockReportCount() == 0) {
@Test public void testSafeModeIBRAfterIncremental() throws Exception { DatanodeDescriptor node = spy(nodes.get(0)); DatanodeStorageInfo ds = node.getStorageInfos()[0]; node.isAlive = true; DatanodeRegistration nodeReg = new DatanodeRegistration(node, null, null, ""); // pretend to be in safemode doReturn(true).when(fsn).isInStartupSafeMode(); // register new node bm.getDatanodeManager().registerDatanode(nodeReg); bm.getDatanodeManager().addDatanode(node); // swap in spy assertEquals(node, bm.getDatanodeManager().getDatanode(node)); assertEquals(0, ds.getBlockReportCount()); // send block report while pretending to already have blocks reset(node); doReturn(1).when(node).numBlocks(); bm.processReport(node, new DatanodeStorage(ds.getStorageID()), BlockListAsLongs.EMPTY, null); assertEquals(1, ds.getBlockReportCount()); }
assertEquals(0, ds.getBlockReportCount()); assertEquals(1, ds.getBlockReportCount()); assertEquals(1, ds.getBlockReportCount()); assertEquals(1, ds.getBlockReportCount());
private boolean waitForBlockReport(final DataNode dn, final DatanodeDescriptor dnd) throws Exception { final DatanodeStorageInfo storage = dnd.getStorageInfos()[0]; final long lastCount = storage.getBlockReportCount(); dn.triggerBlockReport( new BlockReportOptions.Factory().setIncremental(false).build()); try { GenericTestUtils.waitFor(new Supplier<Boolean>() { @Override public Boolean get() { return lastCount != storage.getBlockReportCount(); } }, 10, 2000); } catch (TimeoutException te) { return false; } return true; } }
&& storageInfo.getBlockReportCount() > 0) { blockLog.info("BLOCK* processReport 0x{}: " + "discarded non-initial block report from {}" if (storageInfo.getBlockReportCount() == 0) {
if (report == null) return; assert (namesystem.hasWriteLock()); assert (storageInfo.getBlockReportCount() == 0);
if (report == null) return; assert (namesystem.hasWriteLock()); assert (storageInfo.getBlockReportCount() == 0);
bm.getDatanodeManager().addDatanode(node); assertEquals(node, bm.getDatanodeManager().getDatanode(node)); assertEquals(0, ds.getBlockReportCount()); bm.processIncrementalBlockReport(node, srdb); assertEquals(0, ds.getBlockReportCount()); bm.processReport(node, new DatanodeStorage(ds.getStorageID()), builder.build(), null); assertEquals(1, ds.getBlockReportCount());