Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5617,4 +5617,14 @@ public void setExcludeSlowNodesEnabled(boolean enable) {
public boolean getExcludeSlowNodesEnabled(BlockType blockType) {
return placementPolicies.getPolicy(blockType).getExcludeSlowNodesEnabled();
}

@VisibleForTesting
public void setPendingPeriodInMs(long newVal) {
invalidateBlocks.setPendingPeriodInMs(newVal);
}

@VisibleForTesting
public long getPendingPeriodInMs() {
return invalidateBlocks.getPendingPeriodInMs();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class InvalidateBlocks {
* The period of pending time for block invalidation since the NameNode
* startup
*/
private final long pendingPeriodInMs;
private long pendingPeriodInMs;
/** the startup time */
private final long startupTime = Time.monotonicNow();

Expand Down Expand Up @@ -252,6 +252,16 @@ long getInvalidationDelay() {
return pendingPeriodInMs - (Time.monotonicNow() - startupTime);
}

@VisibleForTesting
public void setPendingPeriodInMs(long newVal) {
this.pendingPeriodInMs = newVal;
}

@VisibleForTesting
public long getPendingPeriodInMs() {
return this.pendingPeriodInMs;
}

/**
* Get blocks to invalidate by limit as blocks that can be sent in one
* message is limited.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ public void testProcessOverReplicatedAndCorruptStripedBlock()
assertEquals(1, bm.countNodes(bm.getStoredBlock(blockInfo))
.corruptReplicas());

// Set a larger value for delete invalidation delay time of a block and
// avoid the redundant internal blocks will be deleted.
long oldPendingPeriodInMs = bm.getPendingPeriodInMs();
bm.setPendingPeriodInMs(3600000);
// let a internal block be over replicated with 2 redundant block.
blk.setBlockId(groupId + 2);
cluster.injectBlocks(numDNs - 3, Arrays.asList(blk), bpid);
Expand All @@ -240,6 +244,8 @@ public void testProcessOverReplicatedAndCorruptStripedBlock()
for (int i = 1; i < groupSize; i++) {
assertTrue(set.get(i));
}
// restore original settings.
bm.setPendingPeriodInMs(oldPendingPeriodInMs);
}

// This test is going to be rewritten in HDFS-10854. Ignoring this test
Expand Down