HDFS-13808: [SPS]: Remove unwanted FSNamesystem #isFileOpenedForWrite() and #getFileInfo() function. Contributed by Rakesh R.
This commit is contained in:
parent
39ed3a66db
commit
3ac07b720b
|
@ -187,6 +187,7 @@ public class RouterNamenodeProtocol implements NamenodeProtocol {
|
|||
|
||||
@Override
|
||||
public Long getNextSPSPath() throws IOException {
|
||||
rpcServer.checkOperation(OperationCategory.READ, false);
|
||||
// not supported
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -4299,21 +4299,6 @@ public class BlockManager implements BlockStatsMXBean {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check file has low redundancy blocks.
|
||||
*/
|
||||
public boolean hasLowRedundancyBlocks(BlockCollection bc) {
|
||||
boolean result = false;
|
||||
for (BlockInfo block : bc.getBlocks()) {
|
||||
short expected = getExpectedRedundancyNum(block);
|
||||
final NumberReplicas n = countNodes(block);
|
||||
if (expected > n.liveReplicas()) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check sufficient redundancy of the blocks in the collection. If any block
|
||||
* is needed reconstruction, insert it into the reconstruction queue.
|
||||
|
@ -5010,25 +4995,6 @@ public class BlockManager implements BlockStatsMXBean {
|
|||
return providedStorageMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether file id has low redundancy blocks.
|
||||
*
|
||||
* @param inodeID
|
||||
* - inode id
|
||||
*/
|
||||
public boolean hasLowRedundancyBlocks(long inodeID) {
|
||||
namesystem.readLock();
|
||||
try {
|
||||
BlockCollection bc = namesystem.getBlockCollection(inodeID);
|
||||
if (bc == null) {
|
||||
return false;
|
||||
}
|
||||
return hasLowRedundancyBlocks(bc);
|
||||
} finally {
|
||||
namesystem.readUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create SPS manager instance. It manages the user invoked sps paths and does
|
||||
* the movement.
|
||||
|
|
|
@ -793,7 +793,7 @@ public class DatanodeDescriptor extends DatanodeInfo {
|
|||
}
|
||||
|
||||
/** Increment the number of blocks scheduled. */
|
||||
public void incrementBlocksScheduled(StorageType t) {
|
||||
void incrementBlocksScheduled(StorageType t) {
|
||||
currApproxBlocksScheduled.add(t, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1988,22 +1988,5 @@ public class DatanodeManager {
|
|||
}
|
||||
return reports;
|
||||
}
|
||||
|
||||
public boolean verifyTargetDatanodeHasSpaceForScheduling(DatanodeInfo dn,
|
||||
StorageType type, long estimatedSize) {
|
||||
namesystem.readLock();
|
||||
try {
|
||||
DatanodeDescriptor datanode =
|
||||
blockManager.getDatanodeManager().getDatanode(dn.getDatanodeUuid());
|
||||
if (datanode == null) {
|
||||
LOG.debug("Target datanode: " + dn + " doesn't exists");
|
||||
return false;
|
||||
}
|
||||
return null != datanode.chooseStorage4Block(type, estimatedSize);
|
||||
} finally {
|
||||
namesystem.readUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.ha.HAServiceProtocol.HAServiceState;
|
||||
import org.apache.hadoop.hdfs.client.BlockReportOptions;
|
||||
import org.apache.hadoop.hdfs.protocol.Block;
|
||||
import org.apache.hadoop.hdfs.protocol.BlockListAsLongs;
|
||||
import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
|
||||
import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
|
||||
|
@ -51,7 +50,6 @@ import org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolClientSideTranslatorPB;
|
|||
import org.apache.hadoop.hdfs.server.common.IncorrectVersionException;
|
||||
import org.apache.hadoop.hdfs.server.namenode.FSNamesystem;
|
||||
import org.apache.hadoop.hdfs.server.protocol.BlockReportContext;
|
||||
import org.apache.hadoop.hdfs.server.protocol.BlocksStorageMoveAttemptFinished;
|
||||
import org.apache.hadoop.hdfs.server.protocol.DatanodeCommand;
|
||||
import org.apache.hadoop.hdfs.server.protocol.DatanodeRegistration;
|
||||
import org.apache.hadoop.hdfs.server.protocol.DatanodeStorage;
|
||||
|
@ -534,20 +532,6 @@ class BPServiceActor implements Runnable {
|
|||
return response;
|
||||
}
|
||||
|
||||
private BlocksStorageMoveAttemptFinished getStorageMoveAttemptFinishedBlocks(
|
||||
List<Block> finishedBlks) {
|
||||
|
||||
if (finishedBlks.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Create BlocksStorageMoveAttemptFinished with currently finished
|
||||
// blocks
|
||||
Block[] blockList = new Block[finishedBlks.size()];
|
||||
finishedBlks.toArray(blockList);
|
||||
return new BlocksStorageMoveAttemptFinished(blockList);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void sendLifelineForTests() throws IOException {
|
||||
lifelineSender.sendLifeline();
|
||||
|
|
|
@ -3133,29 +3133,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file info for a specific file.
|
||||
*
|
||||
* @param src The string representation of the path to the file
|
||||
* @param resolveLink whether to throw UnresolvedLinkException
|
||||
* if src refers to a symlink
|
||||
* @param needLocation if blockLocations need to be returned
|
||||
*
|
||||
* @throws AccessControlException
|
||||
* if access is denied
|
||||
* @throws UnresolvedLinkException
|
||||
* if a symlink is encountered.
|
||||
*
|
||||
* @return object containing information regarding the file or null if file
|
||||
* not found
|
||||
* @throws StandbyException
|
||||
*/
|
||||
@Override
|
||||
public HdfsFileStatus getFileInfo(final String src, boolean resolveLink,
|
||||
boolean needLocation) throws IOException {
|
||||
return getFileInfo(src, resolveLink, needLocation, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file info for a specific file.
|
||||
*
|
||||
|
@ -3603,21 +3580,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|||
return blockManager.getStoredBlock(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFileOpenedForWrite(String path) {
|
||||
readLock();
|
||||
try {
|
||||
INode inode = dir.getINode(path, FSDirectory.DirOp.READ);
|
||||
INodeFile iNodeFile = INodeFile.valueOf(inode, path);
|
||||
LeaseManager.Lease lease = leaseManager.getLease(iNodeFile);
|
||||
return lease != null;
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
} finally {
|
||||
readUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInSnapshot(long blockCollectionID) {
|
||||
assert hasReadLock();
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.hadoop.hdfs.server.namenode;
|
|||
import java.io.IOException;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockCollection;
|
||||
import org.apache.hadoop.hdfs.server.namenode.ha.HAContext;
|
||||
import org.apache.hadoop.hdfs.util.RwLock;
|
||||
|
@ -49,13 +48,6 @@ public interface Namesystem extends RwLock, SafeMode {
|
|||
*/
|
||||
boolean inTransitionToActive();
|
||||
|
||||
/**
|
||||
* Check if file is been opened for write purpose.
|
||||
* @param filePath
|
||||
* @return true if valid write lease exists, otherwise return false.
|
||||
*/
|
||||
boolean isFileOpenedForWrite(String filePath);
|
||||
|
||||
/**
|
||||
* Remove xAttr from the inode.
|
||||
* @param id
|
||||
|
@ -63,18 +55,4 @@ public interface Namesystem extends RwLock, SafeMode {
|
|||
* @throws IOException
|
||||
*/
|
||||
void removeXattr(long id, String xattrName) throws IOException;
|
||||
|
||||
/**
|
||||
* Gets the fileInfo of the given file path.
|
||||
*
|
||||
* @param filePath string representation of the path to the file
|
||||
* @param resolveLink whether to throw UnresolvedLinkException
|
||||
* if src refers to a symlink
|
||||
* @param needLocation if blockLocations need to be returned
|
||||
*
|
||||
* @return hdfs file status details
|
||||
* @throws IOException
|
||||
*/
|
||||
HdfsFileStatus getFileInfo(String filePath, boolean resolveLink,
|
||||
boolean needLocation) throws IOException;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.hadoop.hdfs.server.namenode.sps;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -79,7 +78,9 @@ public class BlockStorageMovementNeeded {
|
|||
* - track info for satisfy the policy
|
||||
*/
|
||||
public synchronized void add(ItemInfo trackInfo) {
|
||||
storageMovementNeeded.add(trackInfo);
|
||||
if (trackInfo != null) {
|
||||
storageMovementNeeded.add(trackInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,7 +154,6 @@ public class BlockStorageMovementNeeded {
|
|||
}
|
||||
|
||||
public synchronized void clearAll() {
|
||||
ctxt.removeAllSPSPathIds();
|
||||
storageMovementNeeded.clear();
|
||||
pendingWorkForDirectory.clear();
|
||||
}
|
||||
|
@ -188,18 +188,6 @@ public class BlockStorageMovementNeeded {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized void clearQueue(long trackId) {
|
||||
ctxt.removeSPSPathId(trackId);
|
||||
Iterator<ItemInfo> iterator = storageMovementNeeded.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ItemInfo next = iterator.next();
|
||||
if (next.getFile() == trackId) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
pendingWorkForDirectory.remove(trackId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean all the movements in spsDirsToBeTraveresed/storageMovementNeeded
|
||||
* and notify to clean up required resources.
|
||||
|
|
|
@ -22,8 +22,6 @@ import java.io.IOException;
|
|||
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.classification.InterfaceStability;
|
||||
import org.apache.hadoop.fs.ParentNotDirectoryException;
|
||||
import org.apache.hadoop.fs.UnresolvedLinkException;
|
||||
import org.apache.hadoop.hdfs.protocol.Block;
|
||||
import org.apache.hadoop.hdfs.protocol.BlockStoragePolicy;
|
||||
import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
|
||||
|
@ -31,7 +29,6 @@ import org.apache.hadoop.hdfs.server.namenode.sps.StoragePolicySatisfier.Datanod
|
|||
import org.apache.hadoop.hdfs.server.protocol.DatanodeStorageReport;
|
||||
import org.apache.hadoop.hdfs.server.protocol.BlockStorageMovementCommand.BlockMovingInfo;
|
||||
import org.apache.hadoop.net.NetworkTopology;
|
||||
import org.apache.hadoop.security.AccessControlException;
|
||||
|
||||
/**
|
||||
* An interface for the communication between SPS and Namenode module.
|
||||
|
@ -50,21 +47,6 @@ public interface Context {
|
|||
*/
|
||||
boolean isInSafeMode();
|
||||
|
||||
/**
|
||||
* Returns true if Mover tool is already running, false otherwise.
|
||||
*/
|
||||
boolean isMoverRunning();
|
||||
|
||||
/**
|
||||
* Gets the Inode ID number for the given path.
|
||||
*
|
||||
* @param path
|
||||
* - file/dir path
|
||||
* @return Inode id number
|
||||
*/
|
||||
long getFileID(String path) throws UnresolvedLinkException,
|
||||
AccessControlException, ParentNotDirectoryException;
|
||||
|
||||
/**
|
||||
* Gets the network topology.
|
||||
*
|
||||
|
@ -131,16 +113,6 @@ public interface Context {
|
|||
*/
|
||||
Long getNextSPSPath();
|
||||
|
||||
/**
|
||||
* Removes the SPS path id.
|
||||
*/
|
||||
void removeSPSPathId(long pathId);
|
||||
|
||||
/**
|
||||
* Removes all SPS path ids.
|
||||
*/
|
||||
void removeAllSPSPathIds();
|
||||
|
||||
/**
|
||||
* Do scan and collects the files under that directory and adds to the given
|
||||
* BlockStorageMovementNeeded.
|
||||
|
|
|
@ -47,12 +47,9 @@ public interface SPSService {
|
|||
* Starts the SPS service. Make sure to initialize the helper services before
|
||||
* invoking this method.
|
||||
*
|
||||
* @param reconfigStart
|
||||
* - to indicate whether the SPS startup requested from
|
||||
* reconfiguration service
|
||||
* @param spsMode sps service mode
|
||||
*/
|
||||
void start(boolean reconfigStart, StoragePolicySatisfierMode spsMode);
|
||||
void start(StoragePolicySatisfierMode spsMode);
|
||||
|
||||
/**
|
||||
* Stops the SPS service gracefully. Timed wait to stop storage policy
|
||||
|
|
|
@ -150,21 +150,14 @@ public class StoragePolicySatisfier implements SPSService, Runnable {
|
|||
* movements monitor for retry the attempts if needed.
|
||||
*/
|
||||
@Override
|
||||
public synchronized void start(boolean reconfigStart,
|
||||
StoragePolicySatisfierMode serviceMode) {
|
||||
public synchronized void start(StoragePolicySatisfierMode serviceMode) {
|
||||
if (serviceMode == StoragePolicySatisfierMode.NONE) {
|
||||
LOG.error("Can't start StoragePolicySatisfier for the given mode:{}",
|
||||
serviceMode);
|
||||
return;
|
||||
}
|
||||
if (reconfigStart) {
|
||||
LOG.info("Starting {} StoragePolicySatisfier, as admin requested to "
|
||||
+ "start it.", StringUtils.toLowerCase(serviceMode.toString()));
|
||||
} else {
|
||||
LOG.info("Starting {} StoragePolicySatisfier.",
|
||||
StringUtils.toLowerCase(serviceMode.toString()));
|
||||
}
|
||||
|
||||
LOG.info("Starting {} StoragePolicySatisfier.",
|
||||
StringUtils.toLowerCase(serviceMode.toString()));
|
||||
isRunning = true;
|
||||
storagePolicySatisfierThread = new Daemon(this);
|
||||
storagePolicySatisfierThread.setName("StoragePolicySatisfier");
|
||||
|
@ -229,8 +222,8 @@ public class StoragePolicySatisfier implements SPSService, Runnable {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
ItemInfo itemInfo = null;
|
||||
try {
|
||||
ItemInfo itemInfo = null;
|
||||
boolean retryItem = false;
|
||||
if (!ctxt.isInSafeMode()) {
|
||||
itemInfo = storageMovementNeeded.get();
|
||||
|
@ -324,12 +317,14 @@ public class StoragePolicySatisfier implements SPSService, Runnable {
|
|||
blockCount = 0L;
|
||||
}
|
||||
if (retryItem) {
|
||||
// itemInfo.increRetryCount();
|
||||
this.storageMovementNeeded.add(itemInfo);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.error("Exception during StoragePolicySatisfier execution - "
|
||||
+ "will continue next cycle", e);
|
||||
// Since it could not finish this item in previous iteration due to IOE,
|
||||
// just try again.
|
||||
this.storageMovementNeeded.add(itemInfo);
|
||||
} catch (Throwable t) {
|
||||
synchronized (this) {
|
||||
if (isRunning) {
|
||||
|
|
|
@ -24,10 +24,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.fs.FSDataOutputStream;
|
||||
import org.apache.hadoop.fs.ParentNotDirectoryException;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.fs.UnresolvedLinkException;
|
||||
import org.apache.hadoop.hdfs.DFSUtilClient;
|
||||
import org.apache.hadoop.hdfs.protocol.Block;
|
||||
import org.apache.hadoop.hdfs.protocol.BlockStoragePolicy;
|
||||
|
@ -47,7 +44,6 @@ import org.apache.hadoop.hdfs.server.namenode.sps.StoragePolicySatisfier.Datanod
|
|||
import org.apache.hadoop.hdfs.server.protocol.BlockStorageMovementCommand.BlockMovingInfo;
|
||||
import org.apache.hadoop.hdfs.server.protocol.DatanodeStorageReport;
|
||||
import org.apache.hadoop.net.NetworkTopology;
|
||||
import org.apache.hadoop.security.AccessControlException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -92,35 +88,6 @@ public class ExternalSPSContext implements Context {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMoverRunning() {
|
||||
try {
|
||||
FSDataOutputStream out = nnc.getDistributedFileSystem()
|
||||
.append(HdfsServerConstants.MOVER_ID_PATH);
|
||||
out.close();
|
||||
return false;
|
||||
} catch (IOException ioe) {
|
||||
LOG.warn("Exception while checking mover is running..", ioe);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getFileID(String path) throws UnresolvedLinkException,
|
||||
AccessControlException, ParentNotDirectoryException {
|
||||
HdfsFileStatus fs = null;
|
||||
try {
|
||||
fs = (HdfsFileStatus) nnc.getDistributedFileSystem().getFileStatus(
|
||||
new Path(path));
|
||||
LOG.info("Fetched the fileID:{} for the path:{}", fs.getFileId(), path);
|
||||
} catch (IllegalArgumentException | IOException e) {
|
||||
LOG.warn("Exception while getting file is for the given path:{}.", path,
|
||||
e);
|
||||
}
|
||||
return fs != null ? fs.getFileId() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkTopology getNetworkTopology(DatanodeMap datanodeMap) {
|
||||
// create network topology.
|
||||
|
@ -152,8 +119,18 @@ public class ExternalSPSContext implements Context {
|
|||
@Override
|
||||
public void removeSPSHint(long inodeId) throws IOException {
|
||||
Path filePath = DFSUtilClient.makePathFromFileId(inodeId);
|
||||
nnc.getDistributedFileSystem().removeXAttr(filePath,
|
||||
HdfsServerConstants.XATTR_SATISFY_STORAGE_POLICY);
|
||||
try {
|
||||
nnc.getDistributedFileSystem().removeXAttr(filePath,
|
||||
HdfsServerConstants.XATTR_SATISFY_STORAGE_POLICY);
|
||||
} catch (IOException e) {
|
||||
List<String> listXAttrs = nnc.getDistributedFileSystem()
|
||||
.listXAttrs(filePath);
|
||||
if (!listXAttrs
|
||||
.contains(HdfsServerConstants.XATTR_SATISFY_STORAGE_POLICY)) {
|
||||
LOG.info("SPS hint already removed for the inodeId:{}."
|
||||
+ " Ignoring exception:{}", inodeId, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -196,16 +173,6 @@ public class ExternalSPSContext implements Context {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSPSPathId(long pathId) {
|
||||
// We need not specifically implement for external.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllSPSPathIds() {
|
||||
// We need not specifically implement for external.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scanAndCollectFiles(long path)
|
||||
throws IOException, InterruptedException {
|
||||
|
|
|
@ -70,7 +70,7 @@ public final class ExternalStoragePolicySatisfier {
|
|||
|
||||
ExternalSPSContext context = new ExternalSPSContext(sps, nnc);
|
||||
sps.init(context);
|
||||
sps.start(true, StoragePolicySatisfierMode.EXTERNAL);
|
||||
sps.start(StoragePolicySatisfierMode.EXTERNAL);
|
||||
if (sps != null) {
|
||||
sps.join();
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ Note that, when both -p and -f options are omitted, the default path is the root
|
|||
|
||||
####Administrator notes:
|
||||
|
||||
`StoragePolicySatisfier` and `Mover tool` cannot run simultaneously. If a Mover instance is already triggered and running, SPS will be disabled while starting. In that case, administrator should make sure, Mover execution finished and then enable(internal service inside NN or external service outside NN) SPS again. Similarly when SPS enabled already, Mover cannot be run. If administrator is looking to run Mover tool explicitly, then he/she should make sure to disable SPS first and then run Mover. Please look at the commands section to know how to enable(internal service inside NN or external service outside NN) or disable SPS dynamically.
|
||||
`StoragePolicySatisfier` and `Mover tool` cannot run simultaneously. If a Mover instance is already triggered and running, SPS will be disabled while starting. In that case, administrator should make sure, Mover execution finished and then enable external SPS service again. Similarly when SPS enabled already, Mover cannot be run. If administrator is looking to run Mover tool explicitly, then he/she should make sure to disable SPS first and then run Mover. Please look at the commands section to know how to enable external service outside NN or disable SPS dynamically.
|
||||
|
||||
Storage Policy Commands
|
||||
-----------------------
|
||||
|
|
|
@ -113,6 +113,8 @@ public class TestPersistentStoragePolicySatisfier {
|
|||
// Reduced refresh cycle to update latest datanodes.
|
||||
conf.setLong(DFSConfigKeys.DFS_SPS_DATANODE_CACHE_REFRESH_INTERVAL_MS,
|
||||
1000);
|
||||
conf.setInt(
|
||||
DFSConfigKeys.DFS_STORAGE_POLICY_SATISFIER_MAX_RETRY_ATTEMPTS_KEY, 20);
|
||||
final int dnNumber = storageTypes.length;
|
||||
final short replication = 3;
|
||||
MiniDFSCluster.Builder clusterBuilder = new MiniDFSCluster.Builder(conf)
|
||||
|
@ -136,7 +138,7 @@ public class TestPersistentStoragePolicySatisfier {
|
|||
ctxt = new ExternalSPSContext(sps, nnc);
|
||||
|
||||
sps.init(ctxt);
|
||||
sps.start(true, StoragePolicySatisfierMode.EXTERNAL);
|
||||
sps.start(StoragePolicySatisfierMode.EXTERNAL);
|
||||
|
||||
createTestFiles(fs, replication);
|
||||
}
|
||||
|
@ -188,6 +190,7 @@ public class TestPersistentStoragePolicySatisfier {
|
|||
*/
|
||||
@Test(timeout = 300000)
|
||||
public void testWithCheckpoint() throws Exception {
|
||||
SecondaryNameNode secondary = null;
|
||||
try {
|
||||
clusterSetUp();
|
||||
fs.setStoragePolicy(testFile, WARM);
|
||||
|
@ -196,7 +199,7 @@ public class TestPersistentStoragePolicySatisfier {
|
|||
// Start the checkpoint.
|
||||
conf.set(
|
||||
DFSConfigKeys.DFS_NAMENODE_SECONDARY_HTTP_ADDRESS_KEY, "0.0.0.0:0");
|
||||
SecondaryNameNode secondary = new SecondaryNameNode(conf);
|
||||
secondary = new SecondaryNameNode(conf);
|
||||
secondary.doCheckpoint();
|
||||
restartCluster();
|
||||
|
||||
|
@ -214,6 +217,9 @@ public class TestPersistentStoragePolicySatisfier {
|
|||
childFileName, StorageType.ARCHIVE, 3, timeout, fs);
|
||||
|
||||
} finally {
|
||||
if (secondary != null) {
|
||||
secondary.shutdown();
|
||||
}
|
||||
clusterShutdown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -510,7 +510,7 @@ public class TestStoragePolicySatisfierWithStripedFile {
|
|||
sps = new StoragePolicySatisfier(conf);
|
||||
ctxt = new ExternalSPSContext(sps, nnc);
|
||||
sps.init(ctxt);
|
||||
sps.start(true, StoragePolicySatisfierMode.EXTERNAL);
|
||||
sps.start(StoragePolicySatisfierMode.EXTERNAL);
|
||||
}
|
||||
|
||||
private static void initConfWithStripe(Configuration conf,
|
||||
|
|
|
@ -219,7 +219,7 @@ public class TestExternalStoragePolicySatisfier {
|
|||
externalCtxt = new ExternalSPSContext(externalSps, nnc);
|
||||
|
||||
externalSps.init(externalCtxt);
|
||||
externalSps.start(true, StoragePolicySatisfierMode.EXTERNAL);
|
||||
externalSps.start(StoragePolicySatisfierMode.EXTERNAL);
|
||||
return cluster;
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ public class TestExternalStoragePolicySatisfier {
|
|||
|
||||
externalCtxt = new ExternalSPSContext(externalSps, nnc);
|
||||
externalSps.init(externalCtxt);
|
||||
externalSps.start(true, StoragePolicySatisfierMode.EXTERNAL);
|
||||
externalSps.start(StoragePolicySatisfierMode.EXTERNAL);
|
||||
}
|
||||
|
||||
private void initSecureConf(Configuration conf) throws Exception {
|
||||
|
|
|
@ -71,7 +71,7 @@ public class TestStoragePolicySatisfyAdminCommands {
|
|||
Context externalCtxt = new ExternalSPSContext(externalSps, nnc);
|
||||
|
||||
externalSps.init(externalCtxt);
|
||||
externalSps.start(true, StoragePolicySatisfierMode.EXTERNAL);
|
||||
externalSps.start(StoragePolicySatisfierMode.EXTERNAL);
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
Loading…
Reference in New Issue