HDFS-12556: [SPS] : Block movement analysis should be done in read lock.
This commit is contained in:
parent
00eceed233
commit
5780f0624d
@ -242,12 +242,25 @@ public void run() {
|
|||||||
ItemInfo itemInfo = storageMovementNeeded.get();
|
ItemInfo itemInfo = storageMovementNeeded.get();
|
||||||
if (itemInfo != null) {
|
if (itemInfo != null) {
|
||||||
long trackId = itemInfo.getTrackId();
|
long trackId = itemInfo.getTrackId();
|
||||||
BlockCollection blockCollection =
|
BlockCollection blockCollection;
|
||||||
namesystem.getBlockCollection(trackId);
|
BlocksMovingAnalysis status = null;
|
||||||
|
try {
|
||||||
|
namesystem.readLock();
|
||||||
|
blockCollection = namesystem.getBlockCollection(trackId);
|
||||||
// Check blockCollectionId existence.
|
// Check blockCollectionId existence.
|
||||||
|
if (blockCollection == null) {
|
||||||
|
// File doesn't exists (maybe got deleted), remove trackId from
|
||||||
|
// the queue
|
||||||
|
storageMovementNeeded.removeItemTrackInfo(itemInfo);
|
||||||
|
} else {
|
||||||
|
status =
|
||||||
|
analyseBlocksStorageMovementsAndAssignToDN(
|
||||||
|
blockCollection);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
namesystem.readUnlock();
|
||||||
|
}
|
||||||
if (blockCollection != null) {
|
if (blockCollection != null) {
|
||||||
BlocksMovingAnalysis status =
|
|
||||||
analyseBlocksStorageMovementsAndAssignToDN(blockCollection);
|
|
||||||
switch (status.status) {
|
switch (status.status) {
|
||||||
// Just add to monitor, so it will be retried after timeout
|
// Just add to monitor, so it will be retried after timeout
|
||||||
case ANALYSIS_SKIPPED_FOR_RETRY:
|
case ANALYSIS_SKIPPED_FOR_RETRY:
|
||||||
@ -283,10 +296,6 @@ public void run() {
|
|||||||
storageMovementNeeded.removeItemTrackInfo(itemInfo);
|
storageMovementNeeded.removeItemTrackInfo(itemInfo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// File doesn't exists (maybe got deleted), remove trackId from
|
|
||||||
// the queue
|
|
||||||
storageMovementNeeded.removeItemTrackInfo(itemInfo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ public class TestPersistentStoragePolicySatisfier {
|
|||||||
{StorageType.DISK, StorageType.ARCHIVE, StorageType.SSD}
|
{StorageType.DISK, StorageType.ARCHIVE, StorageType.SSD}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final int timeout = 300000;
|
private final int timeout = 90000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup environment for every test case.
|
* Setup environment for every test case.
|
||||||
|
Loading…
Reference in New Issue
Block a user