id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
118,500 | facebookarchive/hadoop-20 | src/contrib/hmon/src/java/org/apache/hadoop/mapred/UtilizationCollector.java | UtilizationCollector.stop | public void stop() {
running = false;
if (server != null) server.stop();
if (aggregateDaemon != null) aggregateDaemon.interrupt();
} | java | public void stop() {
running = false;
if (server != null) server.stop();
if (aggregateDaemon != null) aggregateDaemon.interrupt();
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"running",
"=",
"false",
";",
"if",
"(",
"server",
"!=",
"null",
")",
"server",
".",
"stop",
"(",
")",
";",
"if",
"(",
"aggregateDaemon",
"!=",
"null",
")",
"aggregateDaemon",
".",
"interrupt",
"(",
")",
";",
... | Stop all Collector threads and wait for all to finish. | [
"Stop",
"all",
"Collector",
"threads",
"and",
"wait",
"for",
"all",
"to",
"finish",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/hmon/src/java/org/apache/hadoop/mapred/UtilizationCollector.java#L224-L228 |
118,501 | facebookarchive/hadoop-20 | src/contrib/hmon/src/java/org/apache/hadoop/mapred/UtilizationCollector.java | UtilizationCollector.getTaskTrackerUtilization | @Override
public TaskTrackerUtilization getTaskTrackerUtilization(String hostName)
throws IOException {
if (taskTrackerReports.get(hostName) == null) {
return null;
}
return taskTrackerReports.get(hostName).getTaskTrackerUtilization();
} | java | @Override
public TaskTrackerUtilization getTaskTrackerUtilization(String hostName)
throws IOException {
if (taskTrackerReports.get(hostName) == null) {
return null;
}
return taskTrackerReports.get(hostName).getTaskTrackerUtilization();
} | [
"@",
"Override",
"public",
"TaskTrackerUtilization",
"getTaskTrackerUtilization",
"(",
"String",
"hostName",
")",
"throws",
"IOException",
"{",
"if",
"(",
"taskTrackerReports",
".",
"get",
"(",
"hostName",
")",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",... | Implement CollectorProtocol methods | [
"Implement",
"CollectorProtocol",
"methods"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/hmon/src/java/org/apache/hadoop/mapred/UtilizationCollector.java#L407-L414 |
118,502 | facebookarchive/hadoop-20 | src/contrib/hmon/src/java/org/apache/hadoop/mapred/UtilizationCollector.java | UtilizationCollector.main | public static void main(String argv[]) throws Exception {
StringUtils.startupShutdownMessage(UtilizationCollector.class, argv, LOG);
try {
Configuration conf = new Configuration();
UtilizationCollector collector = new UtilizationCollector(conf);
if (collector != null) {
collector.join(... | java | public static void main(String argv[]) throws Exception {
StringUtils.startupShutdownMessage(UtilizationCollector.class, argv, LOG);
try {
Configuration conf = new Configuration();
UtilizationCollector collector = new UtilizationCollector(conf);
if (collector != null) {
collector.join(... | [
"public",
"static",
"void",
"main",
"(",
"String",
"argv",
"[",
"]",
")",
"throws",
"Exception",
"{",
"StringUtils",
".",
"startupShutdownMessage",
"(",
"UtilizationCollector",
".",
"class",
",",
"argv",
",",
"LOG",
")",
";",
"try",
"{",
"Configuration",
"co... | main program to run on the Collector server | [
"main",
"program",
"to",
"run",
"on",
"the",
"Collector",
"server"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/hmon/src/java/org/apache/hadoop/mapred/UtilizationCollector.java#L480-L492 |
118,503 | facebookarchive/hadoop-20 | src/tools/org/apache/hadoop/tools/HadoopArchives.java | HadoopArchives.checkPaths | private static void checkPaths(Configuration conf, List<Path> paths) throws
IOException {
for (Path p : paths) {
FileSystem fs = p.getFileSystem(conf);
if (!fs.exists(p)) {
throw new FileNotFoundException("Source " + p + " does not exist.");
}
}
} | java | private static void checkPaths(Configuration conf, List<Path> paths) throws
IOException {
for (Path p : paths) {
FileSystem fs = p.getFileSystem(conf);
if (!fs.exists(p)) {
throw new FileNotFoundException("Source " + p + " does not exist.");
}
}
} | [
"private",
"static",
"void",
"checkPaths",
"(",
"Configuration",
"conf",
",",
"List",
"<",
"Path",
">",
"paths",
")",
"throws",
"IOException",
"{",
"for",
"(",
"Path",
"p",
":",
"paths",
")",
"{",
"FileSystem",
"fs",
"=",
"p",
".",
"getFileSystem",
"(",
... | check the src paths | [
"check",
"the",
"src",
"paths"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/tools/org/apache/hadoop/tools/HadoopArchives.java#L162-L170 |
118,504 | facebookarchive/hadoop-20 | src/tools/org/apache/hadoop/tools/HadoopArchives.java | HadoopArchives.relPathToRoot | private Path relPathToRoot(Path fullPath, Path root) {
// just take some effort to do it
// rather than just using substring
// so that we do not break sometime later
Path justRoot = new Path(Path.SEPARATOR);
if (fullPath.depth() == root.depth()) {
return justRoot;
}
else if (fullPat... | java | private Path relPathToRoot(Path fullPath, Path root) {
// just take some effort to do it
// rather than just using substring
// so that we do not break sometime later
Path justRoot = new Path(Path.SEPARATOR);
if (fullPath.depth() == root.depth()) {
return justRoot;
}
else if (fullPat... | [
"private",
"Path",
"relPathToRoot",
"(",
"Path",
"fullPath",
",",
"Path",
"root",
")",
"{",
"// just take some effort to do it ",
"// rather than just using substring ",
"// so that we do not break sometime later",
"Path",
"justRoot",
"=",
"new",
"Path",
"(",
"Path",
".",
... | truncate the prefix root from the full path
@param fullPath the full path
@param root the prefix root to be truncated
@return the relative path | [
"truncate",
"the",
"prefix",
"root",
"from",
"the",
"full",
"path"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/tools/org/apache/hadoop/tools/HadoopArchives.java#L276-L294 |
118,505 | facebookarchive/hadoop-20 | src/tools/org/apache/hadoop/tools/HadoopArchives.java | HadoopArchives.cleanJobDirectory | private void cleanJobDirectory() {
try {
FileSystem jobfs = jobDirectory.getFileSystem(conf);
jobfs.delete(jobDirectory, true);
} catch(IOException ioe) {
LOG.warn("Unable to clean tmp directory " + jobDirectory, ioe);
}
} | java | private void cleanJobDirectory() {
try {
FileSystem jobfs = jobDirectory.getFileSystem(conf);
jobfs.delete(jobDirectory, true);
} catch(IOException ioe) {
LOG.warn("Unable to clean tmp directory " + jobDirectory, ioe);
}
} | [
"private",
"void",
"cleanJobDirectory",
"(",
")",
"{",
"try",
"{",
"FileSystem",
"jobfs",
"=",
"jobDirectory",
".",
"getFileSystem",
"(",
"conf",
")",
";",
"jobfs",
".",
"delete",
"(",
"jobDirectory",
",",
"true",
")",
";",
"}",
"catch",
"(",
"IOException"... | delete the tmp job directory | [
"delete",
"the",
"tmp",
"job",
"directory"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/tools/org/apache/hadoop/tools/HadoopArchives.java#L373-L380 |
118,506 | facebookarchive/hadoop-20 | src/tools/org/apache/hadoop/tools/HadoopArchives.java | HadoopArchives.archive | private void archive(Path parentPath, List<Path> srcPaths, Path outputPath, boolean append)
throws IOException {
parentPath = parentPath.makeQualified(parentPath.getFileSystem(conf));
checkPaths(conf, srcPaths);
Path destinationDir = outputPath.getParent();
FileOutputFormat.setOutputPath(conf, ou... | java | private void archive(Path parentPath, List<Path> srcPaths, Path outputPath, boolean append)
throws IOException {
parentPath = parentPath.makeQualified(parentPath.getFileSystem(conf));
checkPaths(conf, srcPaths);
Path destinationDir = outputPath.getParent();
FileOutputFormat.setOutputPath(conf, ou... | [
"private",
"void",
"archive",
"(",
"Path",
"parentPath",
",",
"List",
"<",
"Path",
">",
"srcPaths",
",",
"Path",
"outputPath",
",",
"boolean",
"append",
")",
"throws",
"IOException",
"{",
"parentPath",
"=",
"parentPath",
".",
"makeQualified",
"(",
"parentPath"... | archive the given source paths into the dest
@param parentPath
the parent path of all the source paths
@param srcPaths
the src paths to be archived
@param dest
the dest dir that will contain the archive
@param append
append to existing archive or create new | [
"archive",
"the",
"given",
"source",
"paths",
"into",
"the",
"dest"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/tools/org/apache/hadoop/tools/HadoopArchives.java#L546-L616 |
118,507 | facebookarchive/hadoop-20 | src/tools/org/apache/hadoop/tools/HadoopArchives.java | HadoopArchives.writeLineToMasterIndex | private static void writeLineToMasterIndex(FSDataOutputStream stream, long startHash,
long endHash, long indexStartPos, long indexEndPos) throws IOException {
String toWrite = startHash + " " + endHash + " " + indexStartPos + " " + indexEndPos + "\n";
stream.write(toWrite.getBytes());
} | java | private static void writeLineToMasterIndex(FSDataOutputStream stream, long startHash,
long endHash, long indexStartPos, long indexEndPos) throws IOException {
String toWrite = startHash + " " + endHash + " " + indexStartPos + " " + indexEndPos + "\n";
stream.write(toWrite.getBytes());
} | [
"private",
"static",
"void",
"writeLineToMasterIndex",
"(",
"FSDataOutputStream",
"stream",
",",
"long",
"startHash",
",",
"long",
"endHash",
",",
"long",
"indexStartPos",
",",
"long",
"indexEndPos",
")",
"throws",
"IOException",
"{",
"String",
"toWrite",
"=",
"st... | Writes data corresponding to part of _index to master index
@param stream stream where to write data
@param startHash hash of first entry in block
@param endHash hash of last entry in block
@param indexStartPos position (in bytes) of the beginning of the block
@param indexEndPos position (in bytes) of the end of the bl... | [
"Writes",
"data",
"corresponding",
"to",
"part",
"of",
"_index",
"to",
"master",
"index"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/tools/org/apache/hadoop/tools/HadoopArchives.java#L1097-L1101 |
118,508 | facebookarchive/hadoop-20 | src/tools/org/apache/hadoop/tools/HadoopArchives.java | HadoopArchives.createNewPartStream | private FSDataOutputStream createNewPartStream(Path dst, int partId) throws IOException {
String partName = PART_PREFIX + partId;
Path output = new Path(dst, partName);
FileSystem destFs = output.getFileSystem(conf);
FSDataOutputStream partStream = destFs.create(output, false,
conf.getInt("io.fi... | java | private FSDataOutputStream createNewPartStream(Path dst, int partId) throws IOException {
String partName = PART_PREFIX + partId;
Path output = new Path(dst, partName);
FileSystem destFs = output.getFileSystem(conf);
FSDataOutputStream partStream = destFs.create(output, false,
conf.getInt("io.fi... | [
"private",
"FSDataOutputStream",
"createNewPartStream",
"(",
"Path",
"dst",
",",
"int",
"partId",
")",
"throws",
"IOException",
"{",
"String",
"partName",
"=",
"PART_PREFIX",
"+",
"partId",
";",
"Path",
"output",
"=",
"new",
"Path",
"(",
"dst",
",",
"partName"... | Creates new stream to write actual file data
@param dst parent of the part-id file
@param partId id of the part
@return the open stream
@throws IOException | [
"Creates",
"new",
"stream",
"to",
"write",
"actual",
"file",
"data"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/tools/org/apache/hadoop/tools/HadoopArchives.java#L1110-L1118 |
118,509 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/MetaRecoveryContext.java | MetaRecoveryContext.ask | public static String ask(String prompt, String firstChoice, String... choices)
throws IOException {
while (true) {
LOG.info(prompt);
StringBuilder responseBuilder = new StringBuilder();
while (true) {
int c = System.in.read();
if (c == -1 || c == '\r' || c == '\n') {
... | java | public static String ask(String prompt, String firstChoice, String... choices)
throws IOException {
while (true) {
LOG.info(prompt);
StringBuilder responseBuilder = new StringBuilder();
while (true) {
int c = System.in.read();
if (c == -1 || c == '\r' || c == '\n') {
... | [
"public",
"static",
"String",
"ask",
"(",
"String",
"prompt",
",",
"String",
"firstChoice",
",",
"String",
"...",
"choices",
")",
"throws",
"IOException",
"{",
"while",
"(",
"true",
")",
"{",
"LOG",
".",
"info",
"(",
"prompt",
")",
";",
"StringBuilder",
... | Display a prompt to the user and get his or her choice.
@param prompt The prompt to display
@param default First choice (will be taken if autoChooseDefault is
true)
@param choices Other choies
@return The choice that was taken
@throws IOException | [
"Display",
"a",
"prompt",
"to",
"the",
"user",
"and",
"get",
"his",
"or",
"her",
"choice",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/MetaRecoveryContext.java#L40-L62 |
118,510 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/SimulatedTaskRunner.java | SimulatedTaskRunner.launchTask | public void launchTask(TaskInProgress tip) throws IOException {
LOG.info("Launching simulated task " + tip.getTask().getTaskID() +
" for job " + tip.getTask().getJobID());
TaskUmbilicalProtocol umbilicalProtocol = taskTracker.getUmbilical(tip);
// For map tasks, we can just finish the task after som... | java | public void launchTask(TaskInProgress tip) throws IOException {
LOG.info("Launching simulated task " + tip.getTask().getTaskID() +
" for job " + tip.getTask().getJobID());
TaskUmbilicalProtocol umbilicalProtocol = taskTracker.getUmbilical(tip);
// For map tasks, we can just finish the task after som... | [
"public",
"void",
"launchTask",
"(",
"TaskInProgress",
"tip",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"info",
"(",
"\"Launching simulated task \"",
"+",
"tip",
".",
"getTask",
"(",
")",
".",
"getTaskID",
"(",
")",
"+",
"\" for job \"",
"+",
"tip",
"."... | The primary public method that should be called to 'run' a task. Handles
both map and reduce tasks and marks them as completed after the configured
time interval
@param tip | [
"The",
"primary",
"public",
"method",
"that",
"should",
"be",
"called",
"to",
"run",
"a",
"task",
".",
"Handles",
"both",
"map",
"and",
"reduce",
"tasks",
"and",
"marks",
"them",
"as",
"completed",
"after",
"the",
"configured",
"time",
"interval"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/SimulatedTaskRunner.java#L144-L162 |
118,511 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/SimulatedTaskRunner.java | SimulatedTaskRunner.addTipToFinish | protected void addTipToFinish(TaskInProgress tip,
TaskUmbilicalProtocol umbilicalProtocol) {
long currentTime = System.currentTimeMillis();
long finishTime = currentTime + Math.abs(rand.nextLong()) %
timeToFinishTask;
LOG.info("Adding TIP " + tip.getTask().getTaskID()... | java | protected void addTipToFinish(TaskInProgress tip,
TaskUmbilicalProtocol umbilicalProtocol) {
long currentTime = System.currentTimeMillis();
long finishTime = currentTime + Math.abs(rand.nextLong()) %
timeToFinishTask;
LOG.info("Adding TIP " + tip.getTask().getTaskID()... | [
"protected",
"void",
"addTipToFinish",
"(",
"TaskInProgress",
"tip",
",",
"TaskUmbilicalProtocol",
"umbilicalProtocol",
")",
"{",
"long",
"currentTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"long",
"finishTime",
"=",
"currentTime",
"+",
"Math",
... | Add the specified TaskInProgress to the priority queue of tasks to finish.
@param tip
@param umbilicalProtocol | [
"Add",
"the",
"specified",
"TaskInProgress",
"to",
"the",
"priority",
"queue",
"of",
"tasks",
"to",
"finish",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/SimulatedTaskRunner.java#L169-L184 |
118,512 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/SimulatedTaskRunner.java | SimulatedTaskRunner.run | @Override
public void run() {
while (true) {
// Wait to get a TIP
TipToFinish ttf = null;
try {
LOG.debug("Waiting for a TIP");
ttf = tipQueue.take();
} catch (InterruptedException e) {
LOG.info("Got interrupted exception while waiting to take()");
continue;... | java | @Override
public void run() {
while (true) {
// Wait to get a TIP
TipToFinish ttf = null;
try {
LOG.debug("Waiting for a TIP");
ttf = tipQueue.take();
} catch (InterruptedException e) {
LOG.info("Got interrupted exception while waiting to take()");
continue;... | [
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"while",
"(",
"true",
")",
"{",
"// Wait to get a TIP",
"TipToFinish",
"ttf",
"=",
"null",
";",
"try",
"{",
"LOG",
".",
"debug",
"(",
"\"Waiting for a TIP\"",
")",
";",
"ttf",
"=",
"tipQueue",
".",... | Continuously looks through the queue of TIP's to mark as finished,
finishing and sleeping as necessary. Can be interrupted while it's sleeping
if it needs to re-evaluate how long to sleep. | [
"Continuously",
"looks",
"through",
"the",
"queue",
"of",
"TIP",
"s",
"to",
"mark",
"as",
"finished",
"finishing",
"and",
"sleeping",
"as",
"necessary",
".",
"Can",
"be",
"interrupted",
"while",
"it",
"s",
"sleeping",
"if",
"it",
"needs",
"to",
"re",
"-",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/SimulatedTaskRunner.java#L192-L261 |
118,513 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/SimulatedTaskRunner.java | SimulatedTaskRunner.cancel | public void cancel(TaskInProgress tip) {
LOG.info("Canceling task " + tip.getTask().getTaskID() + " of job " +
tip.getTask().getJobID());
// Cancel & remove the map completion finish thread for reduce tasks.
if (!tip.getTask().isMapTask() && !tip.getTask().isTaskCleanupTask()) {
if (!mapperWa... | java | public void cancel(TaskInProgress tip) {
LOG.info("Canceling task " + tip.getTask().getTaskID() + " of job " +
tip.getTask().getJobID());
// Cancel & remove the map completion finish thread for reduce tasks.
if (!tip.getTask().isMapTask() && !tip.getTask().isTaskCleanupTask()) {
if (!mapperWa... | [
"public",
"void",
"cancel",
"(",
"TaskInProgress",
"tip",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Canceling task \"",
"+",
"tip",
".",
"getTask",
"(",
")",
".",
"getTaskID",
"(",
")",
"+",
"\" of job \"",
"+",
"tip",
".",
"getTask",
"(",
")",
".",
"getJo... | Called in case the task needs to be killed. Canceling will kill any map
wait threads and also remove it from the queue of tasks that should be
marked as finished.
@param tip the killed TaskInProgress | [
"Called",
"in",
"case",
"the",
"task",
"needs",
"to",
"be",
"killed",
".",
"Canceling",
"will",
"kill",
"any",
"map",
"wait",
"threads",
"and",
"also",
"remove",
"it",
"from",
"the",
"queue",
"of",
"tasks",
"that",
"should",
"be",
"marked",
"as",
"finish... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/SimulatedTaskRunner.java#L279-L300 |
118,514 | facebookarchive/hadoop-20 | src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/HadoopLogParser.java | HadoopLogParser.parseLine | public EventRecord parseLine(String line) throws IOException {
EventRecord retval = null;
if (line != null) {
// process line
String patternStr = "(" + dateformat + ")";
patternStr += "\\s+";
patternStr += "(" + timeformat + ")";
patternStr += ".{4}\\s(\\w*)\\s"; // for logLevel
... | java | public EventRecord parseLine(String line) throws IOException {
EventRecord retval = null;
if (line != null) {
// process line
String patternStr = "(" + dateformat + ")";
patternStr += "\\s+";
patternStr += "(" + timeformat + ")";
patternStr += ".{4}\\s(\\w*)\\s"; // for logLevel
... | [
"public",
"EventRecord",
"parseLine",
"(",
"String",
"line",
")",
"throws",
"IOException",
"{",
"EventRecord",
"retval",
"=",
"null",
";",
"if",
"(",
"line",
"!=",
"null",
")",
"{",
"// process line",
"String",
"patternStr",
"=",
"\"(\"",
"+",
"dateformat",
... | Parses one line of the log. If the line contains a valid
log entry, then an appropriate EventRecord is returned, after all
relevant fields have been parsed.
@param line the log line to be parsed
@return the EventRecord representing the log entry of the line. If
the line does not contain a valid log entry, then the Ev... | [
"Parses",
"one",
"line",
"of",
"the",
"log",
".",
"If",
"the",
"line",
"contains",
"a",
"valid",
"log",
"entry",
"then",
"an",
"appropriate",
"EventRecord",
"is",
"returned",
"after",
"all",
"relevant",
"fields",
"have",
"been",
"parsed",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/HadoopLogParser.java#L60-L87 |
118,515 | facebookarchive/hadoop-20 | src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/HadoopLogParser.java | HadoopLogParser.parseDate | protected Calendar parseDate(String strDate, String strTime) {
Calendar retval = Calendar.getInstance();
// set date
String[] fields = strDate.split("-");
retval.set(Calendar.YEAR, Integer.parseInt(fields[0]));
retval.set(Calendar.MONTH, Integer.parseInt(fields[1]));
retval.set(Calendar.DATE, In... | java | protected Calendar parseDate(String strDate, String strTime) {
Calendar retval = Calendar.getInstance();
// set date
String[] fields = strDate.split("-");
retval.set(Calendar.YEAR, Integer.parseInt(fields[0]));
retval.set(Calendar.MONTH, Integer.parseInt(fields[1]));
retval.set(Calendar.DATE, In... | [
"protected",
"Calendar",
"parseDate",
"(",
"String",
"strDate",
",",
"String",
"strTime",
")",
"{",
"Calendar",
"retval",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"// set date",
"String",
"[",
"]",
"fields",
"=",
"strDate",
".",
"split",
"(",
"\... | Parse a date found in the Hadoop log.
@return a Calendar representing the date | [
"Parse",
"a",
"date",
"found",
"in",
"the",
"Hadoop",
"log",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/HadoopLogParser.java#L94-L107 |
118,516 | facebookarchive/hadoop-20 | src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/HadoopLogParser.java | HadoopLogParser.findHostname | private void findHostname() {
String startupInfo = Environment.runCommand(
"grep --max-count=1 STARTUP_MSG:\\s*host " + file.getName()).toString();
Pattern pattern = Pattern.compile("\\s+(\\w+/.+)\\s+");
Matcher matcher = pattern.matcher(startupInfo);
if (matcher.find(0)) {
hostname = matc... | java | private void findHostname() {
String startupInfo = Environment.runCommand(
"grep --max-count=1 STARTUP_MSG:\\s*host " + file.getName()).toString();
Pattern pattern = Pattern.compile("\\s+(\\w+/.+)\\s+");
Matcher matcher = pattern.matcher(startupInfo);
if (matcher.find(0)) {
hostname = matc... | [
"private",
"void",
"findHostname",
"(",
")",
"{",
"String",
"startupInfo",
"=",
"Environment",
".",
"runCommand",
"(",
"\"grep --max-count=1 STARTUP_MSG:\\\\s*host \"",
"+",
"file",
".",
"getName",
"(",
")",
")",
".",
"toString",
"(",
")",
";",
"Pattern",
"patte... | Attempt to determine the hostname of the node that created the
log file. This information can be found in the STARTUP_MSG lines
of the Hadoop log, which are emitted when the node starts. | [
"Attempt",
"to",
"determine",
"the",
"hostname",
"of",
"the",
"node",
"that",
"created",
"the",
"log",
"file",
".",
"This",
"information",
"can",
"be",
"found",
"in",
"the",
"STARTUP_MSG",
"lines",
"of",
"the",
"Hadoop",
"log",
"which",
"are",
"emitted",
"... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/HadoopLogParser.java#L115-L125 |
118,517 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/CorruptReplicasMap.java | CorruptReplicasMap.addToCorruptReplicasMap | public boolean addToCorruptReplicasMap(Block blk, DatanodeDescriptor dn) {
Collection<DatanodeDescriptor> nodes = getNodes(blk);
if (nodes == null) {
nodes = new TreeSet<DatanodeDescriptor>();
corruptReplicasMap.put(blk, nodes);
}
boolean added = false;
if (!nodes.contains(dn)) {
a... | java | public boolean addToCorruptReplicasMap(Block blk, DatanodeDescriptor dn) {
Collection<DatanodeDescriptor> nodes = getNodes(blk);
if (nodes == null) {
nodes = new TreeSet<DatanodeDescriptor>();
corruptReplicasMap.put(blk, nodes);
}
boolean added = false;
if (!nodes.contains(dn)) {
a... | [
"public",
"boolean",
"addToCorruptReplicasMap",
"(",
"Block",
"blk",
",",
"DatanodeDescriptor",
"dn",
")",
"{",
"Collection",
"<",
"DatanodeDescriptor",
">",
"nodes",
"=",
"getNodes",
"(",
"blk",
")",
";",
"if",
"(",
"nodes",
"==",
"null",
")",
"{",
"nodes",... | Mark the block belonging to datanode as corrupt.
@param blk Block to be added to CorruptReplicasMap
@param dn DatanodeDescriptor which holds the corrupt replica
@return if the block gets added or not | [
"Mark",
"the",
"block",
"belonging",
"to",
"datanode",
"as",
"corrupt",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/CorruptReplicasMap.java#L46-L67 |
118,518 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/CorruptReplicasMap.java | CorruptReplicasMap.removeFromCorruptReplicasMap | boolean removeFromCorruptReplicasMap(Block blk, DatanodeDescriptor datanode) {
Collection<DatanodeDescriptor> datanodes = corruptReplicasMap.get(blk);
if (datanodes==null)
return false;
if (datanodes.remove(datanode)) { // remove the replicas
if (datanodes.isEmpty()) {
// remove the bloc... | java | boolean removeFromCorruptReplicasMap(Block blk, DatanodeDescriptor datanode) {
Collection<DatanodeDescriptor> datanodes = corruptReplicasMap.get(blk);
if (datanodes==null)
return false;
if (datanodes.remove(datanode)) { // remove the replicas
if (datanodes.isEmpty()) {
// remove the bloc... | [
"boolean",
"removeFromCorruptReplicasMap",
"(",
"Block",
"blk",
",",
"DatanodeDescriptor",
"datanode",
")",
"{",
"Collection",
"<",
"DatanodeDescriptor",
">",
"datanodes",
"=",
"corruptReplicasMap",
".",
"get",
"(",
"blk",
")",
";",
"if",
"(",
"datanodes",
"==",
... | Remove the block at the given datanode from CorruptBlockMap
@param blk block to be removed
@param datanode datanode where the block is located
@return true if the removal is successful;
false if the replica is not in the map | [
"Remove",
"the",
"block",
"at",
"the",
"given",
"datanode",
"from",
"CorruptBlockMap"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/CorruptReplicasMap.java#L87-L99 |
118,519 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/CorruptReplicasMap.java | CorruptReplicasMap.getNodes | Collection<DatanodeDescriptor> getNodes(Block blk) {
if (corruptReplicasMap.size() == 0)
return null;
return corruptReplicasMap.get(blk);
} | java | Collection<DatanodeDescriptor> getNodes(Block blk) {
if (corruptReplicasMap.size() == 0)
return null;
return corruptReplicasMap.get(blk);
} | [
"Collection",
"<",
"DatanodeDescriptor",
">",
"getNodes",
"(",
"Block",
"blk",
")",
"{",
"if",
"(",
"corruptReplicasMap",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"return",
"corruptReplicasMap",
".",
"get",
"(",
"blk",
")",
";",
"}"
... | Get Nodes which have corrupt replicas of Block
@param blk Block for which nodes are requested
@return collection of nodes. Null if does not exists | [
"Get",
"Nodes",
"which",
"have",
"corrupt",
"replicas",
"of",
"Block"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/CorruptReplicasMap.java#L108-L112 |
118,520 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/CorruptReplicasMap.java | CorruptReplicasMap.isReplicaCorrupt | boolean isReplicaCorrupt(Block blk, DatanodeDescriptor node) {
Collection<DatanodeDescriptor> nodes = getNodes(blk);
return ((nodes != null) && (nodes.contains(node)));
} | java | boolean isReplicaCorrupt(Block blk, DatanodeDescriptor node) {
Collection<DatanodeDescriptor> nodes = getNodes(blk);
return ((nodes != null) && (nodes.contains(node)));
} | [
"boolean",
"isReplicaCorrupt",
"(",
"Block",
"blk",
",",
"DatanodeDescriptor",
"node",
")",
"{",
"Collection",
"<",
"DatanodeDescriptor",
">",
"nodes",
"=",
"getNodes",
"(",
"blk",
")",
";",
"return",
"(",
"(",
"nodes",
"!=",
"null",
")",
"&&",
"(",
"nodes... | Check if replica belonging to Datanode is corrupt
@param blk Block to check
@param node DatanodeDescriptor which holds the replica
@return true if replica is corrupt, false if does not exists in this map | [
"Check",
"if",
"replica",
"belonging",
"to",
"Datanode",
"is",
"corrupt"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/CorruptReplicasMap.java#L121-L124 |
118,521 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/ipc/ProtocolSignature.java | ProtocolSignature.getFingerprint | static int getFingerprint(Method method) {
int hashcode = method.getName().hashCode();
hashcode = hashcode + 31*method.getReturnType().getName().hashCode();
for (Class<?> type : method.getParameterTypes()) {
hashcode = 31*hashcode ^ type.getName().hashCode();
}
return hashcode;
} | java | static int getFingerprint(Method method) {
int hashcode = method.getName().hashCode();
hashcode = hashcode + 31*method.getReturnType().getName().hashCode();
for (Class<?> type : method.getParameterTypes()) {
hashcode = 31*hashcode ^ type.getName().hashCode();
}
return hashcode;
} | [
"static",
"int",
"getFingerprint",
"(",
"Method",
"method",
")",
"{",
"int",
"hashcode",
"=",
"method",
".",
"getName",
"(",
")",
".",
"hashCode",
"(",
")",
";",
"hashcode",
"=",
"hashcode",
"+",
"31",
"*",
"method",
".",
"getReturnType",
"(",
")",
"."... | Calculate a method's hash code considering its method
name, returning type, and its parameter types
@param method a method
@return its hash code | [
"Calculate",
"a",
"method",
"s",
"hash",
"code",
"considering",
"its",
"method",
"name",
"returning",
"type",
"and",
"its",
"parameter",
"types"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/ProtocolSignature.java#L103-L110 |
118,522 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/ipc/ProtocolSignature.java | ProtocolSignature.getFingerprints | private static int[] getFingerprints(Method[] methods) {
if (methods == null) {
return null;
}
int[] hashCodes = new int[methods.length];
for (int i = 0; i<methods.length; i++) {
hashCodes[i] = getFingerprint(methods[i]);
}
return hashCodes;
} | java | private static int[] getFingerprints(Method[] methods) {
if (methods == null) {
return null;
}
int[] hashCodes = new int[methods.length];
for (int i = 0; i<methods.length; i++) {
hashCodes[i] = getFingerprint(methods[i]);
}
return hashCodes;
} | [
"private",
"static",
"int",
"[",
"]",
"getFingerprints",
"(",
"Method",
"[",
"]",
"methods",
")",
"{",
"if",
"(",
"methods",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"[",
"]",
"hashCodes",
"=",
"new",
"int",
"[",
"methods",
".",
"... | Convert an array of Method into an array of hash codes
@param methods
@return array of hash codes | [
"Convert",
"an",
"array",
"of",
"Method",
"into",
"an",
"array",
"of",
"hash",
"codes"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/ProtocolSignature.java#L118-L127 |
118,523 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/ipc/ProtocolSignature.java | ProtocolSignature.getSigFingerprint | private static ProtocolSigFingerprint getSigFingerprint(
Class <? extends VersionedProtocol> protocol, long serverVersion) {
String protocolName = protocol.getName();
synchronized (PROTOCOL_FINGERPRINT_CACHE) {
ProtocolSigFingerprint sig = PROTOCOL_FINGERPRINT_CACHE.get(protocolName);
if (sig ... | java | private static ProtocolSigFingerprint getSigFingerprint(
Class <? extends VersionedProtocol> protocol, long serverVersion) {
String protocolName = protocol.getName();
synchronized (PROTOCOL_FINGERPRINT_CACHE) {
ProtocolSigFingerprint sig = PROTOCOL_FINGERPRINT_CACHE.get(protocolName);
if (sig ... | [
"private",
"static",
"ProtocolSigFingerprint",
"getSigFingerprint",
"(",
"Class",
"<",
"?",
"extends",
"VersionedProtocol",
">",
"protocol",
",",
"long",
"serverVersion",
")",
"{",
"String",
"protocolName",
"=",
"protocol",
".",
"getName",
"(",
")",
";",
"synchron... | Return a protocol's signature and finger print from cache
@param protocol a protocol class
@param serverVersion protocol version
@return its signature and finger print | [
"Return",
"a",
"protocol",
"s",
"signature",
"and",
"finger",
"print",
"from",
"cache"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/ProtocolSignature.java#L183-L197 |
118,524 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/Utilities.java | Utilities.incrComputeSpecs | public static void incrComputeSpecs(ComputeSpecs target, ComputeSpecs incr) {
target.numCpus += incr.numCpus;
target.memoryMB += incr.memoryMB;
target.diskGB += incr.diskGB;
} | java | public static void incrComputeSpecs(ComputeSpecs target, ComputeSpecs incr) {
target.numCpus += incr.numCpus;
target.memoryMB += incr.memoryMB;
target.diskGB += incr.diskGB;
} | [
"public",
"static",
"void",
"incrComputeSpecs",
"(",
"ComputeSpecs",
"target",
",",
"ComputeSpecs",
"incr",
")",
"{",
"target",
".",
"numCpus",
"+=",
"incr",
".",
"numCpus",
";",
"target",
".",
"memoryMB",
"+=",
"incr",
".",
"memoryMB",
";",
"target",
".",
... | Increase the compute specs
@param target the compute specs to increase
@param incr the increment | [
"Increase",
"the",
"compute",
"specs"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/Utilities.java#L88-L92 |
118,525 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/Utilities.java | Utilities.decrComputeSpecs | public static void decrComputeSpecs(ComputeSpecs target, ComputeSpecs decr) {
target.numCpus -= decr.numCpus;
target.memoryMB -= decr.memoryMB;
target.diskGB -= decr.diskGB;
} | java | public static void decrComputeSpecs(ComputeSpecs target, ComputeSpecs decr) {
target.numCpus -= decr.numCpus;
target.memoryMB -= decr.memoryMB;
target.diskGB -= decr.diskGB;
} | [
"public",
"static",
"void",
"decrComputeSpecs",
"(",
"ComputeSpecs",
"target",
",",
"ComputeSpecs",
"decr",
")",
"{",
"target",
".",
"numCpus",
"-=",
"decr",
".",
"numCpus",
";",
"target",
".",
"memoryMB",
"-=",
"decr",
".",
"memoryMB",
";",
"target",
".",
... | Decrease the compute specs by decr
@param target the specs to decrease
@param decr the decrement | [
"Decrease",
"the",
"compute",
"specs",
"by",
"decr"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/Utilities.java#L99-L103 |
118,526 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/Utilities.java | Utilities.waitThreadTermination | public static void waitThreadTermination(Thread thread) {
while (thread != null && thread.isAlive()) {
thread.interrupt();
try {
thread.join();
} catch (InterruptedException e) {
}
}
} | java | public static void waitThreadTermination(Thread thread) {
while (thread != null && thread.isAlive()) {
thread.interrupt();
try {
thread.join();
} catch (InterruptedException e) {
}
}
} | [
"public",
"static",
"void",
"waitThreadTermination",
"(",
"Thread",
"thread",
")",
"{",
"while",
"(",
"thread",
"!=",
"null",
"&&",
"thread",
".",
"isAlive",
"(",
")",
")",
"{",
"thread",
".",
"interrupt",
"(",
")",
";",
"try",
"{",
"thread",
".",
"joi... | A realiable way to wait for the thread termination
@param thread thread to wait for | [
"A",
"realiable",
"way",
"to",
"wait",
"for",
"the",
"thread",
"termination"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/Utilities.java#L128-L136 |
118,527 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/Utilities.java | Utilities.appInfoToAddress | public static InetAddress appInfoToAddress(String info) {
Matcher m = INET_ADDRESS_PATTERN.matcher(info);
if (m.find()) {
int port = Integer.parseInt(m.group(2));
return new InetAddress(m.group(1), port);
}
return null;
} | java | public static InetAddress appInfoToAddress(String info) {
Matcher m = INET_ADDRESS_PATTERN.matcher(info);
if (m.find()) {
int port = Integer.parseInt(m.group(2));
return new InetAddress(m.group(1), port);
}
return null;
} | [
"public",
"static",
"InetAddress",
"appInfoToAddress",
"(",
"String",
"info",
")",
"{",
"Matcher",
"m",
"=",
"INET_ADDRESS_PATTERN",
".",
"matcher",
"(",
"info",
")",
";",
"if",
"(",
"m",
".",
"find",
"(",
")",
")",
"{",
"int",
"port",
"=",
"Integer",
... | Convert the appinfo string to the address the application is available on
@param info the string of the appinfo
@return the address application is available on | [
"Convert",
"the",
"appinfo",
"string",
"to",
"the",
"address",
"the",
"application",
"is",
"available",
"on"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/Utilities.java#L143-L150 |
118,528 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/Utilities.java | Utilities.makeProcessExitOnUncaughtException | public static void makeProcessExitOnUncaughtException(final Log log) {
Thread.setDefaultUncaughtExceptionHandler(
new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
log.error("UNCAUGHT: Thread " + t.getName() +
" got a... | java | public static void makeProcessExitOnUncaughtException(final Log log) {
Thread.setDefaultUncaughtExceptionHandler(
new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
log.error("UNCAUGHT: Thread " + t.getName() +
" got a... | [
"public",
"static",
"void",
"makeProcessExitOnUncaughtException",
"(",
"final",
"Log",
"log",
")",
"{",
"Thread",
".",
"setDefaultUncaughtExceptionHandler",
"(",
"new",
"Thread",
".",
"UncaughtExceptionHandler",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"unc... | Sets an uncaught exception handler. This will make the process exit with
exit code 1 if a thread exits due to an uncaught exception. | [
"Sets",
"an",
"uncaught",
"exception",
"handler",
".",
"This",
"will",
"make",
"the",
"process",
"exit",
"with",
"exit",
"code",
"1",
"if",
"a",
"thread",
"exits",
"due",
"to",
"an",
"uncaught",
"exception",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/Utilities.java#L156-L166 |
118,529 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/zk/ZkUtil.java | ZkUtil.interruptedException | public static void interruptedException(String msg, InterruptedException e)
throws IOException {
Thread.currentThread().interrupt();
LOG.error(msg, e);
throw new IOException(msg, e);
} | java | public static void interruptedException(String msg, InterruptedException e)
throws IOException {
Thread.currentThread().interrupt();
LOG.error(msg, e);
throw new IOException(msg, e);
} | [
"public",
"static",
"void",
"interruptedException",
"(",
"String",
"msg",
",",
"InterruptedException",
"e",
")",
"throws",
"IOException",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"interrupt",
"(",
")",
";",
"LOG",
".",
"error",
"(",
"msg",
",",
... | Interrupt the thread and then log and re-throw an InterruptedException
as an IOException.
@param msg The message to log and include when re-throwing
@param e The actual exception instances
@throws IOException | [
"Interrupt",
"the",
"thread",
"and",
"then",
"log",
"and",
"re",
"-",
"throw",
"an",
"InterruptedException",
"as",
"an",
"IOException",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/zk/ZkUtil.java#L80-L85 |
118,530 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java | DistributedRaidFileSystem.getBlockSize | private static long getBlockSize(LocatedBlocks lbs) throws IOException {
List<LocatedBlock> locatedBlocks = lbs.getLocatedBlocks();
long bs = -1;
for (LocatedBlock lb: locatedBlocks) {
if (lb.getBlockSize() > bs) {
bs = lb.getBlockSize();
}
}
return bs;
} | java | private static long getBlockSize(LocatedBlocks lbs) throws IOException {
List<LocatedBlock> locatedBlocks = lbs.getLocatedBlocks();
long bs = -1;
for (LocatedBlock lb: locatedBlocks) {
if (lb.getBlockSize() > bs) {
bs = lb.getBlockSize();
}
}
return bs;
} | [
"private",
"static",
"long",
"getBlockSize",
"(",
"LocatedBlocks",
"lbs",
")",
"throws",
"IOException",
"{",
"List",
"<",
"LocatedBlock",
">",
"locatedBlocks",
"=",
"lbs",
".",
"getLocatedBlocks",
"(",
")",
";",
"long",
"bs",
"=",
"-",
"1",
";",
"for",
"("... | Obtain block size given 3 or more blocks | [
"Obtain",
"block",
"size",
"given",
"3",
"or",
"more",
"blocks"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java#L146-L155 |
118,531 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java | DistributedRaidFileSystem.undelete | @Override
public boolean undelete(Path f, String userName) throws IOException {
List<Codec> codecList = Codec.getCodecs();
Path[] parityPathList = new Path[codecList.size()];
for (int i=0; i<parityPathList.length; i++) {
parityPathList[i] = new Path(codecList.get(i).parityDirectory,
... | java | @Override
public boolean undelete(Path f, String userName) throws IOException {
List<Codec> codecList = Codec.getCodecs();
Path[] parityPathList = new Path[codecList.size()];
for (int i=0; i<parityPathList.length; i++) {
parityPathList[i] = new Path(codecList.get(i).parityDirectory,
... | [
"@",
"Override",
"public",
"boolean",
"undelete",
"(",
"Path",
"f",
",",
"String",
"userName",
")",
"throws",
"IOException",
"{",
"List",
"<",
"Codec",
">",
"codecList",
"=",
"Codec",
".",
"getCodecs",
"(",
")",
";",
"Path",
"[",
"]",
"parityPathList",
"... | undelete the parity file together with the src file. | [
"undelete",
"the",
"parity",
"file",
"together",
"with",
"the",
"src",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java#L282-L302 |
118,532 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java | DistributedRaidFileSystem.searchHarDir | private boolean searchHarDir(FileStatus stat)
throws IOException {
if (!stat.isDir()) {
return false;
}
String pattern = stat.getPath().toString() + "/*" + RaidNode.HAR_SUFFIX
+ "*";
FileStatus[] stats = globStatus(new Path(pattern));
if (stats != null && stats.length > 0) {
... | java | private boolean searchHarDir(FileStatus stat)
throws IOException {
if (!stat.isDir()) {
return false;
}
String pattern = stat.getPath().toString() + "/*" + RaidNode.HAR_SUFFIX
+ "*";
FileStatus[] stats = globStatus(new Path(pattern));
if (stats != null && stats.length > 0) {
... | [
"private",
"boolean",
"searchHarDir",
"(",
"FileStatus",
"stat",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"stat",
".",
"isDir",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"String",
"pattern",
"=",
"stat",
".",
"getPath",
"(",
")",
".",
... | search the Har-ed parity files | [
"search",
"the",
"Har",
"-",
"ed",
"parity",
"files"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java#L307-L328 |
118,533 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/HardLinkFileInfo.java | HardLinkFileInfo.getHardLinkedFile | public INodeHardLinkFile getHardLinkedFile(int i) {
if (i < this.linkedFiles.size()) {
return this.linkedFiles.get(i);
}
return null;
} | java | public INodeHardLinkFile getHardLinkedFile(int i) {
if (i < this.linkedFiles.size()) {
return this.linkedFiles.get(i);
}
return null;
} | [
"public",
"INodeHardLinkFile",
"getHardLinkedFile",
"(",
"int",
"i",
")",
"{",
"if",
"(",
"i",
"<",
"this",
".",
"linkedFiles",
".",
"size",
"(",
")",
")",
"{",
"return",
"this",
".",
"linkedFiles",
".",
"get",
"(",
"i",
")",
";",
"}",
"return",
"nul... | Return the i th of the hardlinked file
@param i
@return the i th of the hardlinked files and return null if i is out of the boundary. | [
"Return",
"the",
"i",
"th",
"of",
"the",
"hardlinked",
"file"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/HardLinkFileInfo.java#L58-L63 |
118,534 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/HardLinkFileInfo.java | HardLinkFileInfo.removeLinkedFile | public void removeLinkedFile(INodeHardLinkFile file) {
// Remove the target file from the linkedFiles
// Since the equal function in the INode only compares the name field, it would be safer to
// iterate the INodeHardLinkFile and compare the reference directly.
for (int i = 0 ; i < linkedFiles.size();... | java | public void removeLinkedFile(INodeHardLinkFile file) {
// Remove the target file from the linkedFiles
// Since the equal function in the INode only compares the name field, it would be safer to
// iterate the INodeHardLinkFile and compare the reference directly.
for (int i = 0 ; i < linkedFiles.size();... | [
"public",
"void",
"removeLinkedFile",
"(",
"INodeHardLinkFile",
"file",
")",
"{",
"// Remove the target file from the linkedFiles",
"// Since the equal function in the INode only compares the name field, it would be safer to ",
"// iterate the INodeHardLinkFile and compare the reference directly... | Remove an INodeHardLinkFile from the linkedFiles.
This function is not thread-safe. The caller is supposed to have a writeLock.
@param file The INodeHardLinkFile to be removed | [
"Remove",
"an",
"INodeHardLinkFile",
"from",
"the",
"linkedFiles",
".",
"This",
"function",
"is",
"not",
"thread",
"-",
"safe",
".",
"The",
"caller",
"is",
"supposed",
"to",
"have",
"a",
"writeLock",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/HardLinkFileInfo.java#L81-L118 |
118,535 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/HardLinkFileInfo.java | HardLinkFileInfo.setPermissionStatus | protected void setPermissionStatus(PermissionStatus ps) {
for (INodeHardLinkFile linkedFile : linkedFiles) {
linkedFile.setPermissionStatus(ps, false);
}
} | java | protected void setPermissionStatus(PermissionStatus ps) {
for (INodeHardLinkFile linkedFile : linkedFiles) {
linkedFile.setPermissionStatus(ps, false);
}
} | [
"protected",
"void",
"setPermissionStatus",
"(",
"PermissionStatus",
"ps",
")",
"{",
"for",
"(",
"INodeHardLinkFile",
"linkedFile",
":",
"linkedFiles",
")",
"{",
"linkedFile",
".",
"setPermissionStatus",
"(",
"ps",
",",
"false",
")",
";",
"}",
"}"
] | Set the PermissionSatus for all the linked files
@param ps | [
"Set",
"the",
"PermissionSatus",
"for",
"all",
"the",
"linked",
"files"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/HardLinkFileInfo.java#L145-L149 |
118,536 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/HardLinkFileInfo.java | HardLinkFileInfo.setUser | protected void setUser(String user) {
for (INodeHardLinkFile linkedFile : linkedFiles) {
linkedFile.setUser(user, false);
}
} | java | protected void setUser(String user) {
for (INodeHardLinkFile linkedFile : linkedFiles) {
linkedFile.setUser(user, false);
}
} | [
"protected",
"void",
"setUser",
"(",
"String",
"user",
")",
"{",
"for",
"(",
"INodeHardLinkFile",
"linkedFile",
":",
"linkedFiles",
")",
"{",
"linkedFile",
".",
"setUser",
"(",
"user",
",",
"false",
")",
";",
"}",
"}"
] | Set the user name for all the linked files
@param user | [
"Set",
"the",
"user",
"name",
"for",
"all",
"the",
"linked",
"files"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/HardLinkFileInfo.java#L155-L159 |
118,537 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/HardLinkFileInfo.java | HardLinkFileInfo.setGroup | protected void setGroup(String group) {
for (INodeHardLinkFile linkedFile : linkedFiles) {
linkedFile.setGroup(group, false);
}
} | java | protected void setGroup(String group) {
for (INodeHardLinkFile linkedFile : linkedFiles) {
linkedFile.setGroup(group, false);
}
} | [
"protected",
"void",
"setGroup",
"(",
"String",
"group",
")",
"{",
"for",
"(",
"INodeHardLinkFile",
"linkedFile",
":",
"linkedFiles",
")",
"{",
"linkedFile",
".",
"setGroup",
"(",
"group",
",",
"false",
")",
";",
"}",
"}"
] | Set the group name for all the linked files
@param group | [
"Set",
"the",
"group",
"name",
"for",
"all",
"the",
"linked",
"files"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/HardLinkFileInfo.java#L165-L169 |
118,538 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/HardLinkFileInfo.java | HardLinkFileInfo.setPermission | protected void setPermission(FsPermission permission) {
for (INodeHardLinkFile linkedFile : linkedFiles) {
linkedFile.setPermission(permission, false);
}
} | java | protected void setPermission(FsPermission permission) {
for (INodeHardLinkFile linkedFile : linkedFiles) {
linkedFile.setPermission(permission, false);
}
} | [
"protected",
"void",
"setPermission",
"(",
"FsPermission",
"permission",
")",
"{",
"for",
"(",
"INodeHardLinkFile",
"linkedFile",
":",
"linkedFiles",
")",
"{",
"linkedFile",
".",
"setPermission",
"(",
"permission",
",",
"false",
")",
";",
"}",
"}"
] | Set the permission for all the linked files
@param permission | [
"Set",
"the",
"permission",
"for",
"all",
"the",
"linked",
"files"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/HardLinkFileInfo.java#L175-L179 |
118,539 | facebookarchive/hadoop-20 | src/contrib/index/src/java/org/apache/hadoop/contrib/index/lucene/RAMDirectoryUtil.java | RAMDirectoryUtil.writeRAMFiles | public static void writeRAMFiles(DataOutput out, RAMDirectory dir,
String[] names) throws IOException {
out.writeInt(names.length);
for (int i = 0; i < names.length; i++) {
Text.writeString(out, names[i]);
long length = dir.fileLength(names[i]);
out.writeLong(length);
if... | java | public static void writeRAMFiles(DataOutput out, RAMDirectory dir,
String[] names) throws IOException {
out.writeInt(names.length);
for (int i = 0; i < names.length; i++) {
Text.writeString(out, names[i]);
long length = dir.fileLength(names[i]);
out.writeLong(length);
if... | [
"public",
"static",
"void",
"writeRAMFiles",
"(",
"DataOutput",
"out",
",",
"RAMDirectory",
"dir",
",",
"String",
"[",
"]",
"names",
")",
"throws",
"IOException",
"{",
"out",
".",
"writeInt",
"(",
"names",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",... | Write a number of files from a ram directory to a data output.
@param out the data output
@param dir the ram directory
@param names the names of the files to write
@throws IOException | [
"Write",
"a",
"number",
"of",
"files",
"from",
"a",
"ram",
"directory",
"to",
"a",
"data",
"output",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/index/src/java/org/apache/hadoop/contrib/index/lucene/RAMDirectoryUtil.java#L44-L77 |
118,540 | facebookarchive/hadoop-20 | src/contrib/index/src/java/org/apache/hadoop/contrib/index/lucene/RAMDirectoryUtil.java | RAMDirectoryUtil.readRAMFiles | public static void readRAMFiles(DataInput in, RAMDirectory dir)
throws IOException {
int numFiles = in.readInt();
for (int i = 0; i < numFiles; i++) {
String name = Text.readString(in);
long length = in.readLong();
if (length > 0) {
// can we avoid the extra copy?
... | java | public static void readRAMFiles(DataInput in, RAMDirectory dir)
throws IOException {
int numFiles = in.readInt();
for (int i = 0; i < numFiles; i++) {
String name = Text.readString(in);
long length = in.readLong();
if (length > 0) {
// can we avoid the extra copy?
... | [
"public",
"static",
"void",
"readRAMFiles",
"(",
"DataInput",
"in",
",",
"RAMDirectory",
"dir",
")",
"throws",
"IOException",
"{",
"int",
"numFiles",
"=",
"in",
".",
"readInt",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numFiles",... | Read a number of files from a data input to a ram directory.
@param in the data input
@param dir the ram directory
@throws IOException | [
"Read",
"a",
"number",
"of",
"files",
"from",
"a",
"data",
"input",
"to",
"a",
"ram",
"directory",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/index/src/java/org/apache/hadoop/contrib/index/lucene/RAMDirectoryUtil.java#L85-L117 |
118,541 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/LocalityStats.java | LocalityStats.record | public void record(
TaskInProgress tip, String host, long inputBytes) {
synchronized (localityRecords) {
localityRecords.add(new Record(tip, host, inputBytes));
localityRecords.notify();
}
} | java | public void record(
TaskInProgress tip, String host, long inputBytes) {
synchronized (localityRecords) {
localityRecords.add(new Record(tip, host, inputBytes));
localityRecords.notify();
}
} | [
"public",
"void",
"record",
"(",
"TaskInProgress",
"tip",
",",
"String",
"host",
",",
"long",
"inputBytes",
")",
"{",
"synchronized",
"(",
"localityRecords",
")",
"{",
"localityRecords",
".",
"add",
"(",
"new",
"Record",
"(",
"tip",
",",
"host",
",",
"inpu... | Asynchronous update of locality.
@param tip The task.
@param host The task tracker host.
@param inputBytes The number of bytes processed. | [
"Asynchronous",
"update",
"of",
"locality",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/LocalityStats.java#L105-L111 |
118,542 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/LocalityStats.java | LocalityStats.computeStatistics | private void computeStatistics(Record record) {
computeStatistics(record.tip, record.host, record.inputBytes);
} | java | private void computeStatistics(Record record) {
computeStatistics(record.tip, record.host, record.inputBytes);
} | [
"private",
"void",
"computeStatistics",
"(",
"Record",
"record",
")",
"{",
"computeStatistics",
"(",
"record",
".",
"tip",
",",
"record",
".",
"host",
",",
"record",
".",
"inputBytes",
")",
";",
"}"
] | Peform the computation statistics based on a locality record.
@param record The locality information. | [
"Peform",
"the",
"computation",
"statistics",
"based",
"on",
"a",
"locality",
"record",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/LocalityStats.java#L140-L142 |
118,543 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/LocalityStats.java | LocalityStats.computeStatistics | private void computeStatistics(
TaskInProgress tip, String host, long inputBytes) {
int level = this.maxLevel;
String[] splitLocations = tip.getSplitLocations();
if (splitLocations.length > 0) {
Node tracker = topologyCache.getNode(host);
// find the right level across split locations
... | java | private void computeStatistics(
TaskInProgress tip, String host, long inputBytes) {
int level = this.maxLevel;
String[] splitLocations = tip.getSplitLocations();
if (splitLocations.length > 0) {
Node tracker = topologyCache.getNode(host);
// find the right level across split locations
... | [
"private",
"void",
"computeStatistics",
"(",
"TaskInProgress",
"tip",
",",
"String",
"host",
",",
"long",
"inputBytes",
")",
"{",
"int",
"level",
"=",
"this",
".",
"maxLevel",
";",
"String",
"[",
"]",
"splitLocations",
"=",
"tip",
".",
"getSplitLocations",
"... | Peform the computation statistics.
@param tip The task.
@param host The task tracker host.
@param inputBytes The number of bytes processed. | [
"Peform",
"the",
"computation",
"statistics",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/LocalityStats.java#L150-L201 |
118,544 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/tools/offlineEditsViewer/EditsLoaderCurrent.java | EditsLoaderCurrent.visitTxId | private void visitTxId() throws IOException {
if (LayoutVersion.supports(Feature.STORED_TXIDS, editsVersion)) {
v.visitLong(EditsElement.TRANSACTION_ID);
}
} | java | private void visitTxId() throws IOException {
if (LayoutVersion.supports(Feature.STORED_TXIDS, editsVersion)) {
v.visitLong(EditsElement.TRANSACTION_ID);
}
} | [
"private",
"void",
"visitTxId",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"LayoutVersion",
".",
"supports",
"(",
"Feature",
".",
"STORED_TXIDS",
",",
"editsVersion",
")",
")",
"{",
"v",
".",
"visitLong",
"(",
"EditsElement",
".",
"TRANSACTION_ID",
"... | Visit a transaction ID, if the log version supports it. | [
"Visit",
"a",
"transaction",
"ID",
"if",
"the",
"log",
"version",
"supports",
"it",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/offlineEditsViewer/EditsLoaderCurrent.java#L69-L73 |
118,545 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/tools/offlineEditsViewer/EditsLoaderCurrent.java | EditsLoaderCurrent.visit_OP_ADD_or_OP_CLOSE | private void visit_OP_ADD_or_OP_CLOSE(FSEditLogOpCodes editsOpCode)
throws IOException {
visitTxId();
if (!LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, editsVersion)) {
IntToken opAddLength = v.visitInt(EditsElement.LENGTH);
// this happens if the edits is not properly ended... | java | private void visit_OP_ADD_or_OP_CLOSE(FSEditLogOpCodes editsOpCode)
throws IOException {
visitTxId();
if (!LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, editsVersion)) {
IntToken opAddLength = v.visitInt(EditsElement.LENGTH);
// this happens if the edits is not properly ended... | [
"private",
"void",
"visit_OP_ADD_or_OP_CLOSE",
"(",
"FSEditLogOpCodes",
"editsOpCode",
")",
"throws",
"IOException",
"{",
"visitTxId",
"(",
")",
";",
"if",
"(",
"!",
"LayoutVersion",
".",
"supports",
"(",
"Feature",
".",
"EDITLOG_OP_OPTIMIZATION",
",",
"editsVersion... | Visit OP_ADD and OP_CLOSE, they are almost the same
@param editsOpCode op code to visit | [
"Visit",
"OP_ADD",
"and",
"OP_CLOSE",
"they",
"are",
"almost",
"the",
"same"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/offlineEditsViewer/EditsLoaderCurrent.java#L118-L164 |
118,546 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/tools/offlineEditsViewer/EditsLoaderCurrent.java | EditsLoaderCurrent.loadEdits | @Override
public void loadEdits() throws IOException {
try {
v.start();
v.visitEnclosingElement(EditsElement.EDITS);
IntToken editsVersionToken = v.visitInt(EditsElement.EDITS_VERSION);
editsVersion = editsVersionToken.value;
if(!canLoadVersion(editsVersion)) {
throw new IO... | java | @Override
public void loadEdits() throws IOException {
try {
v.start();
v.visitEnclosingElement(EditsElement.EDITS);
IntToken editsVersionToken = v.visitInt(EditsElement.EDITS_VERSION);
editsVersion = editsVersionToken.value;
if(!canLoadVersion(editsVersion)) {
throw new IO... | [
"@",
"Override",
"public",
"void",
"loadEdits",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"v",
".",
"start",
"(",
")",
";",
"v",
".",
"visitEnclosingElement",
"(",
"EditsElement",
".",
"EDITS",
")",
";",
"IntToken",
"editsVersionToken",
"=",
"v",... | Loads edits file, uses visitor to process all elements | [
"Loads",
"edits",
"file",
"uses",
"visitor",
"to",
"process",
"all",
"elements"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/offlineEditsViewer/EditsLoaderCurrent.java#L575-L626 |
118,547 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapreduce/CounterGroup.java | CounterGroup.getResourceBundle | private static ResourceBundle getResourceBundle(String enumClassName) {
String bundleName = enumClassName.replace('$','_');
return ResourceBundle.getBundle(bundleName);
} | java | private static ResourceBundle getResourceBundle(String enumClassName) {
String bundleName = enumClassName.replace('$','_');
return ResourceBundle.getBundle(bundleName);
} | [
"private",
"static",
"ResourceBundle",
"getResourceBundle",
"(",
"String",
"enumClassName",
")",
"{",
"String",
"bundleName",
"=",
"enumClassName",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"return",
"ResourceBundle",
".",
"getBundle",
"(",
"bund... | Returns the specified resource bundle, or throws an exception.
@throws MissingResourceException if the bundle isn't found | [
"Returns",
"the",
"specified",
"resource",
"bundle",
"or",
"throws",
"an",
"exception",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/CounterGroup.java#L48-L51 |
118,548 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapreduce/CounterGroup.java | CounterGroup.findCounter | protected Counter findCounter(String counterName, String displayName) {
Counter result = counters.get(counterName);
if (result == null) {
result = new Counter(counterName, displayName);
counters.put(counterName, result);
}
return result;
} | java | protected Counter findCounter(String counterName, String displayName) {
Counter result = counters.get(counterName);
if (result == null) {
result = new Counter(counterName, displayName);
counters.put(counterName, result);
}
return result;
} | [
"protected",
"Counter",
"findCounter",
"(",
"String",
"counterName",
",",
"String",
"displayName",
")",
"{",
"Counter",
"result",
"=",
"counters",
".",
"get",
"(",
"counterName",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"new",
... | Internal to find a counter in a group.
@param counterName the name of the counter
@param displayName the display name of the counter
@return the counter that was found or added | [
"Internal",
"to",
"find",
"a",
"counter",
"in",
"a",
"group",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/CounterGroup.java#L94-L101 |
118,549 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapreduce/CounterGroup.java | CounterGroup.localize | private String localize(String key, String defaultValue) {
String result = defaultValue;
if (bundle != null) {
try {
result = bundle.getString(key);
}
catch (MissingResourceException mre) {
}
}
return result;
} | java | private String localize(String key, String defaultValue) {
String result = defaultValue;
if (bundle != null) {
try {
result = bundle.getString(key);
}
catch (MissingResourceException mre) {
}
}
return result;
} | [
"private",
"String",
"localize",
"(",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"String",
"result",
"=",
"defaultValue",
";",
"if",
"(",
"bundle",
"!=",
"null",
")",
"{",
"try",
"{",
"result",
"=",
"bundle",
".",
"getString",
"(",
"key",
... | Looks up key in the ResourceBundle and returns the corresponding value.
If the bundle or the key doesn't exist, returns the default value. | [
"Looks",
"up",
"key",
"in",
"the",
"ResourceBundle",
"and",
"returns",
"the",
"corresponding",
"value",
".",
"If",
"the",
"bundle",
"or",
"the",
"key",
"doesn",
"t",
"exist",
"returns",
"the",
"default",
"value",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/CounterGroup.java#L140-L150 |
118,550 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.getDefaultAddress | public static String getDefaultAddress(Configuration conf) {
URI uri = FileSystem.getDefaultUri(conf);
String authority = uri.getAuthority();
if (authority == null) {
throw new IllegalArgumentException(String.format(
"Invalid URI for NameNode address (check %s): %s has no authority.",
... | java | public static String getDefaultAddress(Configuration conf) {
URI uri = FileSystem.getDefaultUri(conf);
String authority = uri.getAuthority();
if (authority == null) {
throw new IllegalArgumentException(String.format(
"Invalid URI for NameNode address (check %s): %s has no authority.",
... | [
"public",
"static",
"String",
"getDefaultAddress",
"(",
"Configuration",
"conf",
")",
"{",
"URI",
"uri",
"=",
"FileSystem",
".",
"getDefaultUri",
"(",
"conf",
")",
";",
"String",
"authority",
"=",
"uri",
".",
"getAuthority",
"(",
")",
";",
"if",
"(",
"auth... | Returns the fs.default name from the configuration as a string for znode name retrieval
without a DNS lookup.
@param conf
@return | [
"Returns",
"the",
"fs",
".",
"default",
"name",
"from",
"the",
"configuration",
"as",
"a",
"string",
"for",
"znode",
"name",
"retrieval",
"without",
"a",
"DNS",
"lookup",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L351-L360 |
118,551 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.initialize | protected void initialize() throws IOException {
// set service-level authorization security policy
if (serviceAuthEnabled =
getConf().getBoolean(
ServiceAuthorizationManager.SERVICE_AUTHORIZATION_CONFIG, false)) {
PolicyProvider policyProvider =
(PolicyProvider)(ReflectionUtil... | java | protected void initialize() throws IOException {
// set service-level authorization security policy
if (serviceAuthEnabled =
getConf().getBoolean(
ServiceAuthorizationManager.SERVICE_AUTHORIZATION_CONFIG, false)) {
PolicyProvider policyProvider =
(PolicyProvider)(ReflectionUtil... | [
"protected",
"void",
"initialize",
"(",
")",
"throws",
"IOException",
"{",
"// set service-level authorization security policy",
"if",
"(",
"serviceAuthEnabled",
"=",
"getConf",
"(",
")",
".",
"getBoolean",
"(",
"ServiceAuthorizationManager",
".",
"SERVICE_AUTHORIZATION_CON... | Initialize name-node. | [
"Initialize",
"name",
"-",
"node",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L371-L404 |
118,552 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.adjustMetaDirectoryNames | protected static void adjustMetaDirectoryNames(Configuration conf, String serviceKey) {
adjustMetaDirectoryName(conf, DFS_NAMENODE_NAME_DIR_KEY, serviceKey);
adjustMetaDirectoryName(conf, DFS_NAMENODE_EDITS_DIR_KEY, serviceKey);
adjustMetaDirectoryName(conf, DFS_NAMENODE_CHECKPOINT_DIR_KEY, serviceKey);
... | java | protected static void adjustMetaDirectoryNames(Configuration conf, String serviceKey) {
adjustMetaDirectoryName(conf, DFS_NAMENODE_NAME_DIR_KEY, serviceKey);
adjustMetaDirectoryName(conf, DFS_NAMENODE_EDITS_DIR_KEY, serviceKey);
adjustMetaDirectoryName(conf, DFS_NAMENODE_CHECKPOINT_DIR_KEY, serviceKey);
... | [
"protected",
"static",
"void",
"adjustMetaDirectoryNames",
"(",
"Configuration",
"conf",
",",
"String",
"serviceKey",
")",
"{",
"adjustMetaDirectoryName",
"(",
"conf",
",",
"DFS_NAMENODE_NAME_DIR_KEY",
",",
"serviceKey",
")",
";",
"adjustMetaDirectoryName",
"(",
"conf",... | Append service name to each meta directory name
@param conf configuration of NameNode
@param serviceKey the non-empty name of the name node service | [
"Append",
"service",
"name",
"to",
"each",
"meta",
"directory",
"name"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L570-L576 |
118,553 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.stopRPC | protected void stopRPC(boolean interruptClientHandlers)
throws IOException, InterruptedException {
// stop client handlers
stopRPCInternal(server, "client", interruptClientHandlers);
// stop datanode handlers
stopRPCInternal(dnProtocolServer, "datanode", interruptClientHandlers);
// waiting ... | java | protected void stopRPC(boolean interruptClientHandlers)
throws IOException, InterruptedException {
// stop client handlers
stopRPCInternal(server, "client", interruptClientHandlers);
// stop datanode handlers
stopRPCInternal(dnProtocolServer, "datanode", interruptClientHandlers);
// waiting ... | [
"protected",
"void",
"stopRPC",
"(",
"boolean",
"interruptClientHandlers",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"// stop client handlers",
"stopRPCInternal",
"(",
"server",
",",
"\"client\"",
",",
"interruptClientHandlers",
")",
";",
"// stop da... | Quiescess all communication to namenode cleanly.
Ensures all RPC handlers have exited.
@param interruptClientHandlers should the handlers be interrupted | [
"Quiescess",
"all",
"communication",
"to",
"namenode",
"cleanly",
".",
"Ensures",
"all",
"RPC",
"handlers",
"have",
"exited",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L674-L685 |
118,554 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.stop | public void stop() {
if (stopRequested)
return;
stopRequested = true;
LOG.info("Stopping http server");
try {
if (httpServer != null) httpServer.stop();
} catch (Exception e) {
LOG.error(StringUtils.stringifyException(e));
}
LOG.info("Stopping namesystem");
if(namesyst... | java | public void stop() {
if (stopRequested)
return;
stopRequested = true;
LOG.info("Stopping http server");
try {
if (httpServer != null) httpServer.stop();
} catch (Exception e) {
LOG.error(StringUtils.stringifyException(e));
}
LOG.info("Stopping namesystem");
if(namesyst... | [
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"stopRequested",
")",
"return",
";",
"stopRequested",
"=",
"true",
";",
"LOG",
".",
"info",
"(",
"\"Stopping http server\"",
")",
";",
"try",
"{",
"if",
"(",
"httpServer",
"!=",
"null",
")",
"httpServer... | Stop all NameNode threads and wait for all to finish. | [
"Stop",
"all",
"NameNode",
"threads",
"and",
"wait",
"for",
"all",
"to",
"finish",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L708-L738 |
118,555 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.addBlock | public LocatedBlock addBlock(String src,
String clientName) throws IOException {
return addBlock(src, clientName, null);
} | java | public LocatedBlock addBlock(String src,
String clientName) throws IOException {
return addBlock(src, clientName, null);
} | [
"public",
"LocatedBlock",
"addBlock",
"(",
"String",
"src",
",",
"String",
"clientName",
")",
"throws",
"IOException",
"{",
"return",
"addBlock",
"(",
"src",
",",
"clientName",
",",
"null",
")",
";",
"}"
] | Stub for 0.20 clients that don't support HDFS-630 | [
"Stub",
"for",
"0",
".",
"20",
"clients",
"that",
"don",
"t",
"support",
"HDFS",
"-",
"630"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L954-L957 |
118,556 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.abandonBlock | public void abandonBlock(Block b, String src, String holder
) throws IOException {
abandonBlockInternal(b, src, holder);
} | java | public void abandonBlock(Block b, String src, String holder
) throws IOException {
abandonBlockInternal(b, src, holder);
} | [
"public",
"void",
"abandonBlock",
"(",
"Block",
"b",
",",
"String",
"src",
",",
"String",
"holder",
")",
"throws",
"IOException",
"{",
"abandonBlockInternal",
"(",
"b",
",",
"src",
",",
"holder",
")",
";",
"}"
] | The client needs to give up on the block. | [
"The",
"client",
"needs",
"to",
"give",
"up",
"on",
"the",
"block",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L1059-L1062 |
118,557 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.sendHeartbeat | public DatanodeCommand[] sendHeartbeat(DatanodeRegistration nodeReg,
long capacity,
long dfsUsed,
long remaining,
long namespaceUsed,
... | java | public DatanodeCommand[] sendHeartbeat(DatanodeRegistration nodeReg,
long capacity,
long dfsUsed,
long remaining,
long namespaceUsed,
... | [
"public",
"DatanodeCommand",
"[",
"]",
"sendHeartbeat",
"(",
"DatanodeRegistration",
"nodeReg",
",",
"long",
"capacity",
",",
"long",
"dfsUsed",
",",
"long",
"remaining",
",",
"long",
"namespaceUsed",
",",
"int",
"xmitsInProgress",
",",
"int",
"xceiverCount",
")",... | Data node notify the name node that it is alive
Return an array of block-oriented commands for the datanode to execute.
This will be either a transfer or a delete operation. | [
"Data",
"node",
"notify",
"the",
"name",
"node",
"that",
"it",
"is",
"alive",
"Return",
"an",
"array",
"of",
"block",
"-",
"oriented",
"commands",
"for",
"the",
"datanode",
"to",
"execute",
".",
"This",
"will",
"be",
"either",
"a",
"transfer",
"or",
"a",... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L1624-L1635 |
118,558 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.blocksBeingWrittenReport | public void blocksBeingWrittenReport(DatanodeRegistration nodeReg,
BlockReport blocks) throws IOException {
verifyRequest(nodeReg);
long[] blocksAsLong = blocks.getBlockReportInLongs();
BlockListAsLongs blist = new BlockListAsLongs(blocksAsLong);
boolean processed = namesystem.processBlocksBeingWr... | java | public void blocksBeingWrittenReport(DatanodeRegistration nodeReg,
BlockReport blocks) throws IOException {
verifyRequest(nodeReg);
long[] blocksAsLong = blocks.getBlockReportInLongs();
BlockListAsLongs blist = new BlockListAsLongs(blocksAsLong);
boolean processed = namesystem.processBlocksBeingWr... | [
"public",
"void",
"blocksBeingWrittenReport",
"(",
"DatanodeRegistration",
"nodeReg",
",",
"BlockReport",
"blocks",
")",
"throws",
"IOException",
"{",
"verifyRequest",
"(",
"nodeReg",
")",
";",
"long",
"[",
"]",
"blocksAsLong",
"=",
"blocks",
".",
"getBlockReportInL... | add new replica blocks to the Inode to target mapping
also add the Inode file to DataNodeDesc | [
"add",
"new",
"replica",
"blocks",
"to",
"the",
"Inode",
"to",
"target",
"mapping",
"also",
"add",
"the",
"Inode",
"file",
"to",
"DataNodeDesc"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L1641-L1654 |
118,559 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.verifyRequest | public void verifyRequest(DatanodeRegistration nodeReg) throws IOException {
verifyVersion(nodeReg.getVersion(), LAYOUT_VERSION, "layout");
// The ctime of the namenode has to be greater than or equal to the ctime of
// the datanode. The ctime of the namenode is updated when it is upgraded
// and only t... | java | public void verifyRequest(DatanodeRegistration nodeReg) throws IOException {
verifyVersion(nodeReg.getVersion(), LAYOUT_VERSION, "layout");
// The ctime of the namenode has to be greater than or equal to the ctime of
// the datanode. The ctime of the namenode is updated when it is upgraded
// and only t... | [
"public",
"void",
"verifyRequest",
"(",
"DatanodeRegistration",
"nodeReg",
")",
"throws",
"IOException",
"{",
"verifyVersion",
"(",
"nodeReg",
".",
"getVersion",
"(",
")",
",",
"LAYOUT_VERSION",
",",
"\"layout\"",
")",
";",
"// The ctime of the namenode has to be greate... | Verify request.
Verifies correctness of the datanode layout version, namespace ID and cTime
. We support a higher layout version for the datanode and a lower or equal
cTime for the datanode, but the namespace Id has to match.
@param nodeReg data node registration
@throws IOException | [
"Verify",
"request",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L1751-L1765 |
118,560 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.verifyVersion | public static void verifyVersion(int reportedVersion,
int expectedVersion, String annotation) throws IOException {
if ((reportedVersion ^ expectedVersion) < 0) {
throw new IOException("reportedVersion and expectedVersion have" +
" different signs : " + reportedVersion + ", " + expectedVersion)... | java | public static void verifyVersion(int reportedVersion,
int expectedVersion, String annotation) throws IOException {
if ((reportedVersion ^ expectedVersion) < 0) {
throw new IOException("reportedVersion and expectedVersion have" +
" different signs : " + reportedVersion + ", " + expectedVersion)... | [
"public",
"static",
"void",
"verifyVersion",
"(",
"int",
"reportedVersion",
",",
"int",
"expectedVersion",
",",
"String",
"annotation",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"reportedVersion",
"^",
"expectedVersion",
")",
"<",
"0",
")",
"{",
"thro... | Verify version.
@param reportedVersion version reported by datanode
@param expectedVersion version expected by namenode
@param annotation explanation of the given version
@throws IncorrectVersionException | [
"Verify",
"version",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L1775-L1786 |
118,561 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.getRandomFilesSample | public List<FileStatusExtended> getRandomFilesSample(double percentage) {
if (!(percentage > 0 && percentage <= 1.0)) {
throw new IllegalArgumentException("Invalid percentage : " + percentage +
" value should be between (0 - 1.0]");
}
LOG.info("Sampling : " + (percentage * 100) + " percent o... | java | public List<FileStatusExtended> getRandomFilesSample(double percentage) {
if (!(percentage > 0 && percentage <= 1.0)) {
throw new IllegalArgumentException("Invalid percentage : " + percentage +
" value should be between (0 - 1.0]");
}
LOG.info("Sampling : " + (percentage * 100) + " percent o... | [
"public",
"List",
"<",
"FileStatusExtended",
">",
"getRandomFilesSample",
"(",
"double",
"percentage",
")",
"{",
"if",
"(",
"!",
"(",
"percentage",
">",
"0",
"&&",
"percentage",
"<=",
"1.0",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"... | Get a sample of the total files in the FileSystem. The sampling is done
randomly.
@param percentage
the percentage of files to sample, value should be between (0 -
1.0]
@return the list of files | [
"Get",
"a",
"sample",
"of",
"the",
"total",
"files",
"in",
"the",
"FileSystem",
".",
"The",
"sampling",
"is",
"done",
"randomly",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L1809-L1816 |
118,562 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.format | static boolean format(Configuration conf,
boolean force,
boolean isConfirmationNeeded
) throws IOException {
boolean allowFormat = conf.getBoolean("dfs.namenode.support.allowformat",
... | java | static boolean format(Configuration conf,
boolean force,
boolean isConfirmationNeeded
) throws IOException {
boolean allowFormat = conf.getBoolean("dfs.namenode.support.allowformat",
... | [
"static",
"boolean",
"format",
"(",
"Configuration",
"conf",
",",
"boolean",
"force",
",",
"boolean",
"isConfirmationNeeded",
")",
"throws",
"IOException",
"{",
"boolean",
"allowFormat",
"=",
"conf",
".",
"getBoolean",
"(",
"\"dfs.namenode.support.allowformat\"",
",",... | Verify that configured directories exist, then
Interactively confirm that formatting is desired
for each existing directory and format them.
@param conf
@param isConfirmationNeeded
@return true if formatting was aborted, false otherwise
@throws IOException | [
"Verify",
"that",
"configured",
"directories",
"exist",
"then",
"Interactively",
"confirm",
"that",
"formatting",
"is",
"desired",
"for",
"each",
"existing",
"directory",
"and",
"format",
"them",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L1870-L1898 |
118,563 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.validateServiceName | public static boolean validateServiceName(Configuration conf,
String nameServiceId) {
Collection<String> nameserviceIds = DFSUtil.getNameServiceIds(conf);
if (nameserviceIds != null && !nameserviceIds.isEmpty()) {
if (nameServiceId == null) {
System.err.println("Need to input a nameservice i... | java | public static boolean validateServiceName(Configuration conf,
String nameServiceId) {
Collection<String> nameserviceIds = DFSUtil.getNameServiceIds(conf);
if (nameserviceIds != null && !nameserviceIds.isEmpty()) {
if (nameServiceId == null) {
System.err.println("Need to input a nameservice i... | [
"public",
"static",
"boolean",
"validateServiceName",
"(",
"Configuration",
"conf",
",",
"String",
"nameServiceId",
")",
"{",
"Collection",
"<",
"String",
">",
"nameserviceIds",
"=",
"DFSUtil",
".",
"getNameServiceIds",
"(",
"conf",
")",
";",
"if",
"(",
"nameser... | Valide if the input service name is valid
@param conf configuration
@param nameServiceId name service id
@return true if valid; false otherwise | [
"Valide",
"if",
"the",
"input",
"service",
"name",
"is",
"valid"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L2006-L2022 |
118,564 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java | NameNode.validateCheckpointerAddress | protected void validateCheckpointerAddress(InetAddress configuredRemoteAddress)
throws IOException {
InetAddress remoteAddress = Server.getRemoteIp();
InjectionHandler.processEvent(InjectionEvent.NAMENODE_VERIFY_CHECKPOINTER,
remoteAddress);
LOG.info("Verify: received request from: " + remote... | java | protected void validateCheckpointerAddress(InetAddress configuredRemoteAddress)
throws IOException {
InetAddress remoteAddress = Server.getRemoteIp();
InjectionHandler.processEvent(InjectionEvent.NAMENODE_VERIFY_CHECKPOINTER,
remoteAddress);
LOG.info("Verify: received request from: " + remote... | [
"protected",
"void",
"validateCheckpointerAddress",
"(",
"InetAddress",
"configuredRemoteAddress",
")",
"throws",
"IOException",
"{",
"InetAddress",
"remoteAddress",
"=",
"Server",
".",
"getRemoteIp",
"(",
")",
";",
"InjectionHandler",
".",
"processEvent",
"(",
"Injecti... | Checks if the ip of the caller is equal to the given configured address.
@param configuredRemoteAddress
@throws IOException | [
"Checks",
"if",
"the",
"ip",
"of",
"the",
"caller",
"is",
"equal",
"to",
"the",
"given",
"configured",
"address",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L2295-L2325 |
118,565 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/raid/tools/FastFileCheck.java | FastFileCheck.checkFile | public static boolean checkFile(Configuration conf,
FileSystem srcFs, FileSystem parityFs,
Path srcPath, Path parityPath, Codec codec,
Progressable reporter,
boolean sourceOnly)
throws IOException, InterruptedException {
FileStatus stat = srcFs.getFileStatus(srcPath);
long bl... | java | public static boolean checkFile(Configuration conf,
FileSystem srcFs, FileSystem parityFs,
Path srcPath, Path parityPath, Codec codec,
Progressable reporter,
boolean sourceOnly)
throws IOException, InterruptedException {
FileStatus stat = srcFs.getFileStatus(srcPath);
long bl... | [
"public",
"static",
"boolean",
"checkFile",
"(",
"Configuration",
"conf",
",",
"FileSystem",
"srcFs",
",",
"FileSystem",
"parityFs",
",",
"Path",
"srcPath",
",",
"Path",
"parityPath",
",",
"Codec",
"codec",
",",
"Progressable",
"reporter",
",",
"boolean",
"sourc... | Check a file. | [
"Check",
"a",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/tools/FastFileCheck.java#L308-L340 |
118,566 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/raid/tools/FastFileCheck.java | FastFileCheck.verifyFile | private static boolean verifyFile(Configuration conf,
FileSystem srcFs, FileSystem parityFs,
FileStatus stat, Path parityPath, Codec codec,
long blockOffset, Progressable reporter)
throws IOException, InterruptedException {
Path srcPath = stat.getPath();
LOG.info("Verify file: " + srcPath... | java | private static boolean verifyFile(Configuration conf,
FileSystem srcFs, FileSystem parityFs,
FileStatus stat, Path parityPath, Codec codec,
long blockOffset, Progressable reporter)
throws IOException, InterruptedException {
Path srcPath = stat.getPath();
LOG.info("Verify file: " + srcPath... | [
"private",
"static",
"boolean",
"verifyFile",
"(",
"Configuration",
"conf",
",",
"FileSystem",
"srcFs",
",",
"FileSystem",
"parityFs",
",",
"FileStatus",
"stat",
",",
"Path",
"parityPath",
",",
"Codec",
"codec",
",",
"long",
"blockOffset",
",",
"Progressable",
"... | Verify the certain offset of a file. | [
"Verify",
"the",
"certain",
"offset",
"of",
"a",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/tools/FastFileCheck.java#L433-L499 |
118,567 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/FileInputFormat.java | FileInputFormat.addLocatedInputPathRecursively | protected void addLocatedInputPathRecursively(List<LocatedFileStatus> result,
FileSystem fs, Path path, PathFilter inputFilter)
throws IOException {
for(RemoteIterator<LocatedFileStatus> itor =
fs.listLocatedStatus(path, inputFilter); itor.hasNext();) {
LocatedFileStatus stat = itor.next()... | java | protected void addLocatedInputPathRecursively(List<LocatedFileStatus> result,
FileSystem fs, Path path, PathFilter inputFilter)
throws IOException {
for(RemoteIterator<LocatedFileStatus> itor =
fs.listLocatedStatus(path, inputFilter); itor.hasNext();) {
LocatedFileStatus stat = itor.next()... | [
"protected",
"void",
"addLocatedInputPathRecursively",
"(",
"List",
"<",
"LocatedFileStatus",
">",
"result",
",",
"FileSystem",
"fs",
",",
"Path",
"path",
",",
"PathFilter",
"inputFilter",
")",
"throws",
"IOException",
"{",
"for",
"(",
"RemoteIterator",
"<",
"Loca... | Add files in the input path recursively into the results.
@param result
The List to store all files together with their block locations
@param fs
The FileSystem.
@param path
The input path.
@param inputFilter
The input filter that can be used to filter files/dirs.
@throws IOException | [
"Add",
"files",
"in",
"the",
"input",
"path",
"recursively",
"into",
"the",
"results",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/FileInputFormat.java#L251-L263 |
118,568 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/FileInputFormat.java | FileInputFormat.getPathStrings | private static String[] getPathStrings(String commaSeparatedPaths) {
int length = commaSeparatedPaths.length();
int curlyOpen = 0;
int pathStart = 0;
boolean globPattern = false;
List<String> pathStrings = new ArrayList<String>();
for (int i=0; i<length; i++) {
char ch = commaSeparate... | java | private static String[] getPathStrings(String commaSeparatedPaths) {
int length = commaSeparatedPaths.length();
int curlyOpen = 0;
int pathStart = 0;
boolean globPattern = false;
List<String> pathStrings = new ArrayList<String>();
for (int i=0; i<length; i++) {
char ch = commaSeparate... | [
"private",
"static",
"String",
"[",
"]",
"getPathStrings",
"(",
"String",
"commaSeparatedPaths",
")",
"{",
"int",
"length",
"=",
"commaSeparatedPaths",
".",
"length",
"(",
")",
";",
"int",
"curlyOpen",
"=",
"0",
";",
"int",
"pathStart",
"=",
"0",
";",
"boo... | This method escapes commas in the glob pattern of the given paths. | [
"This",
"method",
"escapes",
"commas",
"in",
"the",
"glob",
"pattern",
"of",
"the",
"given",
"paths",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/FileInputFormat.java#L555-L591 |
118,569 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/FileInputFormat.java | FileInputFormat.getSplitHosts | protected String[] getSplitHosts(BlockLocation[] blkLocations,
long offset, long splitSize, NetworkTopology clusterMap)
throws IOException {
int startIndex = getBlockIndex(blkLocations, offset);
long bytesInThisBlock = blkLocations[startIndex].getOffset() +
blkLocations[sta... | java | protected String[] getSplitHosts(BlockLocation[] blkLocations,
long offset, long splitSize, NetworkTopology clusterMap)
throws IOException {
int startIndex = getBlockIndex(blkLocations, offset);
long bytesInThisBlock = blkLocations[startIndex].getOffset() +
blkLocations[sta... | [
"protected",
"String",
"[",
"]",
"getSplitHosts",
"(",
"BlockLocation",
"[",
"]",
"blkLocations",
",",
"long",
"offset",
",",
"long",
"splitSize",
",",
"NetworkTopology",
"clusterMap",
")",
"throws",
"IOException",
"{",
"int",
"startIndex",
"=",
"getBlockIndex",
... | This function identifies and returns the hosts that contribute
most for a given split. For calculating the contribution, rack
locality is treated on par with host locality, so hosts from racks
that contribute the most are preferred over hosts on racks that
contribute less
@param blkLocations The list of block locations... | [
"This",
"function",
"identifies",
"and",
"returns",
"the",
"hosts",
"that",
"contribute",
"most",
"for",
"a",
"given",
"split",
".",
"For",
"calculating",
"the",
"contribution",
"rack",
"locality",
"is",
"treated",
"on",
"par",
"with",
"host",
"locality",
"so"... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/FileInputFormat.java#L640-L739 |
118,570 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskLauncher.java | CoronaTaskLauncher.killJob | @SuppressWarnings("deprecation")
public void killJob(JobID jobId, Map<String, InetAddress> allTrackers) {
for (Map.Entry<String, InetAddress> entry : allTrackers.entrySet()) {
String trackerName = entry.getKey();
InetAddress addr = entry.getValue();
String description = "KillJobAction " + jobId;... | java | @SuppressWarnings("deprecation")
public void killJob(JobID jobId, Map<String, InetAddress> allTrackers) {
for (Map.Entry<String, InetAddress> entry : allTrackers.entrySet()) {
String trackerName = entry.getKey();
InetAddress addr = entry.getValue();
String description = "KillJobAction " + jobId;... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"void",
"killJob",
"(",
"JobID",
"jobId",
",",
"Map",
"<",
"String",
",",
"InetAddress",
">",
"allTrackers",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"InetAddress",
">",
... | Enqueue an action to kill the job.
@param jobId The job identifier.
@param allTrackers All trackers to send the kill to. | [
"Enqueue",
"an",
"action",
"to",
"kill",
"the",
"job",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskLauncher.java#L92-L104 |
118,571 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskLauncher.java | CoronaTaskLauncher.killTasks | public void killTasks(
String trackerName, InetAddress addr, List<KillTaskAction> killActions) {
for (KillTaskAction killAction : killActions) {
String description = "KillTaskAction " + killAction.getTaskID();
LOG.info("Queueing " + description + " to worker " +
trackerName + "(" + addr.ho... | java | public void killTasks(
String trackerName, InetAddress addr, List<KillTaskAction> killActions) {
for (KillTaskAction killAction : killActions) {
String description = "KillTaskAction " + killAction.getTaskID();
LOG.info("Queueing " + description + " to worker " +
trackerName + "(" + addr.ho... | [
"public",
"void",
"killTasks",
"(",
"String",
"trackerName",
",",
"InetAddress",
"addr",
",",
"List",
"<",
"KillTaskAction",
">",
"killActions",
")",
"{",
"for",
"(",
"KillTaskAction",
"killAction",
":",
"killActions",
")",
"{",
"String",
"description",
"=",
"... | Enqueue kill tasks actions.
@param trackerName The name of the tracker to send the kill actions to.
@param addr The address of the tracker to send the kill actions to.
@param killActions The kill actions to send. | [
"Enqueue",
"kill",
"tasks",
"actions",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskLauncher.java#L112-L121 |
118,572 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskLauncher.java | CoronaTaskLauncher.commitTask | public void commitTask(
String trackerName, InetAddress addr, CommitTaskAction action) {
String description = "KillTaskAction " + action.getTaskID();
LOG.info("Queueing " + description + " to worker " +
trackerName + "(" + addr.host + ":" + addr.port + ")");
allWorkQueues.enqueueAction(new Actio... | java | public void commitTask(
String trackerName, InetAddress addr, CommitTaskAction action) {
String description = "KillTaskAction " + action.getTaskID();
LOG.info("Queueing " + description + " to worker " +
trackerName + "(" + addr.host + ":" + addr.port + ")");
allWorkQueues.enqueueAction(new Actio... | [
"public",
"void",
"commitTask",
"(",
"String",
"trackerName",
",",
"InetAddress",
"addr",
",",
"CommitTaskAction",
"action",
")",
"{",
"String",
"description",
"=",
"\"KillTaskAction \"",
"+",
"action",
".",
"getTaskID",
"(",
")",
";",
"LOG",
".",
"info",
"(",... | Enqueue a commit task action.
@param trackerName The name of the tracker to send the commit action to.
@param addr The address of the tracker to send the commit action to.
@param action The commit action to send. | [
"Enqueue",
"a",
"commit",
"task",
"action",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskLauncher.java#L129-L136 |
118,573 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskLauncher.java | CoronaTaskLauncher.launchTask | public void launchTask(Task task, String trackerName, InetAddress addr) {
CoronaSessionInfo info = new CoronaSessionInfo(
coronaJT.getSessionId(), coronaJT.getJobTrackerAddress(),
coronaJT.getSecondaryTrackerAddress());
LaunchTaskAction action = new LaunchTaskAction(task, info);
String descripti... | java | public void launchTask(Task task, String trackerName, InetAddress addr) {
CoronaSessionInfo info = new CoronaSessionInfo(
coronaJT.getSessionId(), coronaJT.getJobTrackerAddress(),
coronaJT.getSecondaryTrackerAddress());
LaunchTaskAction action = new LaunchTaskAction(task, info);
String descripti... | [
"public",
"void",
"launchTask",
"(",
"Task",
"task",
",",
"String",
"trackerName",
",",
"InetAddress",
"addr",
")",
"{",
"CoronaSessionInfo",
"info",
"=",
"new",
"CoronaSessionInfo",
"(",
"coronaJT",
".",
"getSessionId",
"(",
")",
",",
"coronaJT",
".",
"getJob... | Enqueue a launch task action.
@param task The task to launch.
@param trackerName The name of the tracker to send the task to.
@param addr The address of the tracker to send the task to. | [
"Enqueue",
"a",
"launch",
"task",
"action",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskLauncher.java#L154-L165 |
118,574 | facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java | NamespaceNotifierClient.connectionStateChanged | boolean connectionStateChanged(int newState) {
switch (newState) {
case ConnectionManager.CONNECTED:
LOG.info(listeningPort + ": Switched to CONNECTED state.");
// Try to resubscribe all the watched events
try {
return resubscribe();
} catch (Exception e) {
... | java | boolean connectionStateChanged(int newState) {
switch (newState) {
case ConnectionManager.CONNECTED:
LOG.info(listeningPort + ": Switched to CONNECTED state.");
// Try to resubscribe all the watched events
try {
return resubscribe();
} catch (Exception e) {
... | [
"boolean",
"connectionStateChanged",
"(",
"int",
"newState",
")",
"{",
"switch",
"(",
"newState",
")",
"{",
"case",
"ConnectionManager",
".",
"CONNECTED",
":",
"LOG",
".",
"info",
"(",
"listeningPort",
"+",
"\": Switched to CONNECTED state.\"",
")",
";",
"// Try t... | Called by the ConnectionManager when the connection state changed.
The connection lock is hold when calling this method, so no
other methods from the ConnectionManager should be called here.
@param newState the new state
@return when the new state is DISCONNECTED_HIDDEN or DISCONNECTED_VISIBLE,
then the return value i... | [
"Called",
"by",
"the",
"ConnectionManager",
"when",
"the",
"connection",
"state",
"changed",
".",
"The",
"connection",
"lock",
"is",
"hold",
"when",
"calling",
"this",
"method",
"so",
"no",
"other",
"methods",
"from",
"the",
"ConnectionManager",
"should",
"be",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java#L186-L208 |
118,575 | facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java | NamespaceNotifierClient.removeWatch | public void removeWatch(String path, EventType watchType)
throws NotConnectedToServerException, InterruptedException,
WatchNotPlacedException {
NamespaceEvent event = new NamespaceEvent(path, watchType.getByteValue());
NamespaceEventKey eventKey = new NamespaceEventKey(path, watchType);
Object c... | java | public void removeWatch(String path, EventType watchType)
throws NotConnectedToServerException, InterruptedException,
WatchNotPlacedException {
NamespaceEvent event = new NamespaceEvent(path, watchType.getByteValue());
NamespaceEventKey eventKey = new NamespaceEventKey(path, watchType);
Object c... | [
"public",
"void",
"removeWatch",
"(",
"String",
"path",
",",
"EventType",
"watchType",
")",
"throws",
"NotConnectedToServerException",
",",
"InterruptedException",
",",
"WatchNotPlacedException",
"{",
"NamespaceEvent",
"event",
"=",
"new",
"NamespaceEvent",
"(",
"path",... | Removes a previously placed watch for a particular event type from the
given path. If the watch is not actually present at that path before
calling the method, nothing will happen.
To remove the watch for all event types at this path, use
{@link #removeAllWatches(String)}.
@param path the path from which the watch is... | [
"Removes",
"a",
"previously",
"placed",
"watch",
"for",
"a",
"particular",
"event",
"type",
"from",
"the",
"given",
"path",
".",
"If",
"the",
"watch",
"is",
"not",
"actually",
"present",
"at",
"that",
"path",
"before",
"calling",
"the",
"method",
"nothing",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java#L356-L396 |
118,576 | facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java | NamespaceNotifierClient.haveWatch | public boolean haveWatch(String path, EventType watchType) {
return watchedEvents.containsKey(new NamespaceEventKey(path, watchType));
} | java | public boolean haveWatch(String path, EventType watchType) {
return watchedEvents.containsKey(new NamespaceEventKey(path, watchType));
} | [
"public",
"boolean",
"haveWatch",
"(",
"String",
"path",
",",
"EventType",
"watchType",
")",
"{",
"return",
"watchedEvents",
".",
"containsKey",
"(",
"new",
"NamespaceEventKey",
"(",
"path",
",",
"watchType",
")",
")",
";",
"}"
] | Tests if a watch is placed at the given path and of the given type.
@param path the path where we should test if a watch is placed. For the
FILE_ADDED event type, this represents the path of the directory
under which the file will be created.
@param watchType the type of the event for which we test if a watch is
prese... | [
"Tests",
"if",
"a",
"watch",
"is",
"placed",
"at",
"the",
"given",
"path",
"and",
"of",
"the",
"given",
"type",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java#L410-L412 |
118,577 | facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java | NamespaceNotifierClient.resubscribe | private boolean resubscribe() throws TransactionIdTooOldException,
InterruptedException {
for (NamespaceEventKey eventKey : watchedEvents.keySet()) {
NamespaceEvent event = eventKey.getEvent();
if (!subscribe(event.getPath(), EventType.fromByteValue(event.getType()),
watchedEvents.get(e... | java | private boolean resubscribe() throws TransactionIdTooOldException,
InterruptedException {
for (NamespaceEventKey eventKey : watchedEvents.keySet()) {
NamespaceEvent event = eventKey.getEvent();
if (!subscribe(event.getPath(), EventType.fromByteValue(event.getType()),
watchedEvents.get(e... | [
"private",
"boolean",
"resubscribe",
"(",
")",
"throws",
"TransactionIdTooOldException",
",",
"InterruptedException",
"{",
"for",
"(",
"NamespaceEventKey",
"eventKey",
":",
"watchedEvents",
".",
"keySet",
"(",
")",
")",
"{",
"NamespaceEvent",
"event",
"=",
"eventKey... | Called right after a reconnect to resubscribe to all events. Must be
called with the connection lock acquired. | [
"Called",
"right",
"after",
"a",
"reconnect",
"to",
"resubscribe",
"to",
"all",
"events",
".",
"Must",
"be",
"called",
"with",
"the",
"connection",
"lock",
"acquired",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java#L428-L438 |
118,578 | facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java | ConnectionManager.waitForTransparentConnect | void waitForTransparentConnect() throws InterruptedException,
NotConnectedToServerException {
if (state == DISCONNECTED_VISIBLE) {
LOG.warn(listeningPort + ": waitForTransparentConnect: got visible" +
" disconnected state");
throw new NotConnectedToServerException();
}
// Wa... | java | void waitForTransparentConnect() throws InterruptedException,
NotConnectedToServerException {
if (state == DISCONNECTED_VISIBLE) {
LOG.warn(listeningPort + ": waitForTransparentConnect: got visible" +
" disconnected state");
throw new NotConnectedToServerException();
}
// Wa... | [
"void",
"waitForTransparentConnect",
"(",
")",
"throws",
"InterruptedException",
",",
"NotConnectedToServerException",
"{",
"if",
"(",
"state",
"==",
"DISCONNECTED_VISIBLE",
")",
"{",
"LOG",
".",
"warn",
"(",
"listeningPort",
"+",
"\": waitForTransparentConnect: got visib... | Must be called holding the connection lock returned by getConnectionLock.
It waits until the current connection state is CONNECTED. If it ever
gets to DISCONNECTED_VISIBLE it will raise an exception. If the current
state is CONNECTED, then it will return without waiting.
@throws InterruptedException
@throws NotConnect... | [
"Must",
"be",
"called",
"holding",
"the",
"connection",
"lock",
"returned",
"by",
"getConnectionLock",
".",
"It",
"waits",
"until",
"the",
"current",
"connection",
"state",
"is",
"CONNECTED",
".",
"If",
"it",
"ever",
"gets",
"to",
"DISCONNECTED_VISIBLE",
"it",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java#L766-L788 |
118,579 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/ipc/ProtocolProxy.java | ProtocolProxy.isMethodSupported | public boolean isMethodSupported(String methodName,
Class<?>... parameterTypes)
throws IOException {
if (serverMethods == null) { // client & server have the same protocol
return true;
}
Method method;
try {
method = protocol.getDeclaredMethod(methodName,... | java | public boolean isMethodSupported(String methodName,
Class<?>... parameterTypes)
throws IOException {
if (serverMethods == null) { // client & server have the same protocol
return true;
}
Method method;
try {
method = protocol.getDeclaredMethod(methodName,... | [
"public",
"boolean",
"isMethodSupported",
"(",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"throws",
"IOException",
"{",
"if",
"(",
"serverMethods",
"==",
"null",
")",
"{",
"// client & server have the same protocol",
"return",... | Check if a method is supported by the server or not
@param methodName a method's name in String format
@param parameterTypes a method's parameter types
@return true if the method is supported by the server | [
"Check",
"if",
"a",
"method",
"is",
"supported",
"by",
"the",
"server",
"or",
"not"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/ProtocolProxy.java#L76-L92 |
118,580 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/terasort/TeraInputFormat.java | TeraInputFormat.writePartitionFile | public static void writePartitionFile(JobConf conf,
Path partFile) throws IOException {
TeraInputFormat inFormat = new TeraInputFormat();
TextSampler sampler = new TextSampler();
Text key = new Text();
Text value = new Text();
int partitions = conf.getNumRedu... | java | public static void writePartitionFile(JobConf conf,
Path partFile) throws IOException {
TeraInputFormat inFormat = new TeraInputFormat();
TextSampler sampler = new TextSampler();
Text key = new Text();
Text value = new Text();
int partitions = conf.getNumRedu... | [
"public",
"static",
"void",
"writePartitionFile",
"(",
"JobConf",
"conf",
",",
"Path",
"partFile",
")",
"throws",
"IOException",
"{",
"TeraInputFormat",
"inFormat",
"=",
"new",
"TeraInputFormat",
"(",
")",
";",
"TextSampler",
"sampler",
"=",
"new",
"TextSampler",
... | Use the input splits to take samples of the input and generate sample
keys. By default reads 100,000 keys from 10 locations in the input, sorts
them and picks N-1 keys to generate N equally sized partitions.
@param conf the job to sample
@param partFile where to write the output file to
@throws IOException if something... | [
"Use",
"the",
"input",
"splits",
"to",
"take",
"samples",
"of",
"the",
"input",
"and",
"generate",
"sample",
"keys",
".",
"By",
"default",
"reads",
"100",
"000",
"keys",
"from",
"10",
"locations",
"in",
"the",
"input",
"sorts",
"them",
"and",
"picks",
"N... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/terasort/TeraInputFormat.java#L108-L145 |
118,581 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/ReflectionUtils.java | ReflectionUtils.setConf | public static void setConf(Object theObject, Configuration conf,
boolean supportJobConf) {
if (conf != null) {
if (theObject instanceof Configurable) {
((Configurable) theObject).setConf(conf);
}
if (supportJobConf) {
setJobConf(theObject, conf);
}
}
} | java | public static void setConf(Object theObject, Configuration conf,
boolean supportJobConf) {
if (conf != null) {
if (theObject instanceof Configurable) {
((Configurable) theObject).setConf(conf);
}
if (supportJobConf) {
setJobConf(theObject, conf);
}
}
} | [
"public",
"static",
"void",
"setConf",
"(",
"Object",
"theObject",
",",
"Configuration",
"conf",
",",
"boolean",
"supportJobConf",
")",
"{",
"if",
"(",
"conf",
"!=",
"null",
")",
"{",
"if",
"(",
"theObject",
"instanceof",
"Configurable",
")",
"{",
"(",
"("... | Check and set 'configuration' if necessary.
@param theObject object for which to set configuration
@param conf Configuration
@param supportJobConf whether needs to configure old jobConf in an older way | [
"Check",
"and",
"set",
"configuration",
"if",
"necessary",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ReflectionUtils.java#L70-L80 |
118,582 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/ReflectionUtils.java | ReflectionUtils.newInstance | public static <T> T newInstance(Class<T> theClass, Class<?>[] parameterTypes,
Object[] initargs) {
// Perform some sanity checks on the arguments.
if (parameterTypes.length != initargs.length) {
throw new IllegalArgumentException(
"Constructor parameter types don't match constructor argume... | java | public static <T> T newInstance(Class<T> theClass, Class<?>[] parameterTypes,
Object[] initargs) {
// Perform some sanity checks on the arguments.
if (parameterTypes.length != initargs.length) {
throw new IllegalArgumentException(
"Constructor parameter types don't match constructor argume... | [
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Class",
"<",
"T",
">",
"theClass",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
",",
"Object",
"[",
"]",
"initargs",
")",
"{",
"// Perform some sanity checks on the arguments.",
"if",
... | Create an object for the given class.
@param theClass
class of which an object is created
@param parameterTypes
an array of parameterTypes for the constructor
@param initargs
the list of arguments for the constructor
@return a new object | [
"Create",
"an",
"object",
"for",
"the",
"given",
"class",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ReflectionUtils.java#L160-L182 |
118,583 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/ReflectionUtils.java | ReflectionUtils.logThreadInfo | public static void logThreadInfo(Log log,
String title,
long minInterval) {
boolean dumpStack = false;
if (log.isInfoEnabled()) {
synchronized (ReflectionUtils.class) {
long now = System.currentTimeMillis();
if (now - pr... | java | public static void logThreadInfo(Log log,
String title,
long minInterval) {
boolean dumpStack = false;
if (log.isInfoEnabled()) {
synchronized (ReflectionUtils.class) {
long now = System.currentTimeMillis();
if (now - pr... | [
"public",
"static",
"void",
"logThreadInfo",
"(",
"Log",
"log",
",",
"String",
"title",
",",
"long",
"minInterval",
")",
"{",
"boolean",
"dumpStack",
"=",
"false",
";",
"if",
"(",
"log",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"synchronized",
"(",
"Ref... | Log the current thread stacks at INFO level.
@param log the logger that logs the stack trace
@param title a descriptive title for the call stacks
@param minInterval the minimum time from the last | [
"Log",
"the",
"current",
"thread",
"stacks",
"at",
"INFO",
"level",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ReflectionUtils.java#L252-L270 |
118,584 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorageDirectoryRetentionManager.java | NNStorageDirectoryRetentionManager.backupFiles | public static void backupFiles(FileSystem fs, File dest,
Configuration conf) throws IOException {
// check if we can still backup
cleanUpAndCheckBackup(conf, dest);
int MAX_ATTEMPT = 3;
for (int i = 0; i < MAX_ATTEMPT; i++) {
try {
String mdate = dateForm.get().format(new Date(... | java | public static void backupFiles(FileSystem fs, File dest,
Configuration conf) throws IOException {
// check if we can still backup
cleanUpAndCheckBackup(conf, dest);
int MAX_ATTEMPT = 3;
for (int i = 0; i < MAX_ATTEMPT; i++) {
try {
String mdate = dateForm.get().format(new Date(... | [
"public",
"static",
"void",
"backupFiles",
"(",
"FileSystem",
"fs",
",",
"File",
"dest",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"// check if we can still backup",
"cleanUpAndCheckBackup",
"(",
"conf",
",",
"dest",
")",
";",
"int",
"MAX_AT... | Backup given directory.
Enforce that max number of backups has not been reached. | [
"Backup",
"given",
"directory",
".",
"Enforce",
"that",
"max",
"number",
"of",
"backups",
"has",
"not",
"been",
"reached",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorageDirectoryRetentionManager.java#L83-L112 |
118,585 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorageDirectoryRetentionManager.java | NNStorageDirectoryRetentionManager.cleanUpAndCheckBackup | static void cleanUpAndCheckBackup(Configuration conf, File origin) throws IOException {
// get all backups
String[] backups = getBackups(origin);
File root = origin.getParentFile();
// maximum total number of backups
int copiesToKeep = conf.getInt(NN_IMAGE_COPIES_TOKEEP,
NN_IMAGE_COPIES... | java | static void cleanUpAndCheckBackup(Configuration conf, File origin) throws IOException {
// get all backups
String[] backups = getBackups(origin);
File root = origin.getParentFile();
// maximum total number of backups
int copiesToKeep = conf.getInt(NN_IMAGE_COPIES_TOKEEP,
NN_IMAGE_COPIES... | [
"static",
"void",
"cleanUpAndCheckBackup",
"(",
"Configuration",
"conf",
",",
"File",
"origin",
")",
"throws",
"IOException",
"{",
"// get all backups",
"String",
"[",
"]",
"backups",
"=",
"getBackups",
"(",
"origin",
")",
";",
"File",
"root",
"=",
"origin",
"... | Check if we have not exceeded the maximum number of backups. | [
"Check",
"if",
"we",
"have",
"not",
"exceeded",
"the",
"maximum",
"number",
"of",
"backups",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorageDirectoryRetentionManager.java#L118-L146 |
118,586 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorageDirectoryRetentionManager.java | NNStorageDirectoryRetentionManager.deleteOldBackups | static void deleteOldBackups(File root, String[] backups, int daysToKeep,
int copiesToKeep) {
Date now = new Date(System.currentTimeMillis());
// leave the copiesToKeep-1 at least (+1 will be the current backup)
int maxIndex = Math.max(0, backups.length - copiesToKeep + 1);
for (int i = ... | java | static void deleteOldBackups(File root, String[] backups, int daysToKeep,
int copiesToKeep) {
Date now = new Date(System.currentTimeMillis());
// leave the copiesToKeep-1 at least (+1 will be the current backup)
int maxIndex = Math.max(0, backups.length - copiesToKeep + 1);
for (int i = ... | [
"static",
"void",
"deleteOldBackups",
"(",
"File",
"root",
",",
"String",
"[",
"]",
"backups",
",",
"int",
"daysToKeep",
",",
"int",
"copiesToKeep",
")",
"{",
"Date",
"now",
"=",
"new",
"Date",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",... | Delete backups according to the retention policy.
@param root root directory
@param backups backups SORTED on the timestamp from oldest to newest
@param daysToKeep
@param copiesToKeep | [
"Delete",
"backups",
"according",
"to",
"the",
"retention",
"policy",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorageDirectoryRetentionManager.java#L156-L197 |
118,587 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorageDirectoryRetentionManager.java | NNStorageDirectoryRetentionManager.getBackups | static String[] getBackups(File origin) {
File root = origin.getParentFile();
final String originName = origin.getName();
String[] backups = root.list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
if (!name.startsWith(originName + File.pathSeparator... | java | static String[] getBackups(File origin) {
File root = origin.getParentFile();
final String originName = origin.getName();
String[] backups = root.list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
if (!name.startsWith(originName + File.pathSeparator... | [
"static",
"String",
"[",
"]",
"getBackups",
"(",
"File",
"origin",
")",
"{",
"File",
"root",
"=",
"origin",
".",
"getParentFile",
"(",
")",
";",
"final",
"String",
"originName",
"=",
"origin",
".",
"getName",
"(",
")",
";",
"String",
"[",
"]",
"backups... | List all directories that match the backup pattern.
Sort from oldest to newest. | [
"List",
"all",
"directories",
"that",
"match",
"the",
"backup",
"pattern",
".",
"Sort",
"from",
"oldest",
"to",
"newest",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorageDirectoryRetentionManager.java#L203-L241 |
118,588 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java | FSImage.doImportCheckpoint | void doImportCheckpoint() throws IOException {
Collection<URI> checkpointDirs =
NNStorageConfiguration.getCheckpointDirs(conf, null);
Collection<URI> checkpointEditsDirs =
NNStorageConfiguration.getCheckpointEditsDirs(conf, null);
if (checkpointDirs == null || checkpointDirs.isEmpty()) {
... | java | void doImportCheckpoint() throws IOException {
Collection<URI> checkpointDirs =
NNStorageConfiguration.getCheckpointDirs(conf, null);
Collection<URI> checkpointEditsDirs =
NNStorageConfiguration.getCheckpointEditsDirs(conf, null);
if (checkpointDirs == null || checkpointDirs.isEmpty()) {
... | [
"void",
"doImportCheckpoint",
"(",
")",
"throws",
"IOException",
"{",
"Collection",
"<",
"URI",
">",
"checkpointDirs",
"=",
"NNStorageConfiguration",
".",
"getCheckpointDirs",
"(",
"conf",
",",
"null",
")",
";",
"Collection",
"<",
"URI",
">",
"checkpointEditsDirs"... | Load image from a checkpoint directory and save it into the current one.
@param target the NameSystem to import into
@throws IOException | [
"Load",
"image",
"from",
"a",
"checkpoint",
"directory",
"and",
"save",
"it",
"into",
"the",
"current",
"one",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L606-L644 |
118,589 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java | FSImage.loadFSImage | protected void loadFSImage(ImageInputStream iis, File imageFile) throws IOException {
MD5Hash expectedMD5 = MD5FileUtils.readStoredMd5ForFile(imageFile);
if (expectedMD5 == null) {
throw new IOException("No MD5 file found corresponding to image file "
+ imageFile);
}
iis.setImageDigest(e... | java | protected void loadFSImage(ImageInputStream iis, File imageFile) throws IOException {
MD5Hash expectedMD5 = MD5FileUtils.readStoredMd5ForFile(imageFile);
if (expectedMD5 == null) {
throw new IOException("No MD5 file found corresponding to image file "
+ imageFile);
}
iis.setImageDigest(e... | [
"protected",
"void",
"loadFSImage",
"(",
"ImageInputStream",
"iis",
",",
"File",
"imageFile",
")",
"throws",
"IOException",
"{",
"MD5Hash",
"expectedMD5",
"=",
"MD5FileUtils",
".",
"readStoredMd5ForFile",
"(",
"imageFile",
")",
";",
"if",
"(",
"expectedMD5",
"==",... | Load the image namespace from the given image file, verifying it against
the MD5 sum stored in its associated .md5 file. | [
"Load",
"the",
"image",
"namespace",
"from",
"the",
"given",
"image",
"file",
"verifying",
"it",
"against",
"the",
"MD5",
"sum",
"stored",
"in",
"its",
"associated",
".",
"md5",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L825-L833 |
118,590 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java | FSImage.getParent | String getParent(String path) {
return path.substring(0, path.lastIndexOf(Path.SEPARATOR));
} | java | String getParent(String path) {
return path.substring(0, path.lastIndexOf(Path.SEPARATOR));
} | [
"String",
"getParent",
"(",
"String",
"path",
")",
"{",
"return",
"path",
".",
"substring",
"(",
"0",
",",
"path",
".",
"lastIndexOf",
"(",
"Path",
".",
"SEPARATOR",
")",
")",
";",
"}"
] | Return string representing the parent of the given path. | [
"Return",
"string",
"representing",
"the",
"parent",
"of",
"the",
"given",
"path",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L861-L863 |
118,591 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java | FSImage.loadEdits | protected long loadEdits(Iterable<EditLogInputStream> editStreams)
throws IOException {
long lastAppliedTxId = storage.getMostRecentCheckpointTxId();
int numLoaded = 0;
FSEditLogLoader loader = new FSEditLogLoader(namesystem);
// Load latest edits
for (EditLogInputStream editIn : edit... | java | protected long loadEdits(Iterable<EditLogInputStream> editStreams)
throws IOException {
long lastAppliedTxId = storage.getMostRecentCheckpointTxId();
int numLoaded = 0;
FSEditLogLoader loader = new FSEditLogLoader(namesystem);
// Load latest edits
for (EditLogInputStream editIn : edit... | [
"protected",
"long",
"loadEdits",
"(",
"Iterable",
"<",
"EditLogInputStream",
">",
"editStreams",
")",
"throws",
"IOException",
"{",
"long",
"lastAppliedTxId",
"=",
"storage",
".",
"getMostRecentCheckpointTxId",
"(",
")",
";",
"int",
"numLoaded",
"=",
"0",
";",
... | Load the specified list of edit files into the image.
@return the txid of the current transaction (next to be loaded | [
"Load",
"the",
"specified",
"list",
"of",
"edit",
"files",
"into",
"the",
"image",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L878-L899 |
118,592 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java | FSImage.saveFSImage | void saveFSImage(SaveNamespaceContext context, ImageManager im, boolean forceUncompressed)
throws IOException {
long txid = context.getTxId();
OutputStream os = im.getCheckpointOutputStream(txid);
FSImageFormat.Saver saver = new FSImageFormat.Saver(context);
FSImageCompression compression = ... | java | void saveFSImage(SaveNamespaceContext context, ImageManager im, boolean forceUncompressed)
throws IOException {
long txid = context.getTxId();
OutputStream os = im.getCheckpointOutputStream(txid);
FSImageFormat.Saver saver = new FSImageFormat.Saver(context);
FSImageCompression compression = ... | [
"void",
"saveFSImage",
"(",
"SaveNamespaceContext",
"context",
",",
"ImageManager",
"im",
",",
"boolean",
"forceUncompressed",
")",
"throws",
"IOException",
"{",
"long",
"txid",
"=",
"context",
".",
"getTxId",
"(",
")",
";",
"OutputStream",
"os",
"=",
"im",
".... | Save the contents of the FS image to the file. | [
"Save",
"the",
"contents",
"of",
"the",
"FS",
"image",
"to",
"the",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L914-L927 |
118,593 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java | FSImage.saveNamespace | public synchronized void saveNamespace(boolean forUncompressed)
throws IOException {
InjectionHandler
.processEvent(InjectionEvent.FSIMAGE_STARTING_SAVE_NAMESPACE);
if (editLog == null) {
throw new IOException("editLog must be initialized");
}
storage.attemptRestoreRemovedSt... | java | public synchronized void saveNamespace(boolean forUncompressed)
throws IOException {
InjectionHandler
.processEvent(InjectionEvent.FSIMAGE_STARTING_SAVE_NAMESPACE);
if (editLog == null) {
throw new IOException("editLog must be initialized");
}
storage.attemptRestoreRemovedSt... | [
"public",
"synchronized",
"void",
"saveNamespace",
"(",
"boolean",
"forUncompressed",
")",
"throws",
"IOException",
"{",
"InjectionHandler",
".",
"processEvent",
"(",
"InjectionEvent",
".",
"FSIMAGE_STARTING_SAVE_NAMESPACE",
")",
";",
"if",
"(",
"editLog",
"==",
"null... | Save the contents of the FS image to a new image file in each of the
current storage directories. | [
"Save",
"the",
"contents",
"of",
"the",
"FS",
"image",
"to",
"a",
"new",
"image",
"file",
"in",
"each",
"of",
"the",
"current",
"storage",
"directories",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L977-L1015 |
118,594 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java | FSImage.confirmFormat | boolean confirmFormat(boolean force, boolean interactive) throws IOException {
List<FormatConfirmable> confirms = Lists.newArrayList();
for (StorageDirectory sd : storage.dirIterable(null)) {
confirms.add(sd);
}
confirms.addAll(editLog.getFormatConfirmables());
return Storage.confirmFormat(... | java | boolean confirmFormat(boolean force, boolean interactive) throws IOException {
List<FormatConfirmable> confirms = Lists.newArrayList();
for (StorageDirectory sd : storage.dirIterable(null)) {
confirms.add(sd);
}
confirms.addAll(editLog.getFormatConfirmables());
return Storage.confirmFormat(... | [
"boolean",
"confirmFormat",
"(",
"boolean",
"force",
",",
"boolean",
"interactive",
")",
"throws",
"IOException",
"{",
"List",
"<",
"FormatConfirmable",
">",
"confirms",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"for",
"(",
"StorageDirectory",
"sd",
":... | Check whether the storage directories and non-file journals exist.
If running in interactive mode, will prompt the user for each
directory to allow them to format anyway. Otherwise, returns
false, unless 'force' is specified.
@param interactive prompt the user when a dir exists
@return true if formatting should procee... | [
"Check",
"whether",
"the",
"storage",
"directories",
"and",
"non",
"-",
"file",
"journals",
"exist",
".",
"If",
"running",
"in",
"interactive",
"mode",
"will",
"prompt",
"the",
"user",
"for",
"each",
"directory",
"to",
"allow",
"them",
"to",
"format",
"anywa... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L1112-L1119 |
118,595 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java | FSImage.rollFSImage | void rollFSImage(CheckpointSignature sig) throws IOException {
long start = System.nanoTime();
sig.validateStorageInfo(this.storage);
saveDigestAndRenameCheckpointImage(sig.mostRecentCheckpointTxId,
sig.imageDigest);
long rollTime = DFSUtil.getElapsedTimeMicroSeconds(start);
if (metrics !=... | java | void rollFSImage(CheckpointSignature sig) throws IOException {
long start = System.nanoTime();
sig.validateStorageInfo(this.storage);
saveDigestAndRenameCheckpointImage(sig.mostRecentCheckpointTxId,
sig.imageDigest);
long rollTime = DFSUtil.getElapsedTimeMicroSeconds(start);
if (metrics !=... | [
"void",
"rollFSImage",
"(",
"CheckpointSignature",
"sig",
")",
"throws",
"IOException",
"{",
"long",
"start",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"sig",
".",
"validateStorageInfo",
"(",
"this",
".",
"storage",
")",
";",
"saveDigestAndRenameCheckpointI... | End checkpoint.
Validate the current storage info with the given signature.
@param sig to validate the current storage info against
@throws IOException if the checkpoint fields are inconsistent | [
"End",
"checkpoint",
".",
"Validate",
"the",
"current",
"storage",
"info",
"with",
"the",
"given",
"signature",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L1167-L1178 |
118,596 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java | FSImage.saveDigestAndRenameCheckpointImage | synchronized void saveDigestAndRenameCheckpointImage(
long txid, MD5Hash digest) throws IOException {
if (!digest.equals(storage.getCheckpointImageDigest(txid))) {
throw new IOException(
"Checkpoint image is corrupt: expecting an MD5 checksum of" +
digest + " but is " + storage.g... | java | synchronized void saveDigestAndRenameCheckpointImage(
long txid, MD5Hash digest) throws IOException {
if (!digest.equals(storage.getCheckpointImageDigest(txid))) {
throw new IOException(
"Checkpoint image is corrupt: expecting an MD5 checksum of" +
digest + " but is " + storage.g... | [
"synchronized",
"void",
"saveDigestAndRenameCheckpointImage",
"(",
"long",
"txid",
",",
"MD5Hash",
"digest",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"digest",
".",
"equals",
"(",
"storage",
".",
"getCheckpointImageDigest",
"(",
"txid",
")",
")",
")",
... | This is called by the 2NN after having downloaded an image, and by
the NN after having received a new image from the 2NN. It
renames the image from fsimage_N.ckpt to fsimage_N and also
saves the related .md5 file into place. | [
"This",
"is",
"called",
"by",
"the",
"2NN",
"after",
"having",
"downloaded",
"an",
"image",
"and",
"by",
"the",
"NN",
"after",
"having",
"received",
"a",
"new",
"image",
"from",
"the",
"2NN",
".",
"It",
"renames",
"the",
"image",
"from",
"fsimage_N",
"."... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L1191-L1205 |
118,597 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java | FSImage.getCheckpointDirs | static Collection<File> getCheckpointDirs(Configuration conf,
String defaultName) {
Collection<String> dirNames = conf.getStringCollection("fs.checkpoint.dir");
if (dirNames.size() == 0 && defaultName != null) {
dirNames.add(defaultName);
}
Collection<File> dirs = new ArrayList<File>(dirName... | java | static Collection<File> getCheckpointDirs(Configuration conf,
String defaultName) {
Collection<String> dirNames = conf.getStringCollection("fs.checkpoint.dir");
if (dirNames.size() == 0 && defaultName != null) {
dirNames.add(defaultName);
}
Collection<File> dirs = new ArrayList<File>(dirName... | [
"static",
"Collection",
"<",
"File",
">",
"getCheckpointDirs",
"(",
"Configuration",
"conf",
",",
"String",
"defaultName",
")",
"{",
"Collection",
"<",
"String",
">",
"dirNames",
"=",
"conf",
".",
"getStringCollection",
"(",
"\"fs.checkpoint.dir\"",
")",
";",
"i... | Retrieve checkpoint dirs from configuration.
@param conf the Configuration
@param defaultValue a default value for the attribute, if null
@return a Collection of URIs representing the values in
dfs.namenode.checkpoint.dir configuration property | [
"Retrieve",
"checkpoint",
"dirs",
"from",
"configuration",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L1266-L1277 |
118,598 | facebookarchive/hadoop-20 | src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/JobInitializationPoller.java | JobInitializationPoller.printJobs | private void printJobs(ArrayList<JobInProgress> jobsToInitialize) {
for (JobInProgress job : jobsToInitialize) {
LOG.info("Passing to Initializer Job Id :" + job.getJobID()
+ " User: " + job.getProfile().getUser() + " Queue : "
+ job.getProfile().getQueueName());
}
} | java | private void printJobs(ArrayList<JobInProgress> jobsToInitialize) {
for (JobInProgress job : jobsToInitialize) {
LOG.info("Passing to Initializer Job Id :" + job.getJobID()
+ " User: " + job.getProfile().getUser() + " Queue : "
+ job.getProfile().getQueueName());
}
} | [
"private",
"void",
"printJobs",
"(",
"ArrayList",
"<",
"JobInProgress",
">",
"jobsToInitialize",
")",
"{",
"for",
"(",
"JobInProgress",
"job",
":",
"jobsToInitialize",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Passing to Initializer Job Id :\"",
"+",
"job",
".",
"ge... | Method used to print log statements about which jobs are being
passed to init-threads.
@param jobsToInitialize list of jobs which are passed to be
init-threads. | [
"Method",
"used",
"to",
"print",
"log",
"statements",
"about",
"which",
"jobs",
"are",
"being",
"passed",
"to",
"init",
"-",
"threads",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/JobInitializationPoller.java#L343-L349 |
118,599 | facebookarchive/hadoop-20 | src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/JobInitializationPoller.java | JobInitializationPoller.assignThreadsToQueues | private void assignThreadsToQueues() {
int countOfQueues = jobQueues.size();
String[] queues = (String[]) jobQueues.keySet().toArray(
new String[countOfQueues]);
int numberOfQueuesPerThread = countOfQueues / poolSize;
int numberOfQueuesAssigned = 0;
for (int i = 0; i < poolSize; i++) {
... | java | private void assignThreadsToQueues() {
int countOfQueues = jobQueues.size();
String[] queues = (String[]) jobQueues.keySet().toArray(
new String[countOfQueues]);
int numberOfQueuesPerThread = countOfQueues / poolSize;
int numberOfQueuesAssigned = 0;
for (int i = 0; i < poolSize; i++) {
... | [
"private",
"void",
"assignThreadsToQueues",
"(",
")",
"{",
"int",
"countOfQueues",
"=",
"jobQueues",
".",
"size",
"(",
")",
";",
"String",
"[",
"]",
"queues",
"=",
"(",
"String",
"[",
"]",
")",
"jobQueues",
".",
"keySet",
"(",
")",
".",
"toArray",
"(",... | Method which is used by the poller to assign appropriate worker thread
to a queue. The number of threads would be always less than or equal
to number of queues in a system. If number of threads is configured to
be more than number of queues then poller does not create threads more
than number of queues. | [
"Method",
"which",
"is",
"used",
"by",
"the",
"poller",
"to",
"assign",
"appropriate",
"worker",
"thread",
"to",
"a",
"queue",
".",
"The",
"number",
"of",
"threads",
"would",
"be",
"always",
"less",
"than",
"or",
"equal",
"to",
"number",
"of",
"queues",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/JobInitializationPoller.java#L370-L397 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.