|
@@ -18,12 +18,17 @@
|
|
|
|
|
|
package org.apache.hadoop.filecache;
|
|
|
|
|
|
+import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
+import java.net.URI;
|
|
|
+
|
|
|
import org.apache.hadoop.classification.InterfaceAudience;
|
|
|
import org.apache.hadoop.classification.InterfaceStability;
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
+import org.apache.hadoop.fs.FileStatus;
|
|
|
import org.apache.hadoop.fs.FileSystem;
|
|
|
import org.apache.hadoop.fs.Path;
|
|
|
-import org.apache.hadoop.mapreduce.Job;
|
|
|
+import org.apache.hadoop.mapreduce.MRJobConfig;
|
|
|
|
|
|
/**
|
|
|
* Distribute application-specific large, read-only files efficiently.
|
|
@@ -123,9 +128,204 @@ import org.apache.hadoop.mapreduce.Job;
|
|
|
* @see org.apache.hadoop.mapred.JobClient
|
|
|
* @see org.apache.hadoop.mapreduce.Job
|
|
|
*/
|
|
|
+@SuppressWarnings("deprecation")
|
|
|
@InterfaceAudience.Public
|
|
|
@InterfaceStability.Stable
|
|
|
+@Deprecated
|
|
|
public class DistributedCache extends
|
|
|
org.apache.hadoop.mapreduce.filecache.DistributedCache {
|
|
|
- //
|
|
|
+ /**
|
|
|
+ * Warning: {@link #CACHE_FILES_SIZES} is not a *public* constant.
|
|
|
+ * The variable is kept for M/R 1.x applications, M/R 2.x applications should
|
|
|
+ * use {@link MRJobConfig#CACHE_FILES_SIZES}
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static final String CACHE_FILES_SIZES =
|
|
|
+ "mapred.cache.files.filesizes";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Warning: {@link #CACHE_ARCHIVES_SIZES} is not a *public* constant.
|
|
|
+ * The variable is kept for M/R 1.x applications, M/R 2.x applications should
|
|
|
+ * use {@link MRJobConfig#CACHE_ARCHIVES_SIZES}
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static final String CACHE_ARCHIVES_SIZES =
|
|
|
+ "mapred.cache.archives.filesizes";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Warning: {@link #CACHE_ARCHIVES_TIMESTAMPS} is not a *public* constant.
|
|
|
+ * The variable is kept for M/R 1.x applications, M/R 2.x applications should
|
|
|
+ * use {@link MRJobConfig#CACHE_ARCHIVES_TIMESTAMPS}
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static final String CACHE_ARCHIVES_TIMESTAMPS =
|
|
|
+ "mapred.cache.archives.timestamps";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Warning: {@link #CACHE_FILES_TIMESTAMPS} is not a *public* constant.
|
|
|
+ * The variable is kept for M/R 1.x applications, M/R 2.x applications should
|
|
|
+ * use {@link MRJobConfig#CACHE_FILE_TIMESTAMPS}
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static final String CACHE_FILES_TIMESTAMPS =
|
|
|
+ "mapred.cache.files.timestamps";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Warning: {@link #CACHE_ARCHIVES} is not a *public* constant.
|
|
|
+ * The variable is kept for M/R 1.x applications, M/R 2.x applications should
|
|
|
+ * use {@link MRJobConfig#CACHE_ARCHIVES}
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static final String CACHE_ARCHIVES = "mapred.cache.archives";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Warning: {@link #CACHE_FILES} is not a *public* constant.
|
|
|
+ * The variable is kept for M/R 1.x applications, M/R 2.x applications should
|
|
|
+ * use {@link MRJobConfig#CACHE_FILES}
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static final String CACHE_FILES = "mapred.cache.files";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Warning: {@link #CACHE_LOCALARCHIVES} is not a *public* constant.
|
|
|
+ * The variable is kept for M/R 1.x applications, M/R 2.x applications should
|
|
|
+ * use {@link MRJobConfig#CACHE_LOCALARCHIVES}
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static final String CACHE_LOCALARCHIVES =
|
|
|
+ "mapred.cache.localArchives";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Warning: {@link #CACHE_LOCALFILES} is not a *public* constant.
|
|
|
+ * The variable is kept for M/R 1.x applications, M/R 2.x applications should
|
|
|
+ * use {@link MRJobConfig#CACHE_LOCALFILES}
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static final String CACHE_LOCALFILES = "mapred.cache.localFiles";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Warning: {@link #CACHE_SYMLINK} is not a *public* constant.
|
|
|
+ * The variable is kept for M/R 1.x applications, M/R 2.x applications should
|
|
|
+ * use {@link MRJobConfig#CACHE_SYMLINK}
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static final String CACHE_SYMLINK = "mapred.create.symlink";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Add a archive that has been localized to the conf. Used
|
|
|
+ * by internal DistributedCache code.
|
|
|
+ * @param conf The conf to modify to contain the localized caches
|
|
|
+ * @param str a comma separated list of local archives
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static void addLocalArchives(Configuration conf, String str) {
|
|
|
+ String archives = conf.get(CACHE_LOCALARCHIVES);
|
|
|
+ conf.set(CACHE_LOCALARCHIVES, archives == null ? str
|
|
|
+ : archives + "," + str);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Add a file that has been localized to the conf.. Used
|
|
|
+ * by internal DistributedCache code.
|
|
|
+ * @param conf The conf to modify to contain the localized caches
|
|
|
+ * @param str a comma separated list of local files
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static void addLocalFiles(Configuration conf, String str) {
|
|
|
+ String files = conf.get(CACHE_LOCALFILES);
|
|
|
+ conf.set(CACHE_LOCALFILES, files == null ? str
|
|
|
+ : files + "," + str);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * This method create symlinks for all files in a given dir in another
|
|
|
+ * directory. Currently symlinks cannot be disabled. This is a NO-OP.
|
|
|
+ *
|
|
|
+ * @param conf the configuration
|
|
|
+ * @param jobCacheDir the target directory for creating symlinks
|
|
|
+ * @param workDir the directory in which the symlinks are created
|
|
|
+ * @throws IOException
|
|
|
+ * @deprecated Internal to MapReduce framework. Use DistributedCacheManager
|
|
|
+ * instead.
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static void createAllSymlink(
|
|
|
+ Configuration conf, File jobCacheDir, File workDir)
|
|
|
+ throws IOException{
|
|
|
+ // Do nothing
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns {@link FileStatus} of a given cache file on hdfs. Internal to
|
|
|
+ * MapReduce.
|
|
|
+ * @param conf configuration
|
|
|
+ * @param cache cache file
|
|
|
+ * @return <code>FileStatus</code> of a given cache file on hdfs
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static FileStatus getFileStatus(Configuration conf, URI cache)
|
|
|
+ throws IOException {
|
|
|
+ FileSystem fileSystem = FileSystem.get(cache, conf);
|
|
|
+ return fileSystem.getFileStatus(new Path(cache.getPath()));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns mtime of a given cache file on hdfs. Internal to MapReduce.
|
|
|
+ * @param conf configuration
|
|
|
+ * @param cache cache file
|
|
|
+ * @return mtime of a given cache file on hdfs
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static long getTimestamp(Configuration conf, URI cache)
|
|
|
+ throws IOException {
|
|
|
+ return getFileStatus(conf, cache).getModificationTime();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * This is to check the timestamp of the archives to be localized.
|
|
|
+ * Used by internal MapReduce code.
|
|
|
+ * @param conf Configuration which stores the timestamp's
|
|
|
+ * @param timestamps comma separated list of timestamps of archives.
|
|
|
+ * The order should be the same as the order in which the archives are added.
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static void setArchiveTimestamps(Configuration conf, String timestamps) {
|
|
|
+ conf.set(CACHE_ARCHIVES_TIMESTAMPS, timestamps);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * This is to check the timestamp of the files to be localized.
|
|
|
+ * Used by internal MapReduce code.
|
|
|
+ * @param conf Configuration which stores the timestamp's
|
|
|
+ * @param timestamps comma separated list of timestamps of files.
|
|
|
+ * The order should be the same as the order in which the files are added.
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static void setFileTimestamps(Configuration conf, String timestamps) {
|
|
|
+ conf.set(CACHE_FILES_TIMESTAMPS, timestamps);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set the conf to contain the location for localized archives. Used
|
|
|
+ * by internal DistributedCache code.
|
|
|
+ * @param conf The conf to modify to contain the localized caches
|
|
|
+ * @param str a comma separated list of local archives
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static void setLocalArchives(Configuration conf, String str) {
|
|
|
+ conf.set(CACHE_LOCALARCHIVES, str);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set the conf to contain the location for localized files. Used
|
|
|
+ * by internal DistributedCache code.
|
|
|
+ * @param conf The conf to modify to contain the localized caches
|
|
|
+ * @param str a comma separated list of local files
|
|
|
+ */
|
|
|
+ @Deprecated
|
|
|
+ public static void setLocalFiles(Configuration conf, String str) {
|
|
|
+ conf.set(CACHE_LOCALFILES, str);
|
|
|
+ }
|
|
|
}
|