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,300 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java | LinuxTaskController.writeCommand | private void writeCommand(String cmdLine,
String directory) throws IOException {
PrintWriter pw = null;
String commandFile = directory + File.separator + COMMAND_FILE;
LOG.info("Writing commands to " + commandFile);
try {
FileWriter fw = new FileWriter(c... | java | private void writeCommand(String cmdLine,
String directory) throws IOException {
PrintWriter pw = null;
String commandFile = directory + File.separator + COMMAND_FILE;
LOG.info("Writing commands to " + commandFile);
try {
FileWriter fw = new FileWriter(c... | [
"private",
"void",
"writeCommand",
"(",
"String",
"cmdLine",
",",
"String",
"directory",
")",
"throws",
"IOException",
"{",
"PrintWriter",
"pw",
"=",
"null",
";",
"String",
"commandFile",
"=",
"directory",
"+",
"File",
".",
"separator",
"+",
"COMMAND_FILE",
";... | a file and execute it. | [
"a",
"file",
"and",
"execute",
"it",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java#L452-L477 |
118,301 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java | LinuxTaskController.finishTask | private void finishTask(TaskControllerContext context,
TaskCommands command) throws IOException{
if(context.task == null) {
LOG.info("Context task null not killing the JVM");
return;
}
ShellCommandExecutor shExec = buildTaskControllerExecutor(
command, context.env.conf.getUser(),
... | java | private void finishTask(TaskControllerContext context,
TaskCommands command) throws IOException{
if(context.task == null) {
LOG.info("Context task null not killing the JVM");
return;
}
ShellCommandExecutor shExec = buildTaskControllerExecutor(
command, context.env.conf.getUser(),
... | [
"private",
"void",
"finishTask",
"(",
"TaskControllerContext",
"context",
",",
"TaskCommands",
"command",
")",
"throws",
"IOException",
"{",
"if",
"(",
"context",
".",
"task",
"==",
"null",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Context task null not killing the JV... | Convenience method used to sending appropriate Kill signal to the task
VM
@param context
@param command
@throws IOException | [
"Convenience",
"method",
"used",
"to",
"sending",
"appropriate",
"Kill",
"signal",
"to",
"the",
"task",
"VM"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/LinuxTaskController.java#L570-L586 |
118,302 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobHistory.java | JobHistory.getHistoryFilePath | public static String getHistoryFilePath(JobID jobId) {
MovedFileInfo info = jobHistoryFileMap.get(jobId);
if (info == null) {
return null;
}
return info.historyFile;
} | java | public static String getHistoryFilePath(JobID jobId) {
MovedFileInfo info = jobHistoryFileMap.get(jobId);
if (info == null) {
return null;
}
return info.historyFile;
} | [
"public",
"static",
"String",
"getHistoryFilePath",
"(",
"JobID",
"jobId",
")",
"{",
"MovedFileInfo",
"info",
"=",
"jobHistoryFileMap",
".",
"get",
"(",
"jobId",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"... | Given the job id, return the history file path from the cache | [
"Given",
"the",
"job",
"id",
"return",
"the",
"history",
"file",
"path",
"from",
"the",
"cache"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobHistory.java#L180-L186 |
118,303 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobHistory.java | JobHistory.init | public static boolean init(JobHistoryObserver jobTracker, JobConf conf,
String hostname, long jobTrackerStartTime){
try {
LOG_DIR = conf.get("hadoop.job.history.location" ,
"file:///" + new File(
System.getProperty("hadoop.log.dir", "/tmp")).getAbsolutePath()
+ File.separa... | java | public static boolean init(JobHistoryObserver jobTracker, JobConf conf,
String hostname, long jobTrackerStartTime){
try {
LOG_DIR = conf.get("hadoop.job.history.location" ,
"file:///" + new File(
System.getProperty("hadoop.log.dir", "/tmp")).getAbsolutePath()
+ File.separa... | [
"public",
"static",
"boolean",
"init",
"(",
"JobHistoryObserver",
"jobTracker",
",",
"JobConf",
"conf",
",",
"String",
"hostname",
",",
"long",
"jobTrackerStartTime",
")",
"{",
"try",
"{",
"LOG_DIR",
"=",
"conf",
".",
"get",
"(",
"\"hadoop.job.history.location\"",... | Initialize JobHistory files.
@param conf Jobconf of the job tracker.
@param hostname jobtracker's hostname
@param jobTrackerStartTime jobtracker's start time
@return true if intialized properly
false otherwise | [
"Initialize",
"JobHistory",
"files",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobHistory.java#L428-L461 |
118,304 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobHistory.java | JobHistory.parseLine | private static void parseLine(String line, Listener l, boolean isEscaped)
throws IOException{
// extract the record type
int idx = line.indexOf(' ');
String recType = line.substring(0, idx);
String data = line.substring(idx+1, line.length());
Matcher matcher = pattern.matcher(data);
M... | java | private static void parseLine(String line, Listener l, boolean isEscaped)
throws IOException{
// extract the record type
int idx = line.indexOf(' ');
String recType = line.substring(0, idx);
String data = line.substring(idx+1, line.length());
Matcher matcher = pattern.matcher(data);
M... | [
"private",
"static",
"void",
"parseLine",
"(",
"String",
"line",
",",
"Listener",
"l",
",",
"boolean",
"isEscaped",
")",
"throws",
"IOException",
"{",
"// extract the record type ",
"int",
"idx",
"=",
"line",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"String"... | Parse a single line of history.
@param line
@param l
@throws IOException | [
"Parse",
"a",
"single",
"line",
"of",
"history",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobHistory.java#L619-L643 |
118,305 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobHistory.java | JobHistory.log | public static void log(PrintWriter out, RecordTypes recordType, Keys key,
String value){
value = escapeString(value);
out.println(recordType.name() + DELIMITER + key + "=\"" + value + "\""
+ DELIMITER + LINE_DELIMITER_CHAR);
} | java | public static void log(PrintWriter out, RecordTypes recordType, Keys key,
String value){
value = escapeString(value);
out.println(recordType.name() + DELIMITER + key + "=\"" + value + "\""
+ DELIMITER + LINE_DELIMITER_CHAR);
} | [
"public",
"static",
"void",
"log",
"(",
"PrintWriter",
"out",
",",
"RecordTypes",
"recordType",
",",
"Keys",
"key",
",",
"String",
"value",
")",
"{",
"value",
"=",
"escapeString",
"(",
"value",
")",
";",
"out",
".",
"println",
"(",
"recordType",
".",
"na... | Log a raw record type with keys and values. This is method is generally not used directly.
@param recordType type of log event
@param key key
@param value value | [
"Log",
"a",
"raw",
"record",
"type",
"with",
"keys",
"and",
"values",
".",
"This",
"is",
"method",
"is",
"generally",
"not",
"used",
"directly",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobHistory.java#L653-L658 |
118,306 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobHistory.java | JobHistory.getTaskLogsUrl | public static String getTaskLogsUrl(JobHistory.TaskAttempt attempt) {
if (attempt.get(Keys.HTTP_PORT).equals("")
|| attempt.get(Keys.TRACKER_NAME).equals("")
|| attempt.get(Keys.TASK_ATTEMPT_ID).equals("")) {
return null;
}
String taskTrackerName =
JobInProgress.convertTrackerNa... | java | public static String getTaskLogsUrl(JobHistory.TaskAttempt attempt) {
if (attempt.get(Keys.HTTP_PORT).equals("")
|| attempt.get(Keys.TRACKER_NAME).equals("")
|| attempt.get(Keys.TASK_ATTEMPT_ID).equals("")) {
return null;
}
String taskTrackerName =
JobInProgress.convertTrackerNa... | [
"public",
"static",
"String",
"getTaskLogsUrl",
"(",
"JobHistory",
".",
"TaskAttempt",
"attempt",
")",
"{",
"if",
"(",
"attempt",
".",
"get",
"(",
"Keys",
".",
"HTTP_PORT",
")",
".",
"equals",
"(",
"\"\"",
")",
"||",
"attempt",
".",
"get",
"(",
"Keys",
... | Return the TaskLogsUrl of a particular TaskAttempt
@param attempt
@return the taskLogsUrl. null if http-port or tracker-name or
task-attempt-id are unavailable. | [
"Return",
"the",
"TaskLogsUrl",
"of",
"a",
"particular",
"TaskAttempt"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobHistory.java#L2266-L2278 |
118,307 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapreduce/server/jobtracker/TaskTracker.java | TaskTracker.getAvailableSlots | public int getAvailableSlots(TaskType taskType) {
int availableSlots = 0;
if (taskType == TaskType.MAP) {
if (LOG.isDebugEnabled()) {
LOG.debug(trackerName + " getAvailSlots:" +
" max(m)=" + status.getMaxMapSlots() +
" occupied(m)=" + status.countOccupiedMapSlots());... | java | public int getAvailableSlots(TaskType taskType) {
int availableSlots = 0;
if (taskType == TaskType.MAP) {
if (LOG.isDebugEnabled()) {
LOG.debug(trackerName + " getAvailSlots:" +
" max(m)=" + status.getMaxMapSlots() +
" occupied(m)=" + status.countOccupiedMapSlots());... | [
"public",
"int",
"getAvailableSlots",
"(",
"TaskType",
"taskType",
")",
"{",
"int",
"availableSlots",
"=",
"0",
";",
"if",
"(",
"taskType",
"==",
"TaskType",
".",
"MAP",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",... | Get the number of currently available slots on this tasktracker for the
given type of the task.
@param taskType the {@link TaskType} to check for number of available slots
@return the number of currently available slots for the given
<code>taskType</code> | [
"Get",
"the",
"number",
"of",
"currently",
"available",
"slots",
"on",
"this",
"tasktracker",
"for",
"the",
"given",
"type",
"of",
"the",
"task",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/server/jobtracker/TaskTracker.java#L82-L100 |
118,308 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java | OfferService.sendIncrementalBlockReport | private void sendIncrementalBlockReport(long startTime) throws Exception {
// check if there are newly received blocks
Block[] receivedAndDeletedBlockArray = null;
int numBlocksReceivedAndDeleted = 0;
int currentPendingRequests = 0;
synchronized (receivedAndDeletedBlockList) {
// cons... | java | private void sendIncrementalBlockReport(long startTime) throws Exception {
// check if there are newly received blocks
Block[] receivedAndDeletedBlockArray = null;
int numBlocksReceivedAndDeleted = 0;
int currentPendingRequests = 0;
synchronized (receivedAndDeletedBlockList) {
// cons... | [
"private",
"void",
"sendIncrementalBlockReport",
"(",
"long",
"startTime",
")",
"throws",
"Exception",
"{",
"// check if there are newly received blocks",
"Block",
"[",
"]",
"receivedAndDeletedBlockArray",
"=",
"null",
";",
"int",
"numBlocksReceivedAndDeleted",
"=",
"0",
... | Sends an incremental block report to the Namenode.
@param startTime
the time when we started processing the last heartbeat
@throws Exception
if there is an error in reporting blocks to the NameNode | [
"Sends",
"an",
"incremental",
"block",
"report",
"to",
"the",
"Namenode",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java#L197-L266 |
118,309 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java | OfferService.shouldSendIncrementalReport | private boolean shouldSendIncrementalReport(long startTime){
boolean isPrimary = isPrimaryServiceCached() ||
donotDelayIncrementalBlockReports;
boolean deleteIntervalTrigger =
(startTime - lastDeletedReport > anode.deletedReportInterval);
// by default the report should be sent if the... | java | private boolean shouldSendIncrementalReport(long startTime){
boolean isPrimary = isPrimaryServiceCached() ||
donotDelayIncrementalBlockReports;
boolean deleteIntervalTrigger =
(startTime - lastDeletedReport > anode.deletedReportInterval);
// by default the report should be sent if the... | [
"private",
"boolean",
"shouldSendIncrementalReport",
"(",
"long",
"startTime",
")",
"{",
"boolean",
"isPrimary",
"=",
"isPrimaryServiceCached",
"(",
")",
"||",
"donotDelayIncrementalBlockReports",
";",
"boolean",
"deleteIntervalTrigger",
"=",
"(",
"startTime",
"-",
"las... | Checks if an incremental block report should be sent.
@param startTime
@return true if the report should be sent | [
"Checks",
"if",
"an",
"incremental",
"block",
"report",
"should",
"be",
"sent",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java#L453-L477 |
118,310 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java | OfferService.processFailedBlocks | private void processFailedBlocks(Block []failed,
int failedPendingRequests) {
synchronized (receivedAndDeletedBlockList) {
// We are adding to the front of a linked list and hence to preserve
// order we should add the blocks in the reverse order.
for (int i = failed.length - 1; i >= 0; i--... | java | private void processFailedBlocks(Block []failed,
int failedPendingRequests) {
synchronized (receivedAndDeletedBlockList) {
// We are adding to the front of a linked list and hence to preserve
// order we should add the blocks in the reverse order.
for (int i = failed.length - 1; i >= 0; i--... | [
"private",
"void",
"processFailedBlocks",
"(",
"Block",
"[",
"]",
"failed",
",",
"int",
"failedPendingRequests",
")",
"{",
"synchronized",
"(",
"receivedAndDeletedBlockList",
")",
"{",
"// We are adding to the front of a linked list and hence to preserve",
"// order we should a... | Adds blocks of incremental block report back to the
receivedAndDeletedBlockList, when handling an exception
@param failed - list of blocks
@param failedPendingRequests - how many of the blocks are received acks. | [
"Adds",
"blocks",
"of",
"incremental",
"block",
"report",
"back",
"to",
"the",
"receivedAndDeletedBlockList",
"when",
"handling",
"an",
"exception"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java#L492-L502 |
118,311 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java | OfferService.checkFailover | private boolean checkFailover() throws InterruptedException {
boolean isPrimary = isPrimaryServiceCached();
if (!isPrimary && isPrimaryService()) {
this.servicePair.setPrimaryOfferService(this);
return true;
}
return false;
} | java | private boolean checkFailover() throws InterruptedException {
boolean isPrimary = isPrimaryServiceCached();
if (!isPrimary && isPrimaryService()) {
this.servicePair.setPrimaryOfferService(this);
return true;
}
return false;
} | [
"private",
"boolean",
"checkFailover",
"(",
")",
"throws",
"InterruptedException",
"{",
"boolean",
"isPrimary",
"=",
"isPrimaryServiceCached",
"(",
")",
";",
"if",
"(",
"!",
"isPrimary",
"&&",
"isPrimaryService",
"(",
")",
")",
"{",
"this",
".",
"servicePair",
... | Determines whether a failover has happened and accordingly takes the
appropriate action.
@return whether or not failover happened | [
"Determines",
"whether",
"a",
"failover",
"has",
"happened",
"and",
"accordingly",
"takes",
"the",
"appropriate",
"action",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java#L553-L560 |
118,312 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java | OfferService.processCommand | private boolean processCommand(DatanodeCommand[] cmds, long processStartTime)
throws InterruptedException {
if (cmds != null) {
// at each heartbeat the standby offer service will talk to ZK!
boolean switchedFromStandbyToPrimary = checkFailover();
for (DatanodeCommand cmd : cmds) {
t... | java | private boolean processCommand(DatanodeCommand[] cmds, long processStartTime)
throws InterruptedException {
if (cmds != null) {
// at each heartbeat the standby offer service will talk to ZK!
boolean switchedFromStandbyToPrimary = checkFailover();
for (DatanodeCommand cmd : cmds) {
t... | [
"private",
"boolean",
"processCommand",
"(",
"DatanodeCommand",
"[",
"]",
"cmds",
",",
"long",
"processStartTime",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"cmds",
"!=",
"null",
")",
"{",
"// at each heartbeat the standby offer service will talk to ZK!",
"... | Process an array of datanode commands. This function has logic to check for
failover. Any commands should be processed using this function as an
entry point.
@param cmds an array of datanode commands
@return true if further processing may be required or false otherwise. | [
"Process",
"an",
"array",
"of",
"datanode",
"commands",
".",
"This",
"function",
"has",
"logic",
"to",
"check",
"for",
"failover",
".",
"Any",
"commands",
"should",
"be",
"processed",
"using",
"this",
"function",
"as",
"an",
"entry",
"point",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java#L570-L602 |
118,313 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java | OfferService.prepareFailover | private void prepareFailover() {
LOG.info("PREPARE FAILOVER requested by : " + this.avatarnodeAddress);
// we should start sending incremental block reports and block
// reports normally
setBackoff(false);
this.donotDelayIncrementalBlockReports = true;
InjectionHandler.processEvent(InjectionEven... | java | private void prepareFailover() {
LOG.info("PREPARE FAILOVER requested by : " + this.avatarnodeAddress);
// we should start sending incremental block reports and block
// reports normally
setBackoff(false);
this.donotDelayIncrementalBlockReports = true;
InjectionHandler.processEvent(InjectionEven... | [
"private",
"void",
"prepareFailover",
"(",
")",
"{",
"LOG",
".",
"info",
"(",
"\"PREPARE FAILOVER requested by : \"",
"+",
"this",
".",
"avatarnodeAddress",
")",
";",
"// we should start sending incremental block reports and block",
"// reports normally",
"setBackoff",
"(",
... | Take actions in preparation for failover. | [
"Take",
"actions",
"in",
"preparation",
"for",
"failover",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java#L740-L748 |
118,314 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java | OfferService.clearPrimary | private boolean clearPrimary() throws InterruptedException {
try {
if (!isPrimaryServiceCached()) {
InetSocketAddress addr1 = servicePair.avatarAddr1;
InetSocketAddress addr2 = servicePair.avatarAddr2;
if (avatarnodeAddress.equals(addr2)) {
LOG.info("Restarting service for Av... | java | private boolean clearPrimary() throws InterruptedException {
try {
if (!isPrimaryServiceCached()) {
InetSocketAddress addr1 = servicePair.avatarAddr1;
InetSocketAddress addr2 = servicePair.avatarAddr2;
if (avatarnodeAddress.equals(addr2)) {
LOG.info("Restarting service for Av... | [
"private",
"boolean",
"clearPrimary",
"(",
")",
"throws",
"InterruptedException",
"{",
"try",
"{",
"if",
"(",
"!",
"isPrimaryServiceCached",
"(",
")",
")",
"{",
"InetSocketAddress",
"addr1",
"=",
"servicePair",
".",
"avatarAddr1",
";",
"InetSocketAddress",
"addr2"... | This is clears up the thread heartbeating to the primary Avatar, by
restarting it. This makes sure all commands from the primary have been
processed by the datanode. This method is used during failover. | [
"This",
"is",
"clears",
"up",
"the",
"thread",
"heartbeating",
"to",
"the",
"primary",
"Avatar",
"by",
"restarting",
"it",
".",
"This",
"makes",
"sure",
"all",
"commands",
"from",
"the",
"primary",
"have",
"been",
"processed",
"by",
"the",
"datanode",
".",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java#L764-L790 |
118,315 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java | OfferService.scheduleBlockReport | public void scheduleBlockReport(long delay) {
if (delay > 0) { // send BR after random delay
lastBlockReport = System.currentTimeMillis()
- ( anode.blockReportInterval - R.nextInt((int)(delay)));
} else { // send at next heartbeat
lastBlockReport = lastHeartbeat - anode.b... | java | public void scheduleBlockReport(long delay) {
if (delay > 0) { // send BR after random delay
lastBlockReport = System.currentTimeMillis()
- ( anode.blockReportInterval - R.nextInt((int)(delay)));
} else { // send at next heartbeat
lastBlockReport = lastHeartbeat - anode.b... | [
"public",
"void",
"scheduleBlockReport",
"(",
"long",
"delay",
")",
"{",
"if",
"(",
"delay",
">",
"0",
")",
"{",
"// send BR after random delay",
"lastBlockReport",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"(",
"anode",
".",
"blockReportInterval",... | This methods arranges for the data node to send the block report at the next heartbeat. | [
"This",
"methods",
"arranges",
"for",
"the",
"data",
"node",
"to",
"send",
"the",
"block",
"report",
"at",
"the",
"next",
"heartbeat",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java#L795-L803 |
118,316 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java | OfferService.removeReceivedBlocks | void removeReceivedBlocks(Block[] removeList) {
long start = AvatarDataNode.now();
synchronized(receivedAndDeletedBlockList) {
ReceivedBlockInfo block = new ReceivedBlockInfo();
block.setDelHints(ReceivedBlockInfo.WILDCARD_HINT);
for (Block bi : removeList) {
block.set(bi.getBlockId(),... | java | void removeReceivedBlocks(Block[] removeList) {
long start = AvatarDataNode.now();
synchronized(receivedAndDeletedBlockList) {
ReceivedBlockInfo block = new ReceivedBlockInfo();
block.setDelHints(ReceivedBlockInfo.WILDCARD_HINT);
for (Block bi : removeList) {
block.set(bi.getBlockId(),... | [
"void",
"removeReceivedBlocks",
"(",
"Block",
"[",
"]",
"removeList",
")",
"{",
"long",
"start",
"=",
"AvatarDataNode",
".",
"now",
"(",
")",
";",
"synchronized",
"(",
"receivedAndDeletedBlockList",
")",
"{",
"ReceivedBlockInfo",
"block",
"=",
"new",
"ReceivedBl... | Remove blocks from blockReceived queues | [
"Remove",
"blocks",
"from",
"blockReceived",
"queues"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java#L855-L872 |
118,317 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/CrcConcat.java | CrcConcat.transform | static int transform(int crc, int[][] lookupTable) {
int cb1 = lookupTable[0][crc & 0xff];
int cb2 = lookupTable[1][(crc >>>= 8) & 0xff];
int cb3 = lookupTable[2][(crc >>>= 8) & 0xff];
int cb4 = lookupTable[3][(crc >>>= 8) & 0xff];
return cb1 ^ cb2 ^ cb3 ^ cb4;
} | java | static int transform(int crc, int[][] lookupTable) {
int cb1 = lookupTable[0][crc & 0xff];
int cb2 = lookupTable[1][(crc >>>= 8) & 0xff];
int cb3 = lookupTable[2][(crc >>>= 8) & 0xff];
int cb4 = lookupTable[3][(crc >>>= 8) & 0xff];
return cb1 ^ cb2 ^ cb3 ^ cb4;
} | [
"static",
"int",
"transform",
"(",
"int",
"crc",
",",
"int",
"[",
"]",
"[",
"]",
"lookupTable",
")",
"{",
"int",
"cb1",
"=",
"lookupTable",
"[",
"0",
"]",
"[",
"crc",
"&",
"0xff",
"]",
";",
"int",
"cb2",
"=",
"lookupTable",
"[",
"1",
"]",
"[",
... | Helper function to transform a CRC using lookup table. Currently it is used
for calculating CRC after adding bytes zeros to source byte array. The special
lookup table needs to be passed in for this specific transformation
@param crc
@param lookupTable
the first dimension is for which byte it applies to, the second
di... | [
"Helper",
"function",
"to",
"transform",
"a",
"CRC",
"using",
"lookup",
"table",
".",
"Currently",
"it",
"is",
"used",
"for",
"calculating",
"CRC",
"after",
"adding",
"bytes",
"zeros",
"to",
"source",
"byte",
"array",
".",
"The",
"special",
"lookup",
"table"... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/CrcConcat.java#L68-L74 |
118,318 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/CrcConcat.java | CrcConcat.concatCrc | static public int concatCrc(int crc1, int crc2, int order) {
// Calculate CRC of crc1 + order's 0
int crcForCrc1 = crc1;
int orderRemained = order;
// Fast transforming CRCs for adding 0 to the end of the byte array by table
// look-up
for (LookupTable lookupTable : lookupTables) {
while ... | java | static public int concatCrc(int crc1, int crc2, int order) {
// Calculate CRC of crc1 + order's 0
int crcForCrc1 = crc1;
int orderRemained = order;
// Fast transforming CRCs for adding 0 to the end of the byte array by table
// look-up
for (LookupTable lookupTable : lookupTables) {
while ... | [
"static",
"public",
"int",
"concatCrc",
"(",
"int",
"crc1",
",",
"int",
"crc2",
",",
"int",
"order",
")",
"{",
"// Calculate CRC of crc1 + order's 0",
"int",
"crcForCrc1",
"=",
"crc1",
";",
"int",
"orderRemained",
"=",
"order",
";",
"// Fast transforming CRCs for ... | Concatenate two CRCs
@param crc1
the CRC of the first byte array
@param crc2
the CRC of the second byte array
@param order
the length of the second byte array
@return CRC of of the byte array, which is the concatenation of the two
byte arrays with given crc's | [
"Concatenate",
"two",
"CRCs"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/CrcConcat.java#L88-L136 |
118,319 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobEndNotifier.java | JobEndNotifier.localRunnerNotification | public static void localRunnerNotification(JobConf conf, JobStatus status) {
JobEndStatusInfo notification = createNotification(conf, status);
if (notification != null) {
while (notification.configureForRetry()) {
try {
int code = httpNotification(notification.getUri());
if (co... | java | public static void localRunnerNotification(JobConf conf, JobStatus status) {
JobEndStatusInfo notification = createNotification(conf, status);
if (notification != null) {
while (notification.configureForRetry()) {
try {
int code = httpNotification(notification.getUri());
if (co... | [
"public",
"static",
"void",
"localRunnerNotification",
"(",
"JobConf",
"conf",
",",
"JobStatus",
"status",
")",
"{",
"JobEndStatusInfo",
"notification",
"=",
"createNotification",
"(",
"conf",
",",
"status",
")",
";",
"if",
"(",
"notification",
"!=",
"null",
")"... | simple synchronous way | [
"simple",
"synchronous",
"way"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobEndNotifier.java#L139-L168 |
118,320 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/ResourceTypeProperties.java | ResourceTypeProperties.canBePreempted | public static boolean canBePreempted(ResourceType type) {
// Preemption is not allowed for JOBTRACKER grants.
switch (type) {
case MAP:
return true;
case REDUCE:
return true;
case JOBTRACKER:
return false;
default:
throw new RuntimeException("Undefined Preemption behavior... | java | public static boolean canBePreempted(ResourceType type) {
// Preemption is not allowed for JOBTRACKER grants.
switch (type) {
case MAP:
return true;
case REDUCE:
return true;
case JOBTRACKER:
return false;
default:
throw new RuntimeException("Undefined Preemption behavior... | [
"public",
"static",
"boolean",
"canBePreempted",
"(",
"ResourceType",
"type",
")",
"{",
"// Preemption is not allowed for JOBTRACKER grants.",
"switch",
"(",
"type",
")",
"{",
"case",
"MAP",
":",
"return",
"true",
";",
"case",
"REDUCE",
":",
"return",
"true",
";",... | Tells if preemption is allowed for a resource type.
@param type The type of the resource.
@return Is preemption allowed for the the specified type. | [
"Tells",
"if",
"preemption",
"is",
"allowed",
"for",
"a",
"resource",
"type",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/ResourceTypeProperties.java#L38-L50 |
118,321 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/ResourceTypeProperties.java | ResourceTypeProperties.neededLocalityLevels | public static List<LocalityLevel> neededLocalityLevels(ResourceType type) {
List<LocalityLevel> l = new ArrayList<LocalityLevel>();
switch (type) {
case MAP:
l.add(LocalityLevel.NODE);
l.add(LocalityLevel.RACK);
l.add(LocalityLevel.ANY);
break;
case REDUCE:
l.add(LocalityLe... | java | public static List<LocalityLevel> neededLocalityLevels(ResourceType type) {
List<LocalityLevel> l = new ArrayList<LocalityLevel>();
switch (type) {
case MAP:
l.add(LocalityLevel.NODE);
l.add(LocalityLevel.RACK);
l.add(LocalityLevel.ANY);
break;
case REDUCE:
l.add(LocalityLe... | [
"public",
"static",
"List",
"<",
"LocalityLevel",
">",
"neededLocalityLevels",
"(",
"ResourceType",
"type",
")",
"{",
"List",
"<",
"LocalityLevel",
">",
"l",
"=",
"new",
"ArrayList",
"<",
"LocalityLevel",
">",
"(",
")",
";",
"switch",
"(",
"type",
")",
"{"... | Returns the required locality levels, in order of preference,
for the resource type.
@param type The type of the resource.
@return The list of locality levels. | [
"Returns",
"the",
"required",
"locality",
"levels",
"in",
"order",
"of",
"preference",
"for",
"the",
"resource",
"type",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/ResourceTypeProperties.java#L58-L76 |
118,322 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageViewer.java | OfflineImageViewer.findImageVersion | private int findImageVersion(DataInputStream in) throws IOException {
in.mark(42); // arbitrary amount, resetting immediately
int version = in.readInt();
in.reset();
return version;
} | java | private int findImageVersion(DataInputStream in) throws IOException {
in.mark(42); // arbitrary amount, resetting immediately
int version = in.readInt();
in.reset();
return version;
} | [
"private",
"int",
"findImageVersion",
"(",
"DataInputStream",
"in",
")",
"throws",
"IOException",
"{",
"in",
".",
"mark",
"(",
"42",
")",
";",
"// arbitrary amount, resetting immediately",
"int",
"version",
"=",
"in",
".",
"readInt",
"(",
")",
";",
"in",
".",
... | Check an fsimage datainputstream's version number.
The datainput stream is returned at the same point as it was passed in;
this method has no effect on the datainputstream's read pointer.
@param in Datainputstream of fsimage
@return Filesystem layout version of fsimage represented by stream
@throws IOException If pro... | [
"Check",
"an",
"fsimage",
"datainputstream",
"s",
"version",
"number",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageViewer.java#L163-L170 |
118,323 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/FaultTolerantBlockPlacementPolicy.java | FaultTolerantBlockPlacementPolicy.setBadHostsAndRacks | public static void setBadHostsAndRacks(Set<String> racks,
Set<String> hosts) {
badRacks = racks;
badHosts = hosts;
} | java | public static void setBadHostsAndRacks(Set<String> racks,
Set<String> hosts) {
badRacks = racks;
badHosts = hosts;
} | [
"public",
"static",
"void",
"setBadHostsAndRacks",
"(",
"Set",
"<",
"String",
">",
"racks",
",",
"Set",
"<",
"String",
">",
"hosts",
")",
"{",
"badRacks",
"=",
"racks",
";",
"badHosts",
"=",
"hosts",
";",
"}"
] | A function to be used by unit tests only | [
"A",
"function",
"to",
"be",
"used",
"by",
"unit",
"tests",
"only"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/FaultTolerantBlockPlacementPolicy.java#L71-L75 |
118,324 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/FaultTolerantBlockPlacementPolicy.java | FaultTolerantBlockPlacementPolicy.initParityConfigs | private void initParityConfigs() {
Set<String> acceptedCodecIds = new HashSet<String>();
for (String s : conf.get("dfs.f4.accepted.codecs", "rs,xor").split(",")) {
acceptedCodecIds.add(s);
}
for (Codec c : Codec.getCodecs()) {
if (acceptedCodecIds.contains(c.id)) {
FSNamesystem.LOG.i... | java | private void initParityConfigs() {
Set<String> acceptedCodecIds = new HashSet<String>();
for (String s : conf.get("dfs.f4.accepted.codecs", "rs,xor").split(",")) {
acceptedCodecIds.add(s);
}
for (Codec c : Codec.getCodecs()) {
if (acceptedCodecIds.contains(c.id)) {
FSNamesystem.LOG.i... | [
"private",
"void",
"initParityConfigs",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"acceptedCodecIds",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"String",
"s",
":",
"conf",
".",
"get",
"(",
"\"dfs.f4.accepted.codecs\"",
",",
"\... | This function initializes configuration for the supported parities.
Currently, we support RS and XOR. Those two can have different
configurations individually. Respective configurations will be used when
placing the parity files. There is one exception. The stripe length is
calculated based on the maximum of the strip... | [
"This",
"function",
"initializes",
"configuration",
"for",
"the",
"supported",
"parities",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/FaultTolerantBlockPlacementPolicy.java#L106-L127 |
118,325 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/FaultTolerantBlockPlacementPolicy.java | FaultTolerantBlockPlacementPolicy.getRackToHostsMapForStripe | private HashMap<String, HashSet<Node>> getRackToHostsMapForStripe(
String srcFileName,
String parityFileName,
int stripeLen,
int parityLen,
int stripeIndex) throws IOException {
HashMap<String, HashSet<Node>> rackToHosts =
new HashMap<String, HashSet<Node>>();
if (srcFileName... | java | private HashMap<String, HashSet<Node>> getRackToHostsMapForStripe(
String srcFileName,
String parityFileName,
int stripeLen,
int parityLen,
int stripeIndex) throws IOException {
HashMap<String, HashSet<Node>> rackToHosts =
new HashMap<String, HashSet<Node>>();
if (srcFileName... | [
"private",
"HashMap",
"<",
"String",
",",
"HashSet",
"<",
"Node",
">",
">",
"getRackToHostsMapForStripe",
"(",
"String",
"srcFileName",
",",
"String",
"parityFileName",
",",
"int",
"stripeLen",
",",
"int",
"parityLen",
",",
"int",
"stripeIndex",
")",
"throws",
... | reside and the hosts within those racks that host those blocks | [
"reside",
"and",
"the",
"hosts",
"within",
"those",
"racks",
"that",
"host",
"those",
"blocks"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/FaultTolerantBlockPlacementPolicy.java#L416-L453 |
118,326 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/FaultTolerantBlockPlacementPolicy.java | FaultTolerantBlockPlacementPolicy.getGoodNode | private boolean getGoodNode(
HashMap<String, HashSet<Node>> candidateNodesByRacks,
boolean considerLoad,
long blockSize,
List<DatanodeDescriptor> results) {
List<Map.Entry<String, HashSet<Node>>> sorted =
new ArrayList<Map.Entry<String, HashSet<Node>>>();
for (Map.Entry<String, Has... | java | private boolean getGoodNode(
HashMap<String, HashSet<Node>> candidateNodesByRacks,
boolean considerLoad,
long blockSize,
List<DatanodeDescriptor> results) {
List<Map.Entry<String, HashSet<Node>>> sorted =
new ArrayList<Map.Entry<String, HashSet<Node>>>();
for (Map.Entry<String, Has... | [
"private",
"boolean",
"getGoodNode",
"(",
"HashMap",
"<",
"String",
",",
"HashSet",
"<",
"Node",
">",
">",
"candidateNodesByRacks",
",",
"boolean",
"considerLoad",
",",
"long",
"blockSize",
",",
"List",
"<",
"DatanodeDescriptor",
">",
"results",
")",
"{",
"Lis... | Helper function to choose less occupied racks first. | [
"Helper",
"function",
"to",
"choose",
"less",
"occupied",
"racks",
"first",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/FaultTolerantBlockPlacementPolicy.java#L611-L631 |
118,327 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/FaultTolerantBlockPlacementPolicy.java | FaultTolerantBlockPlacementPolicy.getGoodNode | private boolean getGoodNode(Set<Node> candidateNodes,
boolean considerLoad,
long blockSize,
List<DatanodeDescriptor> results) {
List<DatanodeDescriptor> sorted = new ArrayList<DatanodeDescriptor>();
for (Node n : candidate... | java | private boolean getGoodNode(Set<Node> candidateNodes,
boolean considerLoad,
long blockSize,
List<DatanodeDescriptor> results) {
List<DatanodeDescriptor> sorted = new ArrayList<DatanodeDescriptor>();
for (Node n : candidate... | [
"private",
"boolean",
"getGoodNode",
"(",
"Set",
"<",
"Node",
">",
"candidateNodes",
",",
"boolean",
"considerLoad",
",",
"long",
"blockSize",
",",
"List",
"<",
"DatanodeDescriptor",
">",
"results",
")",
"{",
"List",
"<",
"DatanodeDescriptor",
">",
"sorted",
"... | Helper function to find a good node. Returns true if found. | [
"Helper",
"function",
"to",
"find",
"a",
"good",
"node",
".",
"Returns",
"true",
"if",
"found",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/FaultTolerantBlockPlacementPolicy.java#L634-L669 |
118,328 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarStorageSetup.java | AvatarStorageSetup.checkImageStorage | private static String checkImageStorage(URI sharedImage, URI sharedEdits) {
if (sharedImage.getScheme().equals(NNStorage.LOCAL_URI_SCHEME)) {
// shared image is stored in file storage
return "";
} else if (sharedImage.getScheme().equals(
QuorumJournalManager.QJM_URI_SCHEME)
&& shared... | java | private static String checkImageStorage(URI sharedImage, URI sharedEdits) {
if (sharedImage.getScheme().equals(NNStorage.LOCAL_URI_SCHEME)) {
// shared image is stored in file storage
return "";
} else if (sharedImage.getScheme().equals(
QuorumJournalManager.QJM_URI_SCHEME)
&& shared... | [
"private",
"static",
"String",
"checkImageStorage",
"(",
"URI",
"sharedImage",
",",
"URI",
"sharedEdits",
")",
"{",
"if",
"(",
"sharedImage",
".",
"getScheme",
"(",
")",
".",
"equals",
"(",
"NNStorage",
".",
"LOCAL_URI_SCHEME",
")",
")",
"{",
"// shared image ... | Shared image needs to be in file storage, or QJM providing that QJM also
stores edits. | [
"Shared",
"image",
"needs",
"to",
"be",
"in",
"file",
"storage",
"or",
"QJM",
"providing",
"that",
"QJM",
"also",
"stores",
"edits",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarStorageSetup.java#L123-L135 |
118,329 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarStorageSetup.java | AvatarStorageSetup.checkFileURIScheme | private static String checkFileURIScheme(Collection<URI> uris) {
for (URI uri : uris)
if (uri.getScheme().compareTo(JournalType.FILE.name().toLowerCase()) != 0)
return "The specified path is not a file."
+ "Avatar supports file non-shared storage only... ";
return "";
} | java | private static String checkFileURIScheme(Collection<URI> uris) {
for (URI uri : uris)
if (uri.getScheme().compareTo(JournalType.FILE.name().toLowerCase()) != 0)
return "The specified path is not a file."
+ "Avatar supports file non-shared storage only... ";
return "";
} | [
"private",
"static",
"String",
"checkFileURIScheme",
"(",
"Collection",
"<",
"URI",
">",
"uris",
")",
"{",
"for",
"(",
"URI",
"uri",
":",
"uris",
")",
"if",
"(",
"uri",
".",
"getScheme",
"(",
")",
".",
"compareTo",
"(",
"JournalType",
".",
"FILE",
".",... | For non-shared storage, we enforce file uris | [
"For",
"non",
"-",
"shared",
"storage",
"we",
"enforce",
"file",
"uris"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarStorageSetup.java#L140-L146 |
118,330 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FileImageManager.java | FileImageManager.getCheckpointOutputStream | @Override
public OutputStream getCheckpointOutputStream(long imageTxId) throws IOException {
String fileName = NNStorage.getCheckpointImageFileName(imageTxId);
return new FileOutputStream(new File(sd.getCurrentDir(), fileName));
} | java | @Override
public OutputStream getCheckpointOutputStream(long imageTxId) throws IOException {
String fileName = NNStorage.getCheckpointImageFileName(imageTxId);
return new FileOutputStream(new File(sd.getCurrentDir(), fileName));
} | [
"@",
"Override",
"public",
"OutputStream",
"getCheckpointOutputStream",
"(",
"long",
"imageTxId",
")",
"throws",
"IOException",
"{",
"String",
"fileName",
"=",
"NNStorage",
".",
"getCheckpointImageFileName",
"(",
"imageTxId",
")",
";",
"return",
"new",
"FileOutputStre... | Get file output stream | [
"Get",
"file",
"output",
"stream"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FileImageManager.java#L60-L64 |
118,331 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FileImageManager.java | FileImageManager.renameCheckpointInDir | private static void renameCheckpointInDir(StorageDirectory sd, long txid)
throws IOException {
File ckpt = NNStorage.getStorageFile(sd, NameNodeFile.IMAGE_NEW, txid);
File curFile = NNStorage.getStorageFile(sd, NameNodeFile.IMAGE, txid);
// renameTo fails on Windows if the destination file
// alr... | java | private static void renameCheckpointInDir(StorageDirectory sd, long txid)
throws IOException {
File ckpt = NNStorage.getStorageFile(sd, NameNodeFile.IMAGE_NEW, txid);
File curFile = NNStorage.getStorageFile(sd, NameNodeFile.IMAGE, txid);
// renameTo fails on Windows if the destination file
// alr... | [
"private",
"static",
"void",
"renameCheckpointInDir",
"(",
"StorageDirectory",
"sd",
",",
"long",
"txid",
")",
"throws",
"IOException",
"{",
"File",
"ckpt",
"=",
"NNStorage",
".",
"getStorageFile",
"(",
"sd",
",",
"NameNodeFile",
".",
"IMAGE_NEW",
",",
"txid",
... | Rolls checkpointed image. | [
"Rolls",
"checkpointed",
"image",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FileImageManager.java#L84-L98 |
118,332 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FileImageManager.java | FileImageManager.reportError | private void reportError(StorageDirectory sd) {
if (storage instanceof NNStorage) {
// pass null, since we handle the disable here
((NNStorage)storage).reportErrorsOnDirectory(sd, null);
} else {
LOG.error("Failed direcory: " + sd.getCurrentDir());
}
} | java | private void reportError(StorageDirectory sd) {
if (storage instanceof NNStorage) {
// pass null, since we handle the disable here
((NNStorage)storage).reportErrorsOnDirectory(sd, null);
} else {
LOG.error("Failed direcory: " + sd.getCurrentDir());
}
} | [
"private",
"void",
"reportError",
"(",
"StorageDirectory",
"sd",
")",
"{",
"if",
"(",
"storage",
"instanceof",
"NNStorage",
")",
"{",
"// pass null, since we handle the disable here",
"(",
"(",
"NNStorage",
")",
"storage",
")",
".",
"reportErrorsOnDirectory",
"(",
"... | Reports error to underlying storage. | [
"Reports",
"error",
"to",
"underlying",
"storage",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FileImageManager.java#L119-L126 |
118,333 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/PoolInfoMetrics.java | PoolInfoMetrics.getResourceMetadata | public ResourceMetadata getResourceMetadata() {
if (poolInfo.getPoolName() == null ||
!counters.containsKey(MetricName.MIN) ||
!counters.containsKey(MetricName.MAX) ||
!counters.containsKey(MetricName.GRANTED) ||
!counters.containsKey(MetricName.REQUESTED)) {
return null;
}... | java | public ResourceMetadata getResourceMetadata() {
if (poolInfo.getPoolName() == null ||
!counters.containsKey(MetricName.MIN) ||
!counters.containsKey(MetricName.MAX) ||
!counters.containsKey(MetricName.GRANTED) ||
!counters.containsKey(MetricName.REQUESTED)) {
return null;
}... | [
"public",
"ResourceMetadata",
"getResourceMetadata",
"(",
")",
"{",
"if",
"(",
"poolInfo",
".",
"getPoolName",
"(",
")",
"==",
"null",
"||",
"!",
"counters",
".",
"containsKey",
"(",
"MetricName",
".",
"MIN",
")",
"||",
"!",
"counters",
".",
"containsKey",
... | Get a snapshot of the resource metadata for this pool. Used for
collecting metrics. Will not collect resource metadata for PoolGroup
objects or if any counters are missing.
@return ResourceMetadata for this pool or null if the metrics are invalid. | [
"Get",
"a",
"snapshot",
"of",
"the",
"resource",
"metadata",
"for",
"this",
"pool",
".",
"Used",
"for",
"collecting",
"metrics",
".",
"Will",
"not",
"collect",
"resource",
"metadata",
"for",
"PoolGroup",
"objects",
"or",
"if",
"any",
"counters",
"are",
"miss... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/PoolInfoMetrics.java#L126-L141 |
118,334 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/PoolInfoMetrics.java | PoolInfoMetrics.updateMetricsRecord | public void updateMetricsRecord() {
for (Map.Entry<MetricName, Long> entry: counters.entrySet()) {
String name = (entry.getKey() + "_" + type).toLowerCase();
record.setMetric(name, entry.getValue());
}
record.update();
} | java | public void updateMetricsRecord() {
for (Map.Entry<MetricName, Long> entry: counters.entrySet()) {
String name = (entry.getKey() + "_" + type).toLowerCase();
record.setMetric(name, entry.getValue());
}
record.update();
} | [
"public",
"void",
"updateMetricsRecord",
"(",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"MetricName",
",",
"Long",
">",
"entry",
":",
"counters",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"name",
"=",
"(",
"entry",
".",
"getKey",
"(",
")",... | Update the metrics record associated with this object. | [
"Update",
"the",
"metrics",
"record",
"associated",
"with",
"this",
"object",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/PoolInfoMetrics.java#L146-L152 |
118,335 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/lib/Chain.java | Chain.configure | public void configure(JobConf jobConf) {
String prefix = getPrefix(isMap);
chainJobConf = jobConf;
SerializationFactory serializationFactory =
new SerializationFactory(chainJobConf);
int index = jobConf.getInt(prefix + CHAIN_MAPPER_SIZE, 0);
for (int i = 0; i < index; i++) {
Class<? exte... | java | public void configure(JobConf jobConf) {
String prefix = getPrefix(isMap);
chainJobConf = jobConf;
SerializationFactory serializationFactory =
new SerializationFactory(chainJobConf);
int index = jobConf.getInt(prefix + CHAIN_MAPPER_SIZE, 0);
for (int i = 0; i < index; i++) {
Class<? exte... | [
"public",
"void",
"configure",
"(",
"JobConf",
"jobConf",
")",
"{",
"String",
"prefix",
"=",
"getPrefix",
"(",
"isMap",
")",
";",
"chainJobConf",
"=",
"jobConf",
";",
"SerializationFactory",
"serializationFactory",
"=",
"new",
"SerializationFactory",
"(",
"chainJo... | Configures all the chain elements for the task.
@param jobConf chain job's JobConf. | [
"Configures",
"all",
"the",
"chain",
"elements",
"for",
"the",
"task",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/Chain.java#L319-L359 |
118,336 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/lib/Chain.java | Chain.close | public void close() throws IOException {
for (Mapper map : mappers) {
map.close();
}
if (reducer != null) {
reducer.close();
}
} | java | public void close() throws IOException {
for (Mapper map : mappers) {
map.close();
}
if (reducer != null) {
reducer.close();
}
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"for",
"(",
"Mapper",
"map",
":",
"mappers",
")",
"{",
"map",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"reducer",
"!=",
"null",
")",
"{",
"reducer",
".",
"close",
"(",
")",
";... | Closes all the chain elements.
@throws IOException thrown if any of the chain elements threw an
IOException exception. | [
"Closes",
"all",
"the",
"chain",
"elements",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/Chain.java#L428-L435 |
118,337 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java | NamenodeFsck.fsck | public void fsck() throws IOException {
InjectionHandler.processEvent(InjectionEvent.NAMENODE_FSCK_START);
try {
FileStatus[] files = nn.namesystem.dir.getListing(path);
FsckResult res = new FsckResult();
if (!this.showFiles && !this.showBlocks && !this.showLocations
&& !this.sh... | java | public void fsck() throws IOException {
InjectionHandler.processEvent(InjectionEvent.NAMENODE_FSCK_START);
try {
FileStatus[] files = nn.namesystem.dir.getListing(path);
FsckResult res = new FsckResult();
if (!this.showFiles && !this.showBlocks && !this.showLocations
&& !this.sh... | [
"public",
"void",
"fsck",
"(",
")",
"throws",
"IOException",
"{",
"InjectionHandler",
".",
"processEvent",
"(",
"InjectionEvent",
".",
"NAMENODE_FSCK_START",
")",
";",
"try",
"{",
"FileStatus",
"[",
"]",
"files",
"=",
"nn",
".",
"namesystem",
".",
"dir",
"."... | Check files on DFS, starting from the indicated path.
@throws Exception | [
"Check",
"files",
"on",
"DFS",
"starting",
"from",
"the",
"indicated",
"path",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java#L161-L209 |
118,338 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJTState.java | CoronaJTState.getPrettyReport | public String getPrettyReport(JobID jobId) {
Map<TaskAttemptID, TaskLaunch> lastLaunch =
new HashMap<TaskAttemptID, CoronaStateUpdate.TaskLaunch>();
Map<TaskAttemptID, TaskStatus.State> lastKnownStatus =
new HashMap<TaskAttemptID, TaskStatus.State>();
JTFailoverMetrics jtFailoverMetrics = ne... | java | public String getPrettyReport(JobID jobId) {
Map<TaskAttemptID, TaskLaunch> lastLaunch =
new HashMap<TaskAttemptID, CoronaStateUpdate.TaskLaunch>();
Map<TaskAttemptID, TaskStatus.State> lastKnownStatus =
new HashMap<TaskAttemptID, TaskStatus.State>();
JTFailoverMetrics jtFailoverMetrics = ne... | [
"public",
"String",
"getPrettyReport",
"(",
"JobID",
"jobId",
")",
"{",
"Map",
"<",
"TaskAttemptID",
",",
"TaskLaunch",
">",
"lastLaunch",
"=",
"new",
"HashMap",
"<",
"TaskAttemptID",
",",
"CoronaStateUpdate",
".",
"TaskLaunch",
">",
"(",
")",
";",
"Map",
"<... | Creates pretty report of saved state
@return string with report | [
"Creates",
"pretty",
"report",
"of",
"saved",
"state"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJTState.java#L99-L139 |
118,339 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Task.java | Task.getFileSystemCounterNames | protected static String[] getFileSystemCounterNames(String uriScheme) {
String scheme = uriScheme.toUpperCase();
return new String[]{scheme+"_BYTES_READ",
scheme+"_BYTES_WRITTEN",
scheme+"_FILES_CREATED",
scheme + "_BYTES_READ_LOCAL",
scheme + "_BYTES_READ... | java | protected static String[] getFileSystemCounterNames(String uriScheme) {
String scheme = uriScheme.toUpperCase();
return new String[]{scheme+"_BYTES_READ",
scheme+"_BYTES_WRITTEN",
scheme+"_FILES_CREATED",
scheme + "_BYTES_READ_LOCAL",
scheme + "_BYTES_READ... | [
"protected",
"static",
"String",
"[",
"]",
"getFileSystemCounterNames",
"(",
"String",
"uriScheme",
")",
"{",
"String",
"scheme",
"=",
"uriScheme",
".",
"toUpperCase",
"(",
")",
";",
"return",
"new",
"String",
"[",
"]",
"{",
"scheme",
"+",
"\"_BYTES_READ\"",
... | Counters to measure the usage of the different file systems.
Always return the String array with two elements. First one is the name of
BYTES_READ counter and second one is of the BYTES_WRITTEN counter. | [
"Counters",
"to",
"measure",
"the",
"usage",
"of",
"the",
"different",
"file",
"systems",
".",
"Always",
"return",
"the",
"String",
"array",
"with",
"two",
"elements",
".",
"First",
"one",
"is",
"the",
"name",
"of",
"BYTES_READ",
"counter",
"and",
"second",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Task.java#L142-L151 |
118,340 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Task.java | Task.reportNextRecordRange | protected void reportNextRecordRange(final TaskUmbilicalProtocol umbilical,
long nextRecIndex) throws IOException{
//currentRecStartIndex is the start index which has not yet been finished
//and is still in task's stomach.
long len = nextRecIndex - currentRecStartIndex +1;
SortedRanges.Range ran... | java | protected void reportNextRecordRange(final TaskUmbilicalProtocol umbilical,
long nextRecIndex) throws IOException{
//currentRecStartIndex is the start index which has not yet been finished
//and is still in task's stomach.
long len = nextRecIndex - currentRecStartIndex +1;
SortedRanges.Range ran... | [
"protected",
"void",
"reportNextRecordRange",
"(",
"final",
"TaskUmbilicalProtocol",
"umbilical",
",",
"long",
"nextRecIndex",
")",
"throws",
"IOException",
"{",
"//currentRecStartIndex is the start index which has not yet been finished ",
"//and is still in task's stomach.",
"long",... | Reports the next executing record range to TaskTracker.
@param umbilical
@param nextRecIndex the record index which would be fed next.
@throws IOException | [
"Reports",
"the",
"next",
"executing",
"record",
"range",
"to",
"TaskTracker",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Task.java#L789-L799 |
118,341 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Task.java | Task.updateGCcounters | void updateGCcounters(){
long gccount = 0;
long gctime = 0;
for(GarbageCollectorMXBean gc :
ManagementFactory.getGarbageCollectorMXBeans()) {
long count = gc.getCollectionCount();
if(count >= 0) {
gccount += count;
}
long time = gc.getCollectionTime... | java | void updateGCcounters(){
long gccount = 0;
long gctime = 0;
for(GarbageCollectorMXBean gc :
ManagementFactory.getGarbageCollectorMXBeans()) {
long count = gc.getCollectionCount();
if(count >= 0) {
gccount += count;
}
long time = gc.getCollectionTime... | [
"void",
"updateGCcounters",
"(",
")",
"{",
"long",
"gccount",
"=",
"0",
";",
"long",
"gctime",
"=",
"0",
";",
"for",
"(",
"GarbageCollectorMXBean",
"gc",
":",
"ManagementFactory",
".",
"getGarbageCollectorMXBeans",
"(",
")",
")",
"{",
"long",
"count",
"=",
... | Update counters about Garbage Collection | [
"Update",
"counters",
"about",
"Garbage",
"Collection"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Task.java#L804-L860 |
118,342 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Task.java | Task.updateResourceCounters | void updateResourceCounters() {
if (resourceCalculator == null) {
return;
}
ProcResourceValues res = resourceCalculator.getProcResourceValues();
long cpuTime = res.getCumulativeCpuTime();
long pMem = res.getPhysicalMemorySize();
long vMem = res.getVirtualMemorySize();
long cpuJvmTime =... | java | void updateResourceCounters() {
if (resourceCalculator == null) {
return;
}
ProcResourceValues res = resourceCalculator.getProcResourceValues();
long cpuTime = res.getCumulativeCpuTime();
long pMem = res.getPhysicalMemorySize();
long vMem = res.getVirtualMemorySize();
long cpuJvmTime =... | [
"void",
"updateResourceCounters",
"(",
")",
"{",
"if",
"(",
"resourceCalculator",
"==",
"null",
")",
"{",
"return",
";",
"}",
"ProcResourceValues",
"res",
"=",
"resourceCalculator",
".",
"getProcResourceValues",
"(",
")",
";",
"long",
"cpuTime",
"=",
"res",
".... | Update resource information counters | [
"Update",
"resource",
"information",
"counters"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Task.java#L866-L888 |
118,343 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Task.java | Task.loadStaticResolutions | public static void loadStaticResolutions(Configuration conf) {
String hostToResolved[] = conf.getStrings("hadoop.net.static.resolutions");
if (hostToResolved != null) {
for (String str : hostToResolved) {
String name = str.substring(0, str.indexOf('='));
String resolvedName = str.substring... | java | public static void loadStaticResolutions(Configuration conf) {
String hostToResolved[] = conf.getStrings("hadoop.net.static.resolutions");
if (hostToResolved != null) {
for (String str : hostToResolved) {
String name = str.substring(0, str.indexOf('='));
String resolvedName = str.substring... | [
"public",
"static",
"void",
"loadStaticResolutions",
"(",
"Configuration",
"conf",
")",
"{",
"String",
"hostToResolved",
"[",
"]",
"=",
"conf",
".",
"getStrings",
"(",
"\"hadoop.net.static.resolutions\"",
")",
";",
"if",
"(",
"hostToResolved",
"!=",
"null",
")",
... | Load the static resolutions from configuration. This is required for junit
to work on testcases that simulate multiple nodes on a single physical
node.
@param conf The configuration. | [
"Load",
"the",
"static",
"resolutions",
"from",
"configuration",
".",
"This",
"is",
"required",
"for",
"junit",
"to",
"work",
"on",
"testcases",
"that",
"simulate",
"multiple",
"nodes",
"on",
"a",
"single",
"physical",
"node",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Task.java#L1230-L1239 |
118,344 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Task.java | Task.saveStaticResolutions | public static boolean saveStaticResolutions(Configuration conf) {
List<String[]> staticResolutions = NetUtils.getAllStaticResolutions();
if (staticResolutions != null && staticResolutions.size() > 0) {
StringBuffer str = new StringBuffer();
for (int i = 0; i < staticResolutions.size(); i++) {
... | java | public static boolean saveStaticResolutions(Configuration conf) {
List<String[]> staticResolutions = NetUtils.getAllStaticResolutions();
if (staticResolutions != null && staticResolutions.size() > 0) {
StringBuffer str = new StringBuffer();
for (int i = 0; i < staticResolutions.size(); i++) {
... | [
"public",
"static",
"boolean",
"saveStaticResolutions",
"(",
"Configuration",
"conf",
")",
"{",
"List",
"<",
"String",
"[",
"]",
">",
"staticResolutions",
"=",
"NetUtils",
".",
"getAllStaticResolutions",
"(",
")",
";",
"if",
"(",
"staticResolutions",
"!=",
"null... | Save the static resolutions to configuration. This is required for junit
to work on testcases that simulate multiple nodes on a single physical
node.
@param conf The configuration
@return A boolean indicating if the configuration was modified. | [
"Save",
"the",
"static",
"resolutions",
"to",
"configuration",
".",
"This",
"is",
"required",
"for",
"junit",
"to",
"work",
"on",
"testcases",
"that",
"simulate",
"multiple",
"nodes",
"on",
"a",
"single",
"physical",
"node",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Task.java#L1248-L1264 |
118,345 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java | ResourceTracker.getResourceUsage | public ResourceUsage getResourceUsage() {
int totalMapperGrants = 0;
int totalReducerGrants = 0;
synchronized (lockObject) {
for (Map.Entry<Integer, ResourceGrant> entry :
grantedResources.entrySet()) {
switch(entry.getValue().getType()) {
case MAP:
++totalMapperGra... | java | public ResourceUsage getResourceUsage() {
int totalMapperGrants = 0;
int totalReducerGrants = 0;
synchronized (lockObject) {
for (Map.Entry<Integer, ResourceGrant> entry :
grantedResources.entrySet()) {
switch(entry.getValue().getType()) {
case MAP:
++totalMapperGra... | [
"public",
"ResourceUsage",
"getResourceUsage",
"(",
")",
"{",
"int",
"totalMapperGrants",
"=",
"0",
";",
"int",
"totalReducerGrants",
"=",
"0",
";",
"synchronized",
"(",
"lockObject",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"ResourceG... | Get a snapshot of the resource usage.
@return Snapshot of resource usage | [
"Get",
"a",
"snapshot",
"of",
"the",
"resource",
"usage",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java#L120-L143 |
118,346 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java | ResourceTracker.getWantedResources | public List<ResourceRequest> getWantedResources() {
List<ResourceRequest> wanted = new ArrayList<ResourceRequest>();
synchronized(lockObject) {
for (Integer requestId:
setDifference(requestMap.keySet(), requestedResources.keySet())) {
ResourceRequest req = requestMap.get(requestId);
... | java | public List<ResourceRequest> getWantedResources() {
List<ResourceRequest> wanted = new ArrayList<ResourceRequest>();
synchronized(lockObject) {
for (Integer requestId:
setDifference(requestMap.keySet(), requestedResources.keySet())) {
ResourceRequest req = requestMap.get(requestId);
... | [
"public",
"List",
"<",
"ResourceRequest",
">",
"getWantedResources",
"(",
")",
"{",
"List",
"<",
"ResourceRequest",
">",
"wanted",
"=",
"new",
"ArrayList",
"<",
"ResourceRequest",
">",
"(",
")",
";",
"synchronized",
"(",
"lockObject",
")",
"{",
"for",
"(",
... | Find what new requests need to be sent by finding out resources needed
by tasks but not sent to Cluster Manager.
@return | [
"Find",
"what",
"new",
"requests",
"need",
"to",
"be",
"sent",
"by",
"finding",
"out",
"resources",
"needed",
"by",
"tasks",
"but",
"not",
"sent",
"to",
"Cluster",
"Manager",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java#L150-L162 |
118,347 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java | ResourceTracker.getResourcesToRelease | public List<ResourceRequest> getResourcesToRelease() {
List<ResourceRequest> release = new ArrayList<ResourceRequest>();
synchronized(lockObject) {
for (Integer requestId:
setDifference(requestedResources.keySet(), requestMap.keySet())) {
// We update the data structures right away. This a... | java | public List<ResourceRequest> getResourcesToRelease() {
List<ResourceRequest> release = new ArrayList<ResourceRequest>();
synchronized(lockObject) {
for (Integer requestId:
setDifference(requestedResources.keySet(), requestMap.keySet())) {
// We update the data structures right away. This a... | [
"public",
"List",
"<",
"ResourceRequest",
">",
"getResourcesToRelease",
"(",
")",
"{",
"List",
"<",
"ResourceRequest",
">",
"release",
"=",
"new",
"ArrayList",
"<",
"ResourceRequest",
">",
"(",
")",
";",
"synchronized",
"(",
"lockObject",
")",
"{",
"for",
"(... | Go through all the requested resources and find what needs to be released.
@return | [
"Go",
"through",
"all",
"the",
"requested",
"resources",
"and",
"find",
"what",
"needs",
"to",
"be",
"released",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java#L168-L183 |
118,348 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java | ResourceTracker.releaseResource | public void releaseResource(int resourceId) {
synchronized (lockObject) {
ResourceRequest req = requestedResources.get(resourceId);
removeRequestUnprotected(req);
}
} | java | public void releaseResource(int resourceId) {
synchronized (lockObject) {
ResourceRequest req = requestedResources.get(resourceId);
removeRequestUnprotected(req);
}
} | [
"public",
"void",
"releaseResource",
"(",
"int",
"resourceId",
")",
"{",
"synchronized",
"(",
"lockObject",
")",
"{",
"ResourceRequest",
"req",
"=",
"requestedResources",
".",
"get",
"(",
"resourceId",
")",
";",
"removeRequestUnprotected",
"(",
"req",
")",
";",
... | Release the resource that was requested | [
"Release",
"the",
"resource",
"that",
"was",
"requested"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java#L206-L211 |
118,349 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java | ResourceTracker.addNewGrants | public void addNewGrants(List<ResourceGrant> grants) {
int numGranted = 0;
int numAvailable = 0;
synchronized(lockObject) {
for (ResourceGrant grant: grants) {
Integer requestId = grant.getId();
if (!requestedResources.containsKey(requestId) ||
!requestMap.containsKey(reque... | java | public void addNewGrants(List<ResourceGrant> grants) {
int numGranted = 0;
int numAvailable = 0;
synchronized(lockObject) {
for (ResourceGrant grant: grants) {
Integer requestId = grant.getId();
if (!requestedResources.containsKey(requestId) ||
!requestMap.containsKey(reque... | [
"public",
"void",
"addNewGrants",
"(",
"List",
"<",
"ResourceGrant",
">",
"grants",
")",
"{",
"int",
"numGranted",
"=",
"0",
";",
"int",
"numAvailable",
"=",
"0",
";",
"synchronized",
"(",
"lockObject",
")",
"{",
"for",
"(",
"ResourceGrant",
"grant",
":",
... | Obtained new grants from Cluster Manager.
@param grants | [
"Obtained",
"new",
"grants",
"from",
"Cluster",
"Manager",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java#L227-L251 |
118,350 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java | ResourceTracker.updateTrackerAddr | public void updateTrackerAddr(String trackerName, InetAddress addr) {
synchronized (lockObject) {
trackerAddress.put(trackerName, addr);
}
} | java | public void updateTrackerAddr(String trackerName, InetAddress addr) {
synchronized (lockObject) {
trackerAddress.put(trackerName, addr);
}
} | [
"public",
"void",
"updateTrackerAddr",
"(",
"String",
"trackerName",
",",
"InetAddress",
"addr",
")",
"{",
"synchronized",
"(",
"lockObject",
")",
"{",
"trackerAddress",
".",
"put",
"(",
"trackerName",
",",
"addr",
")",
";",
"}",
"}"
] | Updates mapping between tracker names and adresses
@param trackerName name of tracker
@param addr address of the tracker | [
"Updates",
"mapping",
"between",
"tracker",
"names",
"and",
"adresses"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java#L347-L351 |
118,351 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/ipc/Server.java | Server.getRemoteIp | public static InetAddress getRemoteIp() {
Call call = CurCall.get();
if (call != null) {
return call.connection.socket.getInetAddress();
}
return null;
} | java | public static InetAddress getRemoteIp() {
Call call = CurCall.get();
if (call != null) {
return call.connection.socket.getInetAddress();
}
return null;
} | [
"public",
"static",
"InetAddress",
"getRemoteIp",
"(",
")",
"{",
"Call",
"call",
"=",
"CurCall",
".",
"get",
"(",
")",
";",
"if",
"(",
"call",
"!=",
"null",
")",
"{",
"return",
"call",
".",
"connection",
".",
"socket",
".",
"getInetAddress",
"(",
")",
... | Returns the remote side ip address when invoked inside an RPC
Returns null incase of an error. | [
"Returns",
"the",
"remote",
"side",
"ip",
"address",
"when",
"invoked",
"inside",
"an",
"RPC",
"Returns",
"null",
"incase",
"of",
"an",
"error",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/Server.java#L175-L181 |
118,352 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/ipc/Server.java | Server.getCurrentUGI | public static UserGroupInformation getCurrentUGI() {
try {
// Check original caller's UGI in case call went through proxy
UserGroupInformation origUGI = OrigUGI.get();
if (origUGI != null) {
return origUGI;
}
// If original caller's UGI is not set then we get the UGI of connect... | java | public static UserGroupInformation getCurrentUGI() {
try {
// Check original caller's UGI in case call went through proxy
UserGroupInformation origUGI = OrigUGI.get();
if (origUGI != null) {
return origUGI;
}
// If original caller's UGI is not set then we get the UGI of connect... | [
"public",
"static",
"UserGroupInformation",
"getCurrentUGI",
"(",
")",
"{",
"try",
"{",
"// Check original caller's UGI in case call went through proxy",
"UserGroupInformation",
"origUGI",
"=",
"OrigUGI",
".",
"get",
"(",
")",
";",
"if",
"(",
"origUGI",
"!=",
"null",
... | Gives access to the subject of the current call. | [
"Gives",
"access",
"to",
"the",
"subject",
"of",
"the",
"current",
"call",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/Server.java#L194-L208 |
118,353 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/ipc/Server.java | Server.delayResponse | public static long delayResponse() {
Call call = CurCall.get();
long res = 0;
if (call != null) {
call.delayResponse();
res = delayedRpcId.getAndIncrement();
delayedCalls.put(res, call);
}
return res;
} | java | public static long delayResponse() {
Call call = CurCall.get();
long res = 0;
if (call != null) {
call.delayResponse();
res = delayedRpcId.getAndIncrement();
delayedCalls.put(res, call);
}
return res;
} | [
"public",
"static",
"long",
"delayResponse",
"(",
")",
"{",
"Call",
"call",
"=",
"CurCall",
".",
"get",
"(",
")",
";",
"long",
"res",
"=",
"0",
";",
"if",
"(",
"call",
"!=",
"null",
")",
"{",
"call",
".",
"delayResponse",
"(",
")",
";",
"res",
"=... | If invoked from the RPC handling code will mark this call as
delayed response. It returns the id of the delayed call.
The response will only be sent once sendDelayedResponse method
is called with the id returned from this one.
@return id of the delayed response. | [
"If",
"invoked",
"from",
"the",
"RPC",
"handling",
"code",
"will",
"mark",
"this",
"call",
"as",
"delayed",
"response",
".",
"It",
"returns",
"the",
"id",
"of",
"the",
"delayed",
"call",
".",
"The",
"response",
"will",
"only",
"be",
"sent",
"once",
"send... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/Server.java#L224-L233 |
118,354 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/ipc/Server.java | Server.getRemoteAddress | public static String getRemoteAddress() {
InetAddress addr = getRemoteIp();
return (addr == null) ? null : addr.getHostAddress();
} | java | public static String getRemoteAddress() {
InetAddress addr = getRemoteIp();
return (addr == null) ? null : addr.getHostAddress();
} | [
"public",
"static",
"String",
"getRemoteAddress",
"(",
")",
"{",
"InetAddress",
"addr",
"=",
"getRemoteIp",
"(",
")",
";",
"return",
"(",
"addr",
"==",
"null",
")",
"?",
"null",
":",
"addr",
".",
"getHostAddress",
"(",
")",
";",
"}"
] | Returns remote address as a string when invoked inside an RPC.
Returns null in case of an error. | [
"Returns",
"remote",
"address",
"as",
"a",
"string",
"when",
"invoked",
"inside",
"an",
"RPC",
".",
"Returns",
"null",
"in",
"case",
"of",
"an",
"error",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/Server.java#L244-L247 |
118,355 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/ipc/Server.java | Server.bind | public static void bind(ServerSocket socket, InetSocketAddress address,
int backlog) throws IOException {
try {
socket.bind(address, backlog);
} catch (BindException e) {
BindException bindException = new BindException("Problem binding to " + address
... | java | public static void bind(ServerSocket socket, InetSocketAddress address,
int backlog) throws IOException {
try {
socket.bind(address, backlog);
} catch (BindException e) {
BindException bindException = new BindException("Problem binding to " + address
... | [
"public",
"static",
"void",
"bind",
"(",
"ServerSocket",
"socket",
",",
"InetSocketAddress",
"address",
",",
"int",
"backlog",
")",
"throws",
"IOException",
"{",
"try",
"{",
"socket",
".",
"bind",
"(",
"address",
",",
"backlog",
")",
";",
"}",
"catch",
"("... | A convenience method to bind to a given address and report
better exceptions if the address is not a valid host.
@param socket the socket to bind
@param address the address to bind to
@param backlog the number of connections allowed in the queue
@throws BindException if the address can't be bound
@throws UnknownHostExc... | [
"A",
"convenience",
"method",
"to",
"bind",
"to",
"a",
"given",
"address",
"and",
"report",
"better",
"exceptions",
"if",
"the",
"address",
"is",
"not",
"a",
"valid",
"host",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/Server.java#L295-L314 |
118,356 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/ipc/Server.java | Server.start | public synchronized void start() throws IOException {
if (responder.isAlive()) {
// The server is already running
return;
}
responder.start();
listener.start();
handlers = new Handler[handlerCount];
for (int i = 0; i < handlerCount; i++) {
handlers[i] = new Handler(i);
h... | java | public synchronized void start() throws IOException {
if (responder.isAlive()) {
// The server is already running
return;
}
responder.start();
listener.start();
handlers = new Handler[handlerCount];
for (int i = 0; i < handlerCount; i++) {
handlers[i] = new Handler(i);
h... | [
"public",
"synchronized",
"void",
"start",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"responder",
".",
"isAlive",
"(",
")",
")",
"{",
"// The server is already running",
"return",
";",
"}",
"responder",
".",
"start",
"(",
")",
";",
"listener",
".",
... | Starts the service. Must be called before any calls will be handled. | [
"Starts",
"the",
"service",
".",
"Must",
"be",
"called",
"before",
"any",
"calls",
"will",
"be",
"handled",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/Server.java#L1460-L1473 |
118,357 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/ipc/Server.java | Server.waitForHandlers | public synchronized void waitForHandlers() throws InterruptedException {
if (handlers != null) {
for (int i = 0; i < handlerCount; i++) {
if (handlers[i] != null) {
handlers[i].join();
}
}
}
} | java | public synchronized void waitForHandlers() throws InterruptedException {
if (handlers != null) {
for (int i = 0; i < handlerCount; i++) {
if (handlers[i] != null) {
handlers[i].join();
}
}
}
} | [
"public",
"synchronized",
"void",
"waitForHandlers",
"(",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"handlers",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"handlerCount",
";",
"i",
"++",
")",
"{",
"if",
"(",
... | Waits for all RPC handlers to exit. This ensures that no further RPC
calls would be processed by this server. | [
"Waits",
"for",
"all",
"RPC",
"handlers",
"to",
"exit",
".",
"This",
"ensures",
"that",
"no",
"further",
"RPC",
"calls",
"would",
"be",
"processed",
"by",
"this",
"server",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/Server.java#L1479-L1487 |
118,358 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/ipc/Server.java | Server.call | @Deprecated
public Writable call(Writable param, long receiveTime) throws IOException {
return call(null, param, receiveTime);
} | java | @Deprecated
public Writable call(Writable param, long receiveTime) throws IOException {
return call(null, param, receiveTime);
} | [
"@",
"Deprecated",
"public",
"Writable",
"call",
"(",
"Writable",
"param",
",",
"long",
"receiveTime",
")",
"throws",
"IOException",
"{",
"return",
"call",
"(",
"null",
",",
"param",
",",
"receiveTime",
")",
";",
"}"
] | Called for each call.
@deprecated Use {@link #call(Class, Writable, long)} instead | [
"Called",
"for",
"each",
"call",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/Server.java#L1550-L1553 |
118,359 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java | JournalNode.getJournals | synchronized Collection<Journal> getJournals() {
Collection<Journal> journals = new ArrayList<Journal>();
for (Journal j : journalsById.values()) {
journals.add(j);
}
return journals;
} | java | synchronized Collection<Journal> getJournals() {
Collection<Journal> journals = new ArrayList<Journal>();
for (Journal j : journalsById.values()) {
journals.add(j);
}
return journals;
} | [
"synchronized",
"Collection",
"<",
"Journal",
">",
"getJournals",
"(",
")",
"{",
"Collection",
"<",
"Journal",
">",
"journals",
"=",
"new",
"ArrayList",
"<",
"Journal",
">",
"(",
")",
";",
"for",
"(",
"Journal",
"j",
":",
"journalsById",
".",
"values",
"... | Get journals managed by this journal node. | [
"Get",
"journals",
"managed",
"by",
"this",
"journal",
"node",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java#L90-L96 |
118,360 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java | JournalNode.start | public void start() throws IOException {
Preconditions.checkState(!isStarted(), "JN already running");
journalNodes = getJournalHttpAddresses(conf);
// crash the JournalNode if the DFS_JOURNALNODE_HOSTS is not configured.
if (journalNodes.isEmpty()) {
String msg = JournalConfigKeys.DFS_JOURNAL... | java | public void start() throws IOException {
Preconditions.checkState(!isStarted(), "JN already running");
journalNodes = getJournalHttpAddresses(conf);
// crash the JournalNode if the DFS_JOURNALNODE_HOSTS is not configured.
if (journalNodes.isEmpty()) {
String msg = JournalConfigKeys.DFS_JOURNAL... | [
"public",
"void",
"start",
"(",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"isStarted",
"(",
")",
",",
"\"JN already running\"",
")",
";",
"journalNodes",
"=",
"getJournalHttpAddresses",
"(",
"conf",
")",
";",
"// crash the ... | Start listening for edits via RPC. | [
"Start",
"listening",
"for",
"edits",
"via",
"RPC",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java#L158-L188 |
118,361 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java | JournalNode.stop | public void stop(int rc) {
this.resultCode = rc;
LOG.info("Stopping Journal Node: " + this);
if (rpcServer != null) {
rpcServer.stop();
rpcServer = null;
}
if (httpServer != null) {
try {
httpServer.stop();
} catch (IOException ioe) {
LOG.warn("Unable t... | java | public void stop(int rc) {
this.resultCode = rc;
LOG.info("Stopping Journal Node: " + this);
if (rpcServer != null) {
rpcServer.stop();
rpcServer = null;
}
if (httpServer != null) {
try {
httpServer.stop();
} catch (IOException ioe) {
LOG.warn("Unable t... | [
"public",
"void",
"stop",
"(",
"int",
"rc",
")",
"{",
"this",
".",
"resultCode",
"=",
"rc",
";",
"LOG",
".",
"info",
"(",
"\"Stopping Journal Node: \"",
"+",
"this",
")",
";",
"if",
"(",
"rpcServer",
"!=",
"null",
")",
"{",
"rpcServer",
".",
"stop",
... | Stop the daemon with the given status code
@param rc the status code with which to exit (non-zero
should indicate an error) | [
"Stop",
"the",
"daemon",
"with",
"the",
"given",
"status",
"code"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java#L212-L240 |
118,362 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java | JournalNode.getJournalDir | private File getJournalDir(String jid) {
String dir = conf.get(JournalConfigKeys.DFS_JOURNALNODE_DIR_KEY,
JournalConfigKeys.DFS_JOURNALNODE_DIR_DEFAULT);
Preconditions.checkArgument(jid != null &&
!jid.isEmpty(),
"bad journal identifier: %s", jid);
return new File(new File(new File(d... | java | private File getJournalDir(String jid) {
String dir = conf.get(JournalConfigKeys.DFS_JOURNALNODE_DIR_KEY,
JournalConfigKeys.DFS_JOURNALNODE_DIR_DEFAULT);
Preconditions.checkArgument(jid != null &&
!jid.isEmpty(),
"bad journal identifier: %s", jid);
return new File(new File(new File(d... | [
"private",
"File",
"getJournalDir",
"(",
"String",
"jid",
")",
"{",
"String",
"dir",
"=",
"conf",
".",
"get",
"(",
"JournalConfigKeys",
".",
"DFS_JOURNALNODE_DIR_KEY",
",",
"JournalConfigKeys",
".",
"DFS_JOURNALNODE_DIR_DEFAULT",
")",
";",
"Preconditions",
".",
"c... | Return the directory inside our configured storage
dir which corresponds to a given journal.
@param jid the journal identifier
@return the file, which may or may not exist yet | [
"Return",
"the",
"directory",
"inside",
"our",
"configured",
"storage",
"dir",
"which",
"corresponds",
"to",
"a",
"given",
"journal",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java#L264-L271 |
118,363 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java | JournalNode.getJournalHttpAddresses | static List<InetSocketAddress> getJournalHttpAddresses(Configuration conf) {
String[] hosts = JournalConfigHelper.getJournalHttpHosts(conf);
List<InetSocketAddress> addrs = new ArrayList<InetSocketAddress>();
for (String host : hosts) {
addrs.add(NetUtils.createSocketAddr(host));
}
return addr... | java | static List<InetSocketAddress> getJournalHttpAddresses(Configuration conf) {
String[] hosts = JournalConfigHelper.getJournalHttpHosts(conf);
List<InetSocketAddress> addrs = new ArrayList<InetSocketAddress>();
for (String host : hosts) {
addrs.add(NetUtils.createSocketAddr(host));
}
return addr... | [
"static",
"List",
"<",
"InetSocketAddress",
">",
"getJournalHttpAddresses",
"(",
"Configuration",
"conf",
")",
"{",
"String",
"[",
"]",
"hosts",
"=",
"JournalConfigHelper",
".",
"getJournalHttpHosts",
"(",
"conf",
")",
";",
"List",
"<",
"InetSocketAddress",
">",
... | Get the list of journal addresses to connect.
Consistent with the QuorumJournalManager.getHttpAddresses. | [
"Get",
"the",
"list",
"of",
"journal",
"addresses",
"to",
"connect",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java#L333-L340 |
118,364 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/ByteWritable.java | ByteWritable.compareTo | public int compareTo(Object o) {
int thisValue = this.value;
int thatValue = ((ByteWritable)o).value;
return (thisValue < thatValue ? -1 : (thisValue == thatValue ? 0 : 1));
} | java | public int compareTo(Object o) {
int thisValue = this.value;
int thatValue = ((ByteWritable)o).value;
return (thisValue < thatValue ? -1 : (thisValue == thatValue ? 0 : 1));
} | [
"public",
"int",
"compareTo",
"(",
"Object",
"o",
")",
"{",
"int",
"thisValue",
"=",
"this",
".",
"value",
";",
"int",
"thatValue",
"=",
"(",
"(",
"ByteWritable",
")",
"o",
")",
".",
"value",
";",
"return",
"(",
"thisValue",
"<",
"thatValue",
"?",
"-... | Compares two ByteWritables. | [
"Compares",
"two",
"ByteWritables",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/ByteWritable.java#L59-L63 |
118,365 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/security/SecurityUtil.java | SecurityUtil.setPolicy | public static void setPolicy(Policy policy) {
if (LOG.isDebugEnabled()) {
LOG.debug("Setting Hadoop security policy");
}
Policy.setPolicy(policy);
} | java | public static void setPolicy(Policy policy) {
if (LOG.isDebugEnabled()) {
LOG.debug("Setting Hadoop security policy");
}
Policy.setPolicy(policy);
} | [
"public",
"static",
"void",
"setPolicy",
"(",
"Policy",
"policy",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Setting Hadoop security policy\"",
")",
";",
"}",
"Policy",
".",
"setPolicy",
"(",
"policy... | Set the global security policy for Hadoop.
@param policy {@link Policy} used for authorization. | [
"Set",
"the",
"global",
"security",
"policy",
"for",
"Hadoop",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/security/SecurityUtil.java#L49-L54 |
118,366 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/pipes/PipesReducer.java | PipesReducer.reduce | public void reduce(K2 key, Iterator<V2> values,
OutputCollector<K3, V3> output, Reporter reporter
) throws IOException {
isOk = false;
startApplication(output, reporter);
downlink.reduceKey(key);
while (values.hasNext()) {
downlink.reduceValue(values.next... | java | public void reduce(K2 key, Iterator<V2> values,
OutputCollector<K3, V3> output, Reporter reporter
) throws IOException {
isOk = false;
startApplication(output, reporter);
downlink.reduceKey(key);
while (values.hasNext()) {
downlink.reduceValue(values.next... | [
"public",
"void",
"reduce",
"(",
"K2",
"key",
",",
"Iterator",
"<",
"V2",
">",
"values",
",",
"OutputCollector",
"<",
"K3",
",",
"V3",
">",
"output",
",",
"Reporter",
"reporter",
")",
"throws",
"IOException",
"{",
"isOk",
"=",
"false",
";",
"startApplica... | Process all of the keys and values. Start up the application if we haven't
started it yet. | [
"Process",
"all",
"of",
"the",
"keys",
"and",
"values",
".",
"Start",
"up",
"the",
"application",
"if",
"we",
"haven",
"t",
"started",
"it",
"yet",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/pipes/PipesReducer.java#L59-L74 |
118,367 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/pipes/PipesReducer.java | PipesReducer.close | public void close() throws IOException {
// if we haven't started the application, we have nothing to do
if (isOk) {
OutputCollector<K3, V3> nullCollector = new OutputCollector<K3, V3>() {
public void collect(K3 key,
V3 value) throws IOException {
// NULL
... | java | public void close() throws IOException {
// if we haven't started the application, we have nothing to do
if (isOk) {
OutputCollector<K3, V3> nullCollector = new OutputCollector<K3, V3>() {
public void collect(K3 key,
V3 value) throws IOException {
// NULL
... | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"// if we haven't started the application, we have nothing to do",
"if",
"(",
"isOk",
")",
"{",
"OutputCollector",
"<",
"K3",
",",
"V3",
">",
"nullCollector",
"=",
"new",
"OutputCollector",
"<",
"K3"... | Handle the end of the input by closing down the application. | [
"Handle",
"the",
"end",
"of",
"the",
"input",
"by",
"closing",
"down",
"the",
"application",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/pipes/PipesReducer.java#L98-L124 |
118,368 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/MapTask.java | MapTask.updateJobWithSplit | private void updateJobWithSplit(final JobConf job, InputSplit inputSplit) {
if (inputSplit instanceof FileSplit) {
FileSplit fileSplit = (FileSplit) inputSplit;
job.set("map.input.file", fileSplit.getPath().toString());
job.setLong("map.input.start", fileSplit.getStart());
job.setLong("map.i... | java | private void updateJobWithSplit(final JobConf job, InputSplit inputSplit) {
if (inputSplit instanceof FileSplit) {
FileSplit fileSplit = (FileSplit) inputSplit;
job.set("map.input.file", fileSplit.getPath().toString());
job.setLong("map.input.start", fileSplit.getStart());
job.setLong("map.i... | [
"private",
"void",
"updateJobWithSplit",
"(",
"final",
"JobConf",
"job",
",",
"InputSplit",
"inputSplit",
")",
"{",
"if",
"(",
"inputSplit",
"instanceof",
"FileSplit",
")",
"{",
"FileSplit",
"fileSplit",
"=",
"(",
"FileSplit",
")",
"inputSplit",
";",
"job",
".... | Update the job with details about the file split
@param job the job configuration to update
@param inputSplit the file split | [
"Update",
"the",
"job",
"with",
"details",
"about",
"the",
"file",
"split"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/MapTask.java#L383-L391 |
118,369 | facebookarchive/hadoop-20 | src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/CapacityTaskScheduler.java | CapacityTaskScheduler.jobAdded | synchronized void jobAdded(JobInProgress job) throws IOException {
QueueSchedulingInfo qsi =
queueInfoMap.get(job.getProfile().getQueueName());
// qsi shouldn't be null
// update user-specific info
Integer i = qsi.numJobsByUser.get(job.getProfile().getUser());
if (null == i) {
i = 1;
... | java | synchronized void jobAdded(JobInProgress job) throws IOException {
QueueSchedulingInfo qsi =
queueInfoMap.get(job.getProfile().getQueueName());
// qsi shouldn't be null
// update user-specific info
Integer i = qsi.numJobsByUser.get(job.getProfile().getUser());
if (null == i) {
i = 1;
... | [
"synchronized",
"void",
"jobAdded",
"(",
"JobInProgress",
"job",
")",
"throws",
"IOException",
"{",
"QueueSchedulingInfo",
"qsi",
"=",
"queueInfoMap",
".",
"get",
"(",
"job",
".",
"getProfile",
"(",
")",
".",
"getQueueName",
"(",
")",
")",
";",
"// qsi shouldn... | called when a job is added | [
"called",
"when",
"a",
"job",
"is",
"added"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/CapacityTaskScheduler.java#L1405-L1429 |
118,370 | facebookarchive/hadoop-20 | src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/CapacityTaskScheduler.java | CapacityTaskScheduler.jobCompleted | synchronized void jobCompleted(JobInProgress job) {
QueueSchedulingInfo qsi =
queueInfoMap.get(job.getProfile().getQueueName());
// qsi shouldn't be null
// update numJobsByUser
LOG.debug("JOb to be removed for user " + job.getProfile().getUser());
Integer i = qsi.numJobsByUser.get(job.getPro... | java | synchronized void jobCompleted(JobInProgress job) {
QueueSchedulingInfo qsi =
queueInfoMap.get(job.getProfile().getQueueName());
// qsi shouldn't be null
// update numJobsByUser
LOG.debug("JOb to be removed for user " + job.getProfile().getUser());
Integer i = qsi.numJobsByUser.get(job.getPro... | [
"synchronized",
"void",
"jobCompleted",
"(",
"JobInProgress",
"job",
")",
"{",
"QueueSchedulingInfo",
"qsi",
"=",
"queueInfoMap",
".",
"get",
"(",
"job",
".",
"getProfile",
"(",
")",
".",
"getQueueName",
"(",
")",
")",
";",
"// qsi shouldn't be null",
"// update... | called when a job completes | [
"called",
"when",
"a",
"job",
"completes"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/CapacityTaskScheduler.java#L1451-L1471 |
118,371 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/OpenFileInfo.java | OpenFileInfo.write | public static void write(DataOutput out, OpenFileInfo elem) throws IOException {
OpenFileInfo info = new OpenFileInfo(elem.filePath, elem.millisOpen);
info.write(out);
} | java | public static void write(DataOutput out, OpenFileInfo elem) throws IOException {
OpenFileInfo info = new OpenFileInfo(elem.filePath, elem.millisOpen);
info.write(out);
} | [
"public",
"static",
"void",
"write",
"(",
"DataOutput",
"out",
",",
"OpenFileInfo",
"elem",
")",
"throws",
"IOException",
"{",
"OpenFileInfo",
"info",
"=",
"new",
"OpenFileInfo",
"(",
"elem",
".",
"filePath",
",",
"elem",
".",
"millisOpen",
")",
";",
"info",... | milliseconds that the file has been held open | [
"milliseconds",
"that",
"the",
"file",
"has",
"been",
"held",
"open"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/OpenFileInfo.java#L59-L62 |
118,372 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/ConfigManager.java | ConfigManager.reloadConfigIfNecessary | public void reloadConfigIfNecessary() {
if (whitelistFile == null) {
return;
}
long time = System.currentTimeMillis();
if (time > lastReloadAttempt + CONFIG_RELOAD_INTERVAL) {
lastReloadAttempt = time;
try {
File file = new File(whitelistFile);
long lastModified = file.... | java | public void reloadConfigIfNecessary() {
if (whitelistFile == null) {
return;
}
long time = System.currentTimeMillis();
if (time > lastReloadAttempt + CONFIG_RELOAD_INTERVAL) {
lastReloadAttempt = time;
try {
File file = new File(whitelistFile);
long lastModified = file.... | [
"public",
"void",
"reloadConfigIfNecessary",
"(",
")",
"{",
"if",
"(",
"whitelistFile",
"==",
"null",
")",
"{",
"return",
";",
"}",
"long",
"time",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"time",
">",
"lastReloadAttempt",
"+",
... | Checks to see if the namenode config file is updated on
disk, If so, then read all it contents. At present, only
the whitelist config is updated, but we will enahnce this to
update all possible namenode configs in future. | [
"Checks",
"to",
"see",
"if",
"the",
"namenode",
"config",
"file",
"is",
"updated",
"on",
"disk",
"If",
"so",
"then",
"read",
"all",
"it",
"contents",
".",
"At",
"present",
"only",
"the",
"whitelist",
"config",
"is",
"updated",
"but",
"we",
"will",
"enahn... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/ConfigManager.java#L73-L102 |
118,373 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/ConfigManager.java | ConfigManager.reloadWhitelist | void reloadWhitelist() throws IOException {
// read the entire whitelist into memory outside the
// FSNamessytem lock.
//
LinkedList<String> paths = new LinkedList<String>();
FileInputStream fstream = new FileInputStream(whitelistFile);
DataInputStream in = new DataInputStream(fstream);
Buf... | java | void reloadWhitelist() throws IOException {
// read the entire whitelist into memory outside the
// FSNamessytem lock.
//
LinkedList<String> paths = new LinkedList<String>();
FileInputStream fstream = new FileInputStream(whitelistFile);
DataInputStream in = new DataInputStream(fstream);
Buf... | [
"void",
"reloadWhitelist",
"(",
")",
"throws",
"IOException",
"{",
"// read the entire whitelist into memory outside the",
"// FSNamessytem lock.",
"//",
"LinkedList",
"<",
"String",
">",
"paths",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"FileInput... | Removes all the entries currently in neverDeletePaths
and add the new ones specified | [
"Removes",
"all",
"the",
"entries",
"currently",
"in",
"neverDeletePaths",
"and",
"add",
"the",
"new",
"ones",
"specified"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/ConfigManager.java#L108-L144 |
118,374 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/RaidDFSUtil.java | RaidDFSUtil.constructFakeRaidFile | public static void constructFakeRaidFile(DistributedFileSystem dfs,
String filePath, RaidCodec codec) throws IOException {
long blockSize = 512L;
byte[] buffer = new byte[(int) (codec.numDataBlocks * blockSize)];
int[] checksum = new int[codec.numDataBlocks];
OutputStream out = dfs.create(new... | java | public static void constructFakeRaidFile(DistributedFileSystem dfs,
String filePath, RaidCodec codec) throws IOException {
long blockSize = 512L;
byte[] buffer = new byte[(int) (codec.numDataBlocks * blockSize)];
int[] checksum = new int[codec.numDataBlocks];
OutputStream out = dfs.create(new... | [
"public",
"static",
"void",
"constructFakeRaidFile",
"(",
"DistributedFileSystem",
"dfs",
",",
"String",
"filePath",
",",
"RaidCodec",
"codec",
")",
"throws",
"IOException",
"{",
"long",
"blockSize",
"=",
"512L",
";",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"b... | This function create two mock source and parity files and merge them. | [
"This",
"function",
"create",
"two",
"mock",
"source",
"and",
"parity",
"files",
"and",
"merge",
"them",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/RaidDFSUtil.java#L47-L72 |
118,375 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/MetricsUtil.java | MetricsUtil.getContext | public static MetricsContext getContext(String refName, String contextName) {
MetricsContext metricsContext;
try {
metricsContext =
ContextFactory.getFactory().getContext(refName, contextName);
if (!metricsContext.isMonitoring()) {
metricsContext.startMonitoring();
}
} catc... | java | public static MetricsContext getContext(String refName, String contextName) {
MetricsContext metricsContext;
try {
metricsContext =
ContextFactory.getFactory().getContext(refName, contextName);
if (!metricsContext.isMonitoring()) {
metricsContext.startMonitoring();
}
} catc... | [
"public",
"static",
"MetricsContext",
"getContext",
"(",
"String",
"refName",
",",
"String",
"contextName",
")",
"{",
"MetricsContext",
"metricsContext",
";",
"try",
"{",
"metricsContext",
"=",
"ContextFactory",
".",
"getFactory",
"(",
")",
".",
"getContext",
"(",... | Utility method to return the named context.
If the desired context cannot be created for any reason, the exception
is logged, and a null context is returned. | [
"Utility",
"method",
"to",
"return",
"the",
"named",
"context",
".",
"If",
"the",
"desired",
"context",
"cannot",
"be",
"created",
"for",
"any",
"reason",
"the",
"exception",
"is",
"logged",
"and",
"a",
"null",
"context",
"is",
"returned",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/MetricsUtil.java#L53-L66 |
118,376 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/MetricsUtil.java | MetricsUtil.createRecord | public static MetricsRecord createRecord(MetricsContext context,
String recordName)
{
MetricsRecord metricsRecord = context.createRecord(recordName);
metricsRecord.setTag("hostName", getHostName());
return metricsRecord;
} | java | public static MetricsRecord createRecord(MetricsContext context,
String recordName)
{
MetricsRecord metricsRecord = context.createRecord(recordName);
metricsRecord.setTag("hostName", getHostName());
return metricsRecord;
} | [
"public",
"static",
"MetricsRecord",
"createRecord",
"(",
"MetricsContext",
"context",
",",
"String",
"recordName",
")",
"{",
"MetricsRecord",
"metricsRecord",
"=",
"context",
".",
"createRecord",
"(",
"recordName",
")",
";",
"metricsRecord",
".",
"setTag",
"(",
"... | Utility method to create and return new metrics record instance within the
given context. This record is tagged with the host name.
@param context the context
@param recordName name of the record
@return newly created metrics record | [
"Utility",
"method",
"to",
"create",
"and",
"return",
"new",
"metrics",
"record",
"instance",
"within",
"the",
"given",
"context",
".",
"This",
"record",
"is",
"tagged",
"with",
"the",
"host",
"name",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/MetricsUtil.java#L76-L82 |
118,377 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/MetricsUtil.java | MetricsUtil.getHostName | private static String getHostName() {
String hostName = null;
try {
hostName = InetAddress.getLocalHost().getHostName();
}
catch (UnknownHostException ex) {
LOG.info("Unable to obtain hostName", ex);
hostName = "unknown";
}
return hostName;
} | java | private static String getHostName() {
String hostName = null;
try {
hostName = InetAddress.getLocalHost().getHostName();
}
catch (UnknownHostException ex) {
LOG.info("Unable to obtain hostName", ex);
hostName = "unknown";
}
return hostName;
} | [
"private",
"static",
"String",
"getHostName",
"(",
")",
"{",
"String",
"hostName",
"=",
"null",
";",
"try",
"{",
"hostName",
"=",
"InetAddress",
".",
"getLocalHost",
"(",
")",
".",
"getHostName",
"(",
")",
";",
"}",
"catch",
"(",
"UnknownHostException",
"e... | Returns the host name. If the host name is unobtainable, logs the
exception and returns "unknown". | [
"Returns",
"the",
"host",
"name",
".",
"If",
"the",
"host",
"name",
"is",
"unobtainable",
"logs",
"the",
"exception",
"and",
"returns",
"unknown",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/MetricsUtil.java#L88-L98 |
118,378 | facebookarchive/hadoop-20 | src/contrib/benchmark/src/java/org/apache/hadoop/mapred/DatanodeBenThread.java | DatanodeBenThread.getRunningDatanode | private String getRunningDatanode(Configuration conf)
throws IOException {
FileSystem fs = FileSystem.newInstance(conf);
fs.mkdirs(new Path("/tmp"));
Path fileName = new Path("/tmp", rtc.task_name + System.currentTimeMillis()
+ rb.nextInt());
if (fs.exists(fileName)) {
... | java | private String getRunningDatanode(Configuration conf)
throws IOException {
FileSystem fs = FileSystem.newInstance(conf);
fs.mkdirs(new Path("/tmp"));
Path fileName = new Path("/tmp", rtc.task_name + System.currentTimeMillis()
+ rb.nextInt());
if (fs.exists(fileName)) {
... | [
"private",
"String",
"getRunningDatanode",
"(",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"FileSystem",
"fs",
"=",
"FileSystem",
".",
"newInstance",
"(",
"conf",
")",
";",
"fs",
".",
"mkdirs",
"(",
"new",
"Path",
"(",
"\"/tmp\"",
")",
")",
... | Write a small file to figure out which datanode we are running | [
"Write",
"a",
"small",
"file",
"to",
"figure",
"out",
"which",
"datanode",
"we",
"are",
"running"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/mapred/DatanodeBenThread.java#L455-L480 |
118,379 | facebookarchive/hadoop-20 | src/contrib/benchmark/src/java/org/apache/hadoop/mapred/GenReaderThread.java | GenReaderThread.prepare | @Override
public GenThread[] prepare(JobConf conf, Text key, Text value)
throws IOException {
this.rtc = new RunTimeConstants();
super.prepare(conf, key, value, rtc);
Path basePath = new Path(key.toString());
LOG.info("base path is " + basePath);
Path checksumPath = null;
... | java | @Override
public GenThread[] prepare(JobConf conf, Text key, Text value)
throws IOException {
this.rtc = new RunTimeConstants();
super.prepare(conf, key, value, rtc);
Path basePath = new Path(key.toString());
LOG.info("base path is " + basePath);
Path checksumPath = null;
... | [
"@",
"Override",
"public",
"GenThread",
"[",
"]",
"prepare",
"(",
"JobConf",
"conf",
",",
"Text",
"key",
",",
"Text",
"value",
")",
"throws",
"IOException",
"{",
"this",
".",
"rtc",
"=",
"new",
"RunTimeConstants",
"(",
")",
";",
"super",
".",
"prepare",
... | Create a number of threads to generate read traffics
@param conf
@param key directory of files to read
@param value checksum file locaiton
@return
@throws IOException | [
"Create",
"a",
"number",
"of",
"threads",
"to",
"generate",
"read",
"traffics"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/mapred/GenReaderThread.java#L80-L138 |
118,380 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/protocol/HdfsFileStatus.java | HdfsFileStatus.toFileStatus | public static FileStatus toFileStatus(HdfsFileStatus stat, String src) {
if (stat == null) {
return null;
}
return new FileStatus(stat.getLen(), stat.isDir(), stat.getReplication(),
stat.getBlockSize(), stat.getModificationTime(),
stat.getAccessTime(),
stat.getPermission(), sta... | java | public static FileStatus toFileStatus(HdfsFileStatus stat, String src) {
if (stat == null) {
return null;
}
return new FileStatus(stat.getLen(), stat.isDir(), stat.getReplication(),
stat.getBlockSize(), stat.getModificationTime(),
stat.getAccessTime(),
stat.getPermission(), sta... | [
"public",
"static",
"FileStatus",
"toFileStatus",
"(",
"HdfsFileStatus",
"stat",
",",
"String",
"src",
")",
"{",
"if",
"(",
"stat",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"FileStatus",
"(",
"stat",
".",
"getLen",
"(",
")",
... | Convert an HdfsFileStatus to a FileStatus
@param stat an HdfsFileStatus
@param src parent path in string representation
@return a FileStatus object | [
"Convert",
"an",
"HdfsFileStatus",
"to",
"a",
"FileStatus"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/protocol/HdfsFileStatus.java#L112-L121 |
118,381 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/protocol/HdfsFileStatus.java | HdfsFileStatus.getFullName | final public String getFullName(final String parent) {
if (isEmptyLocalName()) {
return parent;
}
StringBuilder fullName = new StringBuilder(parent);
if (!parent.endsWith(Path.SEPARATOR)) {
fullName.append(Path.SEPARATOR);
}
fullName.append(getLocalName());
return fullName.t... | java | final public String getFullName(final String parent) {
if (isEmptyLocalName()) {
return parent;
}
StringBuilder fullName = new StringBuilder(parent);
if (!parent.endsWith(Path.SEPARATOR)) {
fullName.append(Path.SEPARATOR);
}
fullName.append(getLocalName());
return fullName.t... | [
"final",
"public",
"String",
"getFullName",
"(",
"final",
"String",
"parent",
")",
"{",
"if",
"(",
"isEmptyLocalName",
"(",
")",
")",
"{",
"return",
"parent",
";",
"}",
"StringBuilder",
"fullName",
"=",
"new",
"StringBuilder",
"(",
"parent",
")",
";",
"if"... | Get the string representation of the full path name
@param parent the parent path
@return the full path in string | [
"Get",
"the",
"string",
"representation",
"of",
"the",
"full",
"path",
"name"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/protocol/HdfsFileStatus.java#L277-L288 |
118,382 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNodeJspHelper.java | JournalNodeJspHelper.getValue | private static String getValue(Map<String, String> map, String keyName) {
String value = map.get(keyName);
return value == null ? "-" : value;
} | java | private static String getValue(Map<String, String> map, String keyName) {
String value = map.get(keyName);
return value == null ? "-" : value;
} | [
"private",
"static",
"String",
"getValue",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"map",
",",
"String",
"keyName",
")",
"{",
"String",
"value",
"=",
"map",
".",
"get",
"(",
"keyName",
")",
";",
"return",
"value",
"==",
"null",
"?",
"\"-\"",
"... | Retrieve value from the map corresponding to the given key. | [
"Retrieve",
"value",
"from",
"the",
"map",
"corresponding",
"to",
"the",
"given",
"key",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNodeJspHelper.java#L175-L178 |
118,383 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNodeJspHelper.java | JournalNodeJspHelper.fetchStats | private String fetchStats(InetSocketAddress jn) throws IOException {
try {
return DFSUtil.getHTMLContentWithTimeout(new URI("http", null, jn.getAddress().getHostAddress(), jn
.getPort(), "/journalStats", null, null).toURL(), HTTP_CONNECT_TIMEOUT, HTTP_READ_TIMEOUT);
} catch (Exception e) {
... | java | private String fetchStats(InetSocketAddress jn) throws IOException {
try {
return DFSUtil.getHTMLContentWithTimeout(new URI("http", null, jn.getAddress().getHostAddress(), jn
.getPort(), "/journalStats", null, null).toURL(), HTTP_CONNECT_TIMEOUT, HTTP_READ_TIMEOUT);
} catch (Exception e) {
... | [
"private",
"String",
"fetchStats",
"(",
"InetSocketAddress",
"jn",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"DFSUtil",
".",
"getHTMLContentWithTimeout",
"(",
"new",
"URI",
"(",
"\"http\"",
",",
"null",
",",
"jn",
".",
"getAddress",
"(",
")",
... | Fetch stats from a single given journal node over http. | [
"Fetch",
"stats",
"from",
"a",
"single",
"given",
"journal",
"node",
"over",
"http",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNodeJspHelper.java#L183-L191 |
118,384 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNodeJspHelper.java | JournalNodeJspHelper.getStatsMap | private static Map<String, Map<String, String>> getStatsMap(String json)
throws IOException {
if (json == null || json.isEmpty()) {
return new HashMap<String, Map<String, String>>();
}
TypeReference<Map<String, Map<String, String>>> type = new TypeReference<Map<String, Map<String, String>>>() {
... | java | private static Map<String, Map<String, String>> getStatsMap(String json)
throws IOException {
if (json == null || json.isEmpty()) {
return new HashMap<String, Map<String, String>>();
}
TypeReference<Map<String, Map<String, String>>> type = new TypeReference<Map<String, Map<String, String>>>() {
... | [
"private",
"static",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"String",
">",
">",
"getStatsMap",
"(",
"String",
"json",
")",
"throws",
"IOException",
"{",
"if",
"(",
"json",
"==",
"null",
"||",
"json",
".",
"isEmpty",
"(",
")",
")",
"{",... | Get the map corresponding to the JSON string | [
"Get",
"the",
"map",
"corresponding",
"to",
"the",
"JSON",
"string"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNodeJspHelper.java#L196-L204 |
118,385 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNodeJspHelper.java | JournalNodeJspHelper.getNodeReport | public static String getNodeReport(QJMStatus status) {
StringBuilder sb = new StringBuilder();
sb.append("<table border=1 cellpadding=1 cellspacing=0 title=\"Journals\">");
sb.append("<thead><tr><td><b>Journal node</b></td><td><b>Alive</b></td></tr></thead>");
for (Entry<String, Boolean> e : status.getA... | java | public static String getNodeReport(QJMStatus status) {
StringBuilder sb = new StringBuilder();
sb.append("<table border=1 cellpadding=1 cellspacing=0 title=\"Journals\">");
sb.append("<thead><tr><td><b>Journal node</b></td><td><b>Alive</b></td></tr></thead>");
for (Entry<String, Boolean> e : status.getA... | [
"public",
"static",
"String",
"getNodeReport",
"(",
"QJMStatus",
"status",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"<table border=1 cellpadding=1 cellspacing=0 title=\\\"Journals\\\">\"",
")",
";",
"sb",... | Generate health report for journal nodes | [
"Generate",
"health",
"report",
"for",
"journal",
"nodes"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNodeJspHelper.java#L216-L231 |
118,386 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNodeJspHelper.java | JournalNodeJspHelper.getJournalReport | public static String getJournalReport(QJMStatus status) {
StringBuilder sb = new StringBuilder();
sb.append("<table border=1 cellpadding=1 cellspacing=0 title=\"Journals\">");
sb.append("<thead><tr><td><b>JournalId</b></td><td><b>Statistics</b></td></tr></thead>");
for (String journalId : status.getJour... | java | public static String getJournalReport(QJMStatus status) {
StringBuilder sb = new StringBuilder();
sb.append("<table border=1 cellpadding=1 cellspacing=0 title=\"Journals\">");
sb.append("<thead><tr><td><b>JournalId</b></td><td><b>Statistics</b></td></tr></thead>");
for (String journalId : status.getJour... | [
"public",
"static",
"String",
"getJournalReport",
"(",
"QJMStatus",
"status",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"<table border=1 cellpadding=1 cellspacing=0 title=\\\"Journals\\\">\"",
")",
";",
"s... | Generate report for all journals and all journal nodes | [
"Generate",
"report",
"for",
"all",
"journals",
"and",
"all",
"journal",
"nodes"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNodeJspHelper.java#L236-L247 |
118,387 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNodeJspHelper.java | JournalNodeJspHelper.getHTMLTableForASingleJournal | public static void getHTMLTableForASingleJournal(QJMStatus status,
String journalName, StringBuilder sb) {
List<StatsDescriptor> stats = status.stats.get(journalName);
if (stats == null) {
return;
}
Set<String> statsNames = status.statNames;
// header
sb.append("<table border=1 alig... | java | public static void getHTMLTableForASingleJournal(QJMStatus status,
String journalName, StringBuilder sb) {
List<StatsDescriptor> stats = status.stats.get(journalName);
if (stats == null) {
return;
}
Set<String> statsNames = status.statNames;
// header
sb.append("<table border=1 alig... | [
"public",
"static",
"void",
"getHTMLTableForASingleJournal",
"(",
"QJMStatus",
"status",
",",
"String",
"journalName",
",",
"StringBuilder",
"sb",
")",
"{",
"List",
"<",
"StatsDescriptor",
">",
"stats",
"=",
"status",
".",
"stats",
".",
"get",
"(",
"journalName"... | Render html table for a single journal. | [
"Render",
"html",
"table",
"for",
"a",
"single",
"journal",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNodeJspHelper.java#L252-L281 |
118,388 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNodeJspHelper.java | JournalNodeJspHelper.getHostAddress | private static String getHostAddress(InetSocketAddress addr) {
String hostToAppend = "";
if (addr.isUnresolved()) {
hostToAppend = addr.getHostName();
} else {
hostToAppend = addr.getAddress().getHostAddress();
}
return hostToAppend;
} | java | private static String getHostAddress(InetSocketAddress addr) {
String hostToAppend = "";
if (addr.isUnresolved()) {
hostToAppend = addr.getHostName();
} else {
hostToAppend = addr.getAddress().getHostAddress();
}
return hostToAppend;
} | [
"private",
"static",
"String",
"getHostAddress",
"(",
"InetSocketAddress",
"addr",
")",
"{",
"String",
"hostToAppend",
"=",
"\"\"",
";",
"if",
"(",
"addr",
".",
"isUnresolved",
"(",
")",
")",
"{",
"hostToAppend",
"=",
"addr",
".",
"getHostName",
"(",
")",
... | Returns the address of the host minimizing DNS lookups.
@param addr
@return | [
"Returns",
"the",
"address",
"of",
"the",
"host",
"minimizing",
"DNS",
"lookups",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JournalNodeJspHelper.java#L288-L296 |
118,389 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java | PoolManager.getPool | public synchronized Pool getPool(String name) {
Pool pool = pools.get(name);
if (pool == null) {
boolean isConfiguredPool = poolNamesInAllocFile.contains(name);
pool = new Pool(name, isConfiguredPool);
pools.put(name, pool);
}
return pool;
} | java | public synchronized Pool getPool(String name) {
Pool pool = pools.get(name);
if (pool == null) {
boolean isConfiguredPool = poolNamesInAllocFile.contains(name);
pool = new Pool(name, isConfiguredPool);
pools.put(name, pool);
}
return pool;
} | [
"public",
"synchronized",
"Pool",
"getPool",
"(",
"String",
"name",
")",
"{",
"Pool",
"pool",
"=",
"pools",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"pool",
"==",
"null",
")",
"{",
"boolean",
"isConfiguredPool",
"=",
"poolNamesInAllocFile",
".",
"co... | Get a pool by name, creating it if necessary.
@name Name of the pool to get. (Should be lower-cased already) | [
"Get",
"a",
"pool",
"by",
"name",
"creating",
"it",
"if",
"necessary",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L152-L160 |
118,390 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java | PoolManager.reloadAllocsIfNecessary | public boolean reloadAllocsIfNecessary() {
if (allocFile == null) {
// A warning has been logged when allocFile is null.
// We should just return here.
return false;
}
long time = System.currentTimeMillis();
boolean reloaded = false;
if (time > lastReloadAttempt + ALLOC_RELOAD_INTE... | java | public boolean reloadAllocsIfNecessary() {
if (allocFile == null) {
// A warning has been logged when allocFile is null.
// We should just return here.
return false;
}
long time = System.currentTimeMillis();
boolean reloaded = false;
if (time > lastReloadAttempt + ALLOC_RELOAD_INTE... | [
"public",
"boolean",
"reloadAllocsIfNecessary",
"(",
")",
"{",
"if",
"(",
"allocFile",
"==",
"null",
")",
"{",
"// A warning has been logged when allocFile is null.",
"// We should just return here.",
"return",
"false",
";",
"}",
"long",
"time",
"=",
"System",
".",
"c... | Reload allocations file if it hasn't been loaded in a while
return true if reloaded | [
"Reload",
"allocations",
"file",
"if",
"it",
"hasn",
"t",
"been",
"loaded",
"in",
"a",
"while",
"return",
"true",
"if",
"reloaded"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L166-L200 |
118,391 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java | PoolManager.getMinSlots | public int getMinSlots(String pool, TaskType taskType) {
Map<String, Integer> allocationMap = (taskType == TaskType.MAP ?
mapAllocs : reduceAllocs);
Integer alloc = allocationMap.get(pool);
return (alloc == null ? 0 : alloc);
} | java | public int getMinSlots(String pool, TaskType taskType) {
Map<String, Integer> allocationMap = (taskType == TaskType.MAP ?
mapAllocs : reduceAllocs);
Integer alloc = allocationMap.get(pool);
return (alloc == null ? 0 : alloc);
} | [
"public",
"int",
"getMinSlots",
"(",
"String",
"pool",
",",
"TaskType",
"taskType",
")",
"{",
"Map",
"<",
"String",
",",
"Integer",
">",
"allocationMap",
"=",
"(",
"taskType",
"==",
"TaskType",
".",
"MAP",
"?",
"mapAllocs",
":",
"reduceAllocs",
")",
";",
... | Get the allocation for a particular pool | [
"Get",
"the",
"allocation",
"for",
"a",
"particular",
"pool"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L422-L427 |
118,392 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java | PoolManager.addJob | public synchronized void addJob(JobInProgress job) {
String poolName = getPoolName(job);
LOG.info("Adding job " + job.getJobID() + " to pool " + poolName +
", originally from pool " +
job.getJobConf().get(EXPLICIT_POOL_PROPERTY));
getPool(poolName).addJob(job);
} | java | public synchronized void addJob(JobInProgress job) {
String poolName = getPoolName(job);
LOG.info("Adding job " + job.getJobID() + " to pool " + poolName +
", originally from pool " +
job.getJobConf().get(EXPLICIT_POOL_PROPERTY));
getPool(poolName).addJob(job);
} | [
"public",
"synchronized",
"void",
"addJob",
"(",
"JobInProgress",
"job",
")",
"{",
"String",
"poolName",
"=",
"getPoolName",
"(",
"job",
")",
";",
"LOG",
".",
"info",
"(",
"\"Adding job \"",
"+",
"job",
".",
"getJobID",
"(",
")",
"+",
"\" to pool \"",
"+",... | Add a job in the appropriate pool | [
"Add",
"a",
"job",
"in",
"the",
"appropriate",
"pool"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L432-L438 |
118,393 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java | PoolManager.removeJob | public synchronized void removeJob(JobInProgress job) {
if (getPool(getPoolName(job)).removeJob(job)) {
return;
}
// Job wasn't found in this pool. Search for the job in all the pools
// (the pool may have been created after the job started).
for (Pool pool : getPools()) {
if (pool.rem... | java | public synchronized void removeJob(JobInProgress job) {
if (getPool(getPoolName(job)).removeJob(job)) {
return;
}
// Job wasn't found in this pool. Search for the job in all the pools
// (the pool may have been created after the job started).
for (Pool pool : getPools()) {
if (pool.rem... | [
"public",
"synchronized",
"void",
"removeJob",
"(",
"JobInProgress",
"job",
")",
"{",
"if",
"(",
"getPool",
"(",
"getPoolName",
"(",
"job",
")",
")",
".",
"removeJob",
"(",
"job",
")",
")",
"{",
"return",
";",
"}",
"// Job wasn't found in this pool. Search fo... | Remove a job | [
"Remove",
"a",
"job"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L443-L461 |
118,394 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java | PoolManager.setPool | public synchronized void setPool(JobInProgress job, String pool) {
removeJob(job);
job.getJobConf().set(EXPLICIT_POOL_PROPERTY, pool);
addJob(job);
} | java | public synchronized void setPool(JobInProgress job, String pool) {
removeJob(job);
job.getJobConf().set(EXPLICIT_POOL_PROPERTY, pool);
addJob(job);
} | [
"public",
"synchronized",
"void",
"setPool",
"(",
"JobInProgress",
"job",
",",
"String",
"pool",
")",
"{",
"removeJob",
"(",
"job",
")",
";",
"job",
".",
"getJobConf",
"(",
")",
".",
"set",
"(",
"EXPLICIT_POOL_PROPERTY",
",",
"pool",
")",
";",
"addJob",
... | Change the pool of a particular job | [
"Change",
"the",
"pool",
"of",
"a",
"particular",
"job"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L466-L470 |
118,395 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java | PoolManager.getPoolName | public synchronized String getPoolName(JobInProgress job) {
String name = getExplicitPoolName(job).trim();
String redirect = poolRedirectMap.get(name);
if (redirect == null) {
return name;
} else {
return redirect;
}
} | java | public synchronized String getPoolName(JobInProgress job) {
String name = getExplicitPoolName(job).trim();
String redirect = poolRedirectMap.get(name);
if (redirect == null) {
return name;
} else {
return redirect;
}
} | [
"public",
"synchronized",
"String",
"getPoolName",
"(",
"JobInProgress",
"job",
")",
"{",
"String",
"name",
"=",
"getExplicitPoolName",
"(",
"job",
")",
".",
"trim",
"(",
")",
";",
"String",
"redirect",
"=",
"poolRedirectMap",
".",
"get",
"(",
"name",
")",
... | Get the pool name for a JobInProgress from its configuration. This uses
the "project" property in the jobconf by default, or the property set with
"mapred.fairscheduler.poolnameproperty". | [
"Get",
"the",
"pool",
"name",
"for",
"a",
"JobInProgress",
"from",
"its",
"configuration",
".",
"This",
"uses",
"the",
"project",
"property",
"in",
"the",
"jobconf",
"by",
"default",
"or",
"the",
"property",
"set",
"with",
"mapred",
".",
"fairscheduler",
"."... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L484-L493 |
118,396 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java | PoolManager.checkValidPoolProperty | public synchronized void checkValidPoolProperty(JobInProgress job)
throws InvalidJobConfException {
if (!strictPoolsMode) {
return;
}
JobConf conf = job.getJobConf();
// Pool name needs to be lower cased.
String poolName = conf.get(EXPLICIT_POOL_PROPERTY);
if (poolName == null) {
... | java | public synchronized void checkValidPoolProperty(JobInProgress job)
throws InvalidJobConfException {
if (!strictPoolsMode) {
return;
}
JobConf conf = job.getJobConf();
// Pool name needs to be lower cased.
String poolName = conf.get(EXPLICIT_POOL_PROPERTY);
if (poolName == null) {
... | [
"public",
"synchronized",
"void",
"checkValidPoolProperty",
"(",
"JobInProgress",
"job",
")",
"throws",
"InvalidJobConfException",
"{",
"if",
"(",
"!",
"strictPoolsMode",
")",
"{",
"return",
";",
"}",
"JobConf",
"conf",
"=",
"job",
".",
"getJobConf",
"(",
")",
... | A quick check for to ensure that if the pool name is set and we are in a
strict pools mode, then the pool must exist to run this job.
@param job Job to check
@throws InvalidJobConfException | [
"A",
"quick",
"check",
"for",
"to",
"ensure",
"that",
"if",
"the",
"pool",
"name",
"is",
"set",
"and",
"we",
"are",
"in",
"a",
"strict",
"pools",
"mode",
"then",
"the",
"pool",
"must",
"exist",
"to",
"run",
"this",
"job",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L502-L526 |
118,397 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java | PoolManager.getPoolNames | public synchronized Collection<String> getPoolNames() {
List<String> list = new ArrayList<String>();
for (Pool pool: getPools()) {
list.add(pool.getName());
}
Collections.sort(list);
return list;
} | java | public synchronized Collection<String> getPoolNames() {
List<String> list = new ArrayList<String>();
for (Pool pool: getPools()) {
list.add(pool.getName());
}
Collections.sort(list);
return list;
} | [
"public",
"synchronized",
"Collection",
"<",
"String",
">",
"getPoolNames",
"(",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"Pool",
"pool",
":",
"getPools",
"(",
")",
")",
"{"... | Get all pool names that have been seen either in the allocation file or in
a MapReduce job. | [
"Get",
"all",
"pool",
"names",
"that",
"have",
"been",
"seen",
"either",
"in",
"the",
"allocation",
"file",
"or",
"in",
"a",
"MapReduce",
"job",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L610-L617 |
118,398 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java | PoolManager.canBePreempted | public boolean canBePreempted(String pool) {
Boolean result = canBePreempted.get(pool);
return result == null ? true : result; // Default is true
} | java | public boolean canBePreempted(String pool) {
Boolean result = canBePreempted.get(pool);
return result == null ? true : result; // Default is true
} | [
"public",
"boolean",
"canBePreempted",
"(",
"String",
"pool",
")",
"{",
"Boolean",
"result",
"=",
"canBePreempted",
".",
"get",
"(",
"pool",
")",
";",
"return",
"result",
"==",
"null",
"?",
"true",
":",
"result",
";",
"// Default is true",
"}"
] | Can we take slots from this pool when preempting tasks? | [
"Can",
"we",
"take",
"slots",
"from",
"this",
"pool",
"when",
"preempting",
"tasks?"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L654-L657 |
118,399 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java | PoolManager.fifoWeight | public boolean fifoWeight(String pool) {
Boolean result = poolFifoWeight.get(pool);
return result == null ? false : result; // Default is false
} | java | public boolean fifoWeight(String pool) {
Boolean result = poolFifoWeight.get(pool);
return result == null ? false : result; // Default is false
} | [
"public",
"boolean",
"fifoWeight",
"(",
"String",
"pool",
")",
"{",
"Boolean",
"result",
"=",
"poolFifoWeight",
".",
"get",
"(",
"pool",
")",
";",
"return",
"result",
"==",
"null",
"?",
"false",
":",
"result",
";",
"// Default is false",
"}"
] | Do we boost the weight for the older jobs? | [
"Do",
"we",
"boost",
"the",
"weight",
"for",
"the",
"older",
"jobs?"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L662-L665 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.