HDFS-11289. [SPS]: Make SPS movement monitor timeouts configurable. Contributed by Uma Maheswara Rao G
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/67ebe8d9 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/67ebe8d9 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/67ebe8d9 Branch: refs/heads/HDFS-10285 Commit: 67ebe8d9ae2b5fa1227f377136a5540ece431601 Parents: 398ed79 Author: Rakesh Radhakrishnan <rake...@apache.org> Authored: Mon Jan 9 19:07:43 2017 +0530 Committer: Rakesh Radhakrishnan <rake...@apache.org> Committed: Tue Jul 11 18:24:18 2017 +0530 ---------------------------------------------------------------------- .../org/apache/hadoop/hdfs/DFSConfigKeys.java | 9 ++++++++ .../server/blockmanagement/BlockManager.java | 4 ++-- .../BlockStorageMovementAttemptedItems.java | 10 ++++----- .../server/namenode/StoragePolicySatisfier.java | 15 ++++++++----- .../src/main/resources/hdfs-default.xml | 23 ++++++++++++++++++++ 5 files changed, 49 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/67ebe8d9/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java index 8f64cb6..781de49 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java @@ -540,10 +540,19 @@ public class DFSConfigKeys extends CommonConfigurationKeys { public static final String DFS_MOVER_MAX_NO_MOVE_INTERVAL_KEY = "dfs.mover.max-no-move-interval"; public static final int DFS_MOVER_MAX_NO_MOVE_INTERVAL_DEFAULT = 60*1000; // One minute + // SPS related configurations public static final String DFS_STORAGE_POLICY_SATISFIER_ACTIVATE_KEY = "dfs.storage.policy.satisfier.activate"; public static final boolean DFS_STORAGE_POLICY_SATISFIER_ACTIVATE_DEFAULT = true; + public static final String DFS_STORAGE_POLICY_SATISFIER_RECHECK_TIMEOUT_MILLIS_KEY = + "dfs.storage.policy.satisfier.recheck.timeout.millis"; + public static final int DFS_STORAGE_POLICY_SATISFIER_RECHECK_TIMEOUT_MILLIS_DEFAULT = + 5 * 60 * 1000; + public static final String DFS_STORAGE_POLICY_SATISFIER_SELF_RETRY_TIMEOUT_MILLIS_KEY = + "dfs.storage.policy.satisfier.self.retry.timeout.millis"; + public static final int DFS_STORAGE_POLICY_SATISFIER_SELF_RETRY_TIMEOUT_MILLIS_DEFAULT = + 30 * 60 * 1000; public static final String DFS_DATANODE_ADDRESS_KEY = "dfs.datanode.address"; public static final int DFS_DATANODE_DEFAULT_PORT = 9866; http://git-wip-us.apache.org/repos/asf/hadoop/blob/67ebe8d9/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java index 0bd40e8..c55cd3c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java @@ -465,8 +465,8 @@ public class BlockManager implements BlockStatsMXBean { DFSConfigKeys.DFS_STORAGE_POLICY_SATISFIER_ACTIVATE_KEY, DFSConfigKeys.DFS_STORAGE_POLICY_SATISFIER_ACTIVATE_DEFAULT); if (storagePolicyEnabled && spsEnabled) { - sps = new StoragePolicySatisfier(namesystem, - storageMovementNeeded, this); + sps = new StoragePolicySatisfier(namesystem, storageMovementNeeded, this, + conf); } else { sps = null; LOG.warn( http://git-wip-us.apache.org/repos/asf/hadoop/blob/67ebe8d9/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/BlockStorageMovementAttemptedItems.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/BlockStorageMovementAttemptedItems.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/BlockStorageMovementAttemptedItems.java index ce97075..042aca3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/BlockStorageMovementAttemptedItems.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/BlockStorageMovementAttemptedItems.java @@ -64,14 +64,14 @@ public class BlockStorageMovementAttemptedItems { // It might take anywhere between 5 to 10 minutes before // a request is timed out. // - private long checkTimeout = 5 * 60 * 1000; // minimum value + private long minCheckTimeout = 5 * 60 * 1000; // minimum value private BlockStorageMovementNeeded blockStorageMovementNeeded; - public BlockStorageMovementAttemptedItems(long timeoutPeriod, + public BlockStorageMovementAttemptedItems(long recheckTimeout, long selfRetryTimeout, BlockStorageMovementNeeded unsatisfiedStorageMovementFiles) { - if (timeoutPeriod > 0) { - this.checkTimeout = Math.min(checkTimeout, timeoutPeriod); + if (recheckTimeout > 0) { + this.minCheckTimeout = Math.min(minCheckTimeout, recheckTimeout); } this.selfRetryTimeout = selfRetryTimeout; @@ -196,7 +196,7 @@ public class BlockStorageMovementAttemptedItems { try { blockStorageMovementResultCheck(); blocksStorageMovementUnReportedItemsCheck(); - Thread.sleep(checkTimeout); + Thread.sleep(minCheckTimeout); } catch (InterruptedException ie) { LOG.info("BlocksStorageMovementAttemptResultMonitor thread " + "is interrupted.", ie); http://git-wip-us.apache.org/repos/asf/hadoop/blob/67ebe8d9/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/StoragePolicySatisfier.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/StoragePolicySatisfier.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/StoragePolicySatisfier.java index a854bd7..ee59617 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/StoragePolicySatisfier.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/StoragePolicySatisfier.java @@ -27,7 +27,9 @@ import java.util.LinkedList; import java.util.List; import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.StorageType; +import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.DFSUtil; import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.protocol.BlockStoragePolicy; @@ -79,15 +81,18 @@ public class StoragePolicySatisfier implements Runnable { public StoragePolicySatisfier(final Namesystem namesystem, final BlockStorageMovementNeeded storageMovementNeeded, - final BlockManager blkManager) { + final BlockManager blkManager, Configuration conf) { this.namesystem = namesystem; this.storageMovementNeeded = storageMovementNeeded; this.blockManager = blkManager; - // TODO: below selfRetryTimeout and checkTimeout can be configurable later - // Now, the default values of selfRetryTimeout and checkTimeout are 30mins - // and 5mins respectively this.storageMovementsMonitor = new BlockStorageMovementAttemptedItems( - 5 * 60 * 1000, 30 * 60 * 1000, storageMovementNeeded); + conf.getLong( + DFSConfigKeys.DFS_STORAGE_POLICY_SATISFIER_RECHECK_TIMEOUT_MILLIS_KEY, + DFSConfigKeys.DFS_STORAGE_POLICY_SATISFIER_RECHECK_TIMEOUT_MILLIS_DEFAULT), + conf.getLong( + DFSConfigKeys.DFS_STORAGE_POLICY_SATISFIER_SELF_RETRY_TIMEOUT_MILLIS_KEY, + DFSConfigKeys.DFS_STORAGE_POLICY_SATISFIER_SELF_RETRY_TIMEOUT_MILLIS_DEFAULT), + storageMovementNeeded); } /** http://git-wip-us.apache.org/repos/asf/hadoop/blob/67ebe8d9/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml index 1bc5c15..2b1e28a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml @@ -4227,6 +4227,29 @@ </property> <property> + <name>dfs.storage.policy.satisfier.recheck.timeout.millis</name> + <value>300000</value> + <description> + Blocks storage movements monitor re-check interval in milliseconds. + This check will verify whether any blocks storage movement results arrived from DN + and also verify if any of file blocks movements not at all reported to DN + since dfs.storage.policy.satisfier.self.retry.timeout. + The default value is 5 * 60 * 1000 (5 mins) + </description> +</property> + +<property> + <name>dfs.storage.policy.satisfier.self.retry.timeout.millis</name> + <value>1800000</value> + <description> + If any of file related block movements not at all reported by coordinator datanode, + then after this timeout(in milliseconds), the item will be added back to movement needed list + at namenode which will be retried for block movements. + The default value is 30 * 60 * 1000 (30 mins) + </description> +</property> + +<property> <name>dfs.pipeline.ecn</name> <value>false</value> <description> --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org