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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
119,000 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskMemoryManagerThread.java | TaskMemoryManagerThread.getTaskCumulativeRssmem | private long getTaskCumulativeRssmem(TaskAttemptID tid) {
ProcessTreeInfo ptInfo = processTreeInfoMap.get(tid);
ProcfsBasedProcessTree pTree = ptInfo.getProcessTree();
return pTree == null ? 0 : pTree.getCumulativeVmem();
} | java | private long getTaskCumulativeRssmem(TaskAttemptID tid) {
ProcessTreeInfo ptInfo = processTreeInfoMap.get(tid);
ProcfsBasedProcessTree pTree = ptInfo.getProcessTree();
return pTree == null ? 0 : pTree.getCumulativeVmem();
} | [
"private",
"long",
"getTaskCumulativeRssmem",
"(",
"TaskAttemptID",
"tid",
")",
"{",
"ProcessTreeInfo",
"ptInfo",
"=",
"processTreeInfoMap",
".",
"get",
"(",
"tid",
")",
";",
"ProcfsBasedProcessTree",
"pTree",
"=",
"ptInfo",
".",
"getProcessTree",
"(",
")",
";",
... | Return the cumulative rss memory used by a task
@param tid the task attempt ID of the task
@return rss memory usage in bytes. 0 if the process tree is not available | [
"Return",
"the",
"cumulative",
"rss",
"memory",
"used",
"by",
"a",
"task"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskMemoryManagerThread.java#L530-L534 |
119,001 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskMemoryManagerThread.java | TaskMemoryManagerThread.failTasksWithMaxRssMemory | private void failTasksWithMaxRssMemory(
long rssMemoryInUsage, long availableRssMemory) {
List<TaskAttemptID> tasksToKill = new ArrayList<TaskAttemptID>();
List<TaskAttemptID> allTasks = new ArrayList<TaskAttemptID>();
allTasks.addAll(processTreeInfoMap.keySet());
// Sort the tasks descending... | java | private void failTasksWithMaxRssMemory(
long rssMemoryInUsage, long availableRssMemory) {
List<TaskAttemptID> tasksToKill = new ArrayList<TaskAttemptID>();
List<TaskAttemptID> allTasks = new ArrayList<TaskAttemptID>();
allTasks.addAll(processTreeInfoMap.keySet());
// Sort the tasks descending... | [
"private",
"void",
"failTasksWithMaxRssMemory",
"(",
"long",
"rssMemoryInUsage",
",",
"long",
"availableRssMemory",
")",
"{",
"List",
"<",
"TaskAttemptID",
">",
"tasksToKill",
"=",
"new",
"ArrayList",
"<",
"TaskAttemptID",
">",
"(",
")",
";",
"List",
"<",
"TaskA... | Starting from the tasks use the highest amount of RSS memory,
fail the tasks until the RSS memory meets the requirement
@param rssMemoryInUsage RSS memory used by all tasks
@param availableRssMemory The free and cache memory in the system | [
"Starting",
"from",
"the",
"tasks",
"use",
"the",
"highest",
"amount",
"of",
"RSS",
"memory",
"fail",
"the",
"tasks",
"until",
"the",
"RSS",
"memory",
"meets",
"the",
"requirement"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskMemoryManagerThread.java#L542-L602 |
119,002 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/ObjectWritable.java | ObjectWritable.prepareCachedNameBytes | public static byte[] prepareCachedNameBytes(String entityName) {
UTF8 name = new UTF8();
name.set(entityName, true);
byte nameBytes[] = name.getBytes();
byte cachedName[] = new byte[nameBytes.length + 2];
System.arraycopy(nameBytes, 0, cachedName, 2, nameBytes.length);
// we cache the length as ... | java | public static byte[] prepareCachedNameBytes(String entityName) {
UTF8 name = new UTF8();
name.set(entityName, true);
byte nameBytes[] = name.getBytes();
byte cachedName[] = new byte[nameBytes.length + 2];
System.arraycopy(nameBytes, 0, cachedName, 2, nameBytes.length);
// we cache the length as ... | [
"public",
"static",
"byte",
"[",
"]",
"prepareCachedNameBytes",
"(",
"String",
"entityName",
")",
"{",
"UTF8",
"name",
"=",
"new",
"UTF8",
"(",
")",
";",
"name",
".",
"set",
"(",
"entityName",
",",
"true",
")",
";",
"byte",
"nameBytes",
"[",
"]",
"=",
... | Prepares a byte array for given name together with lenght
as the two trailing bytes. | [
"Prepares",
"a",
"byte",
"array",
"for",
"given",
"name",
"together",
"with",
"lenght",
"as",
"the",
"two",
"trailing",
"bytes",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/ObjectWritable.java#L223-L235 |
119,003 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/ObjectWritable.java | ObjectWritable.getClassWithCaching | private static Class<?> getClassWithCaching(String className,
Configuration conf) {
Class<?> classs = cachedClassObjects.get(className);
if (classs == null) {
try {
classs = conf.getClassByName(className);
if (cachedClassObjects.size() < CACHE_MAX_SIZE) {
cachedClassObjects... | java | private static Class<?> getClassWithCaching(String className,
Configuration conf) {
Class<?> classs = cachedClassObjects.get(className);
if (classs == null) {
try {
classs = conf.getClassByName(className);
if (cachedClassObjects.size() < CACHE_MAX_SIZE) {
cachedClassObjects... | [
"private",
"static",
"Class",
"<",
"?",
">",
"getClassWithCaching",
"(",
"String",
"className",
",",
"Configuration",
"conf",
")",
"{",
"Class",
"<",
"?",
">",
"classs",
"=",
"cachedClassObjects",
".",
"get",
"(",
"className",
")",
";",
"if",
"(",
"classs"... | Retrieve Class for given name from cache. if not present,
cache it, it the map capacity is not exceeded. | [
"Retrieve",
"Class",
"for",
"given",
"name",
"from",
"cache",
".",
"if",
"not",
"present",
"cache",
"it",
"it",
"the",
"map",
"capacity",
"is",
"not",
"exceeded",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/ObjectWritable.java#L248-L267 |
119,004 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/FileStatusExtended.java | FileStatusExtended.blocksEquals | private boolean blocksEquals(Block[] a1, Block[] a2, boolean closedFile) {
if (a1 == a2)
return true;
if (a1 == null || a2 == null || a2.length != a1.length)
return false;
for (int i = 0; i < a1.length; i++) {
Block b1 = a1[i];
Block b2 = a2[i];
if (b1 == b2)
continue... | java | private boolean blocksEquals(Block[] a1, Block[] a2, boolean closedFile) {
if (a1 == a2)
return true;
if (a1 == null || a2 == null || a2.length != a1.length)
return false;
for (int i = 0; i < a1.length; i++) {
Block b1 = a1[i];
Block b2 = a2[i];
if (b1 == b2)
continue... | [
"private",
"boolean",
"blocksEquals",
"(",
"Block",
"[",
"]",
"a1",
",",
"Block",
"[",
"]",
"a2",
",",
"boolean",
"closedFile",
")",
"{",
"if",
"(",
"a1",
"==",
"a2",
")",
"return",
"true",
";",
"if",
"(",
"a1",
"==",
"null",
"||",
"a2",
"==",
"n... | Comapre two arrays of blocks. If the file is open, do not compare
sizes of the blocks. | [
"Comapre",
"two",
"arrays",
"of",
"blocks",
".",
"If",
"the",
"file",
"is",
"open",
"do",
"not",
"compare",
"sizes",
"of",
"the",
"blocks",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/FileStatusExtended.java#L85-L114 |
119,005 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/pipes/Application.java | Application.abort | void abort(Throwable t) throws IOException {
LOG.info("Aborting because of " + StringUtils.stringifyException(t));
try {
downlink.abort();
downlink.flush();
} catch (IOException e) {
// IGNORE cleanup problems
}
try {
handler.waitForFinish();
} catch (Throwable ignored) {... | java | void abort(Throwable t) throws IOException {
LOG.info("Aborting because of " + StringUtils.stringifyException(t));
try {
downlink.abort();
downlink.flush();
} catch (IOException e) {
// IGNORE cleanup problems
}
try {
handler.waitForFinish();
} catch (Throwable ignored) {... | [
"void",
"abort",
"(",
"Throwable",
"t",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"info",
"(",
"\"Aborting because of \"",
"+",
"StringUtils",
".",
"stringifyException",
"(",
"t",
")",
")",
";",
"try",
"{",
"downlink",
".",
"abort",
"(",
")",
";",
"... | Abort the application and wait for it to finish.
@param t the exception that signalled the problem
@throws IOException A wrapper around the exception that was passed in | [
"Abort",
"the",
"application",
"and",
"wait",
"for",
"it",
"to",
"finish",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/pipes/Application.java#L139-L155 |
119,006 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/pipes/Application.java | Application.cleanup | void cleanup() throws IOException {
serverSocket.close();
try {
downlink.close();
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
} | java | void cleanup() throws IOException {
serverSocket.close();
try {
downlink.close();
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
} | [
"void",
"cleanup",
"(",
")",
"throws",
"IOException",
"{",
"serverSocket",
".",
"close",
"(",
")",
";",
"try",
"{",
"downlink",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ie",
")",
"{",
"Thread",
".",
"currentThread",
"(",
... | Clean up the child procress and socket.
@throws IOException | [
"Clean",
"up",
"the",
"child",
"procress",
"and",
"socket",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/pipes/Application.java#L161-L168 |
119,007 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/pipes/Application.java | Application.runClient | static Process runClient(List<String> command,
Map<String, String> env) throws IOException {
ProcessBuilder builder = new ProcessBuilder(command);
if (env != null) {
builder.environment().putAll(env);
}
Process result = builder.start();
return result;
} | java | static Process runClient(List<String> command,
Map<String, String> env) throws IOException {
ProcessBuilder builder = new ProcessBuilder(command);
if (env != null) {
builder.environment().putAll(env);
}
Process result = builder.start();
return result;
} | [
"static",
"Process",
"runClient",
"(",
"List",
"<",
"String",
">",
"command",
",",
"Map",
"<",
"String",
",",
"String",
">",
"env",
")",
"throws",
"IOException",
"{",
"ProcessBuilder",
"builder",
"=",
"new",
"ProcessBuilder",
"(",
"command",
")",
";",
"if"... | Run a given command in a subprocess, including threads to copy its stdout
and stderr to our stdout and stderr.
@param command the command and its arguments
@param env the environment to run the process in
@return a handle on the process
@throws IOException | [
"Run",
"a",
"given",
"command",
"in",
"a",
"subprocess",
"including",
"threads",
"to",
"copy",
"its",
"stdout",
"and",
"stderr",
"to",
"our",
"stdout",
"and",
"stderr",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/pipes/Application.java#L178-L186 |
119,008 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/SortedRanges.java | SortedRanges.add | synchronized void add(Range range){
if(range.isEmpty()) {
return;
}
long startIndex = range.getStartIndex();
long endIndex = range.getEndIndex();
//make sure that there are no overlapping ranges
SortedSet<Range> headSet = ranges.headSet(range);
if(headSet.size()>0) {
Range p... | java | synchronized void add(Range range){
if(range.isEmpty()) {
return;
}
long startIndex = range.getStartIndex();
long endIndex = range.getEndIndex();
//make sure that there are no overlapping ranges
SortedSet<Range> headSet = ranges.headSet(range);
if(headSet.size()>0) {
Range p... | [
"synchronized",
"void",
"add",
"(",
"Range",
"range",
")",
"{",
"if",
"(",
"range",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"long",
"startIndex",
"=",
"range",
".",
"getStartIndex",
"(",
")",
";",
"long",
"endIndex",
"=",
"range",
"."... | Add the range indices. It is ensured that the added range
doesn't overlap the existing ranges. If it overlaps, the
existing overlapping ranges are removed and a single range
having the superset of all the removed ranges and this range
is added.
If the range is of 0 length, doesn't do anything.
@param range Range to be ... | [
"Add",
"the",
"range",
"indices",
".",
"It",
"is",
"ensured",
"that",
"the",
"added",
"range",
"doesn",
"t",
"overlap",
"the",
"existing",
"ranges",
".",
"If",
"it",
"overlaps",
"the",
"existing",
"overlapping",
"ranges",
"are",
"removed",
"and",
"a",
"sin... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/SortedRanges.java#L80-L125 |
119,009 | facebookarchive/hadoop-20 | src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorJobStoryProducer.java | SimulatorJobStoryProducer.getNextJobFiltered | private JobStory getNextJobFiltered() throws IOException {
while (true) {
ZombieJob job = producer.getNextJob();
if (job == null) {
return null;
}
if (job.getOutcome() == Pre21JobHistoryConstants.Values.KILLED) {
continue;
}
if (job.getNumberMaps() == 0) {
... | java | private JobStory getNextJobFiltered() throws IOException {
while (true) {
ZombieJob job = producer.getNextJob();
if (job == null) {
return null;
}
if (job.getOutcome() == Pre21JobHistoryConstants.Values.KILLED) {
continue;
}
if (job.getNumberMaps() == 0) {
... | [
"private",
"JobStory",
"getNextJobFiltered",
"(",
")",
"throws",
"IOException",
"{",
"while",
"(",
"true",
")",
"{",
"ZombieJob",
"job",
"=",
"producer",
".",
"getNextJob",
"(",
")",
";",
"if",
"(",
"job",
"==",
"null",
")",
"{",
"return",
"null",
";",
... | Filter some jobs being fed to the simulator. For now, we filter out killed
jobs to facilitate debugging.
@throws IOException | [
"Filter",
"some",
"jobs",
"being",
"fed",
"to",
"the",
"simulator",
".",
"For",
"now",
"we",
"filter",
"out",
"killed",
"jobs",
"to",
"facilitate",
"debugging",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorJobStoryProducer.java#L54-L71 |
119,010 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java | DancingLinks.addColumn | public void addColumn(ColumnName name, boolean primary) {
ColumnHeader<ColumnName> top = new ColumnHeader<ColumnName>(name, 0);
top.up = top;
top.down = top;
if (primary) {
Node<ColumnName> tail = head.left;
tail.right = top;
top.left = tail;
top.right = head;
head.left = t... | java | public void addColumn(ColumnName name, boolean primary) {
ColumnHeader<ColumnName> top = new ColumnHeader<ColumnName>(name, 0);
top.up = top;
top.down = top;
if (primary) {
Node<ColumnName> tail = head.left;
tail.right = top;
top.left = tail;
top.right = head;
head.left = t... | [
"public",
"void",
"addColumn",
"(",
"ColumnName",
"name",
",",
"boolean",
"primary",
")",
"{",
"ColumnHeader",
"<",
"ColumnName",
">",
"top",
"=",
"new",
"ColumnHeader",
"<",
"ColumnName",
">",
"(",
"name",
",",
"0",
")",
";",
"top",
".",
"up",
"=",
"t... | Add a column to the table
@param name The name of the column, which will be returned as part of
solutions
@param primary Is the column required for a solution? | [
"Add",
"a",
"column",
"to",
"the",
"table"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java#L114-L129 |
119,011 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java | DancingLinks.addRow | public void addRow(boolean[] values) {
Node<ColumnName> prev = null;
for(int i=0; i < values.length; ++i) {
if (values[i]) {
ColumnHeader<ColumnName> top = columns.get(i);
top.size += 1;
Node<ColumnName> bottom = top.up;
Node<ColumnName> node = new Node<ColumnName>(null, nu... | java | public void addRow(boolean[] values) {
Node<ColumnName> prev = null;
for(int i=0; i < values.length; ++i) {
if (values[i]) {
ColumnHeader<ColumnName> top = columns.get(i);
top.size += 1;
Node<ColumnName> bottom = top.up;
Node<ColumnName> node = new Node<ColumnName>(null, nu... | [
"public",
"void",
"addRow",
"(",
"boolean",
"[",
"]",
"values",
")",
"{",
"Node",
"<",
"ColumnName",
">",
"prev",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"values",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
... | Add a row to the table.
@param values the columns that are satisfied by this row | [
"Add",
"a",
"row",
"to",
"the",
"table",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java#L160-L184 |
119,012 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java | DancingLinks.findBestColumn | private ColumnHeader<ColumnName> findBestColumn() {
int lowSize = Integer.MAX_VALUE;
ColumnHeader<ColumnName> result = null;
ColumnHeader<ColumnName> current = (ColumnHeader<ColumnName>) head.right;
while (current != head) {
if (current.size < lowSize) {
lowSize = current.size;
res... | java | private ColumnHeader<ColumnName> findBestColumn() {
int lowSize = Integer.MAX_VALUE;
ColumnHeader<ColumnName> result = null;
ColumnHeader<ColumnName> current = (ColumnHeader<ColumnName>) head.right;
while (current != head) {
if (current.size < lowSize) {
lowSize = current.size;
res... | [
"private",
"ColumnHeader",
"<",
"ColumnName",
">",
"findBestColumn",
"(",
")",
"{",
"int",
"lowSize",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"ColumnHeader",
"<",
"ColumnName",
">",
"result",
"=",
"null",
";",
"ColumnHeader",
"<",
"ColumnName",
">",
"current",
... | Find the column with the fewest choices.
@return The column header | [
"Find",
"the",
"column",
"with",
"the",
"fewest",
"choices",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java#L203-L215 |
119,013 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java | DancingLinks.coverColumn | private void coverColumn(ColumnHeader<ColumnName> col) {
LOG.debug("cover " + col.head.name);
// remove the column
col.right.left = col.left;
col.left.right = col.right;
Node<ColumnName> row = col.down;
while (row != col) {
Node<ColumnName> node = row.right;
while (node != row) {
... | java | private void coverColumn(ColumnHeader<ColumnName> col) {
LOG.debug("cover " + col.head.name);
// remove the column
col.right.left = col.left;
col.left.right = col.right;
Node<ColumnName> row = col.down;
while (row != col) {
Node<ColumnName> node = row.right;
while (node != row) {
... | [
"private",
"void",
"coverColumn",
"(",
"ColumnHeader",
"<",
"ColumnName",
">",
"col",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"cover \"",
"+",
"col",
".",
"head",
".",
"name",
")",
";",
"// remove the column",
"col",
".",
"right",
".",
"left",
"=",
"col",
... | Hide a column in the table
@param col the column to hide | [
"Hide",
"a",
"column",
"in",
"the",
"table"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java#L221-L237 |
119,014 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java | DancingLinks.getRowName | private List<ColumnName> getRowName(Node<ColumnName> row) {
List<ColumnName> result = new ArrayList<ColumnName>();
result.add(row.head.name);
Node<ColumnName> node = row.right;
while (node != row) {
result.add(node.head.name);
node = node.right;
}
return result;
} | java | private List<ColumnName> getRowName(Node<ColumnName> row) {
List<ColumnName> result = new ArrayList<ColumnName>();
result.add(row.head.name);
Node<ColumnName> node = row.right;
while (node != row) {
result.add(node.head.name);
node = node.right;
}
return result;
} | [
"private",
"List",
"<",
"ColumnName",
">",
"getRowName",
"(",
"Node",
"<",
"ColumnName",
">",
"row",
")",
"{",
"List",
"<",
"ColumnName",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"ColumnName",
">",
"(",
")",
";",
"result",
".",
"add",
"(",
"row",
... | Get the name of a row by getting the list of column names that it
satisfies.
@param row the row to make a name for
@return the list of column names | [
"Get",
"the",
"name",
"of",
"a",
"row",
"by",
"getting",
"the",
"list",
"of",
"column",
"names",
"that",
"it",
"satisfies",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java#L266-L275 |
119,015 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java | DancingLinks.search | private int search(List<Node<ColumnName>> partial, SolutionAcceptor<ColumnName> output) {
int results = 0;
if (head.right == head) {
List<List<ColumnName>> result = new ArrayList<List<ColumnName>>(partial.size());
for(Node<ColumnName> row: partial) {
result.add(getRowName(row));
}
... | java | private int search(List<Node<ColumnName>> partial, SolutionAcceptor<ColumnName> output) {
int results = 0;
if (head.right == head) {
List<List<ColumnName>> result = new ArrayList<List<ColumnName>>(partial.size());
for(Node<ColumnName> row: partial) {
result.add(getRowName(row));
}
... | [
"private",
"int",
"search",
"(",
"List",
"<",
"Node",
"<",
"ColumnName",
">",
">",
"partial",
",",
"SolutionAcceptor",
"<",
"ColumnName",
">",
"output",
")",
"{",
"int",
"results",
"=",
"0",
";",
"if",
"(",
"head",
".",
"right",
"==",
"head",
")",
"{... | Find a solution to the problem.
@param partial a temporary datastructure to keep the current partial
answer in
@param output the acceptor for the results that are found
@return the number of solutions found | [
"Find",
"a",
"solution",
"to",
"the",
"problem",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java#L284-L318 |
119,016 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java | DancingLinks.searchPrefixes | private void searchPrefixes(int depth, int[] choices,
List<int[]> prefixes) {
if (depth == 0) {
prefixes.add(choices.clone());
} else {
ColumnHeader<ColumnName> col = findBestColumn();
if (col.size > 0) {
coverColumn(col);
Node<ColumnName> row = c... | java | private void searchPrefixes(int depth, int[] choices,
List<int[]> prefixes) {
if (depth == 0) {
prefixes.add(choices.clone());
} else {
ColumnHeader<ColumnName> col = findBestColumn();
if (col.size > 0) {
coverColumn(col);
Node<ColumnName> row = c... | [
"private",
"void",
"searchPrefixes",
"(",
"int",
"depth",
",",
"int",
"[",
"]",
"choices",
",",
"List",
"<",
"int",
"[",
"]",
">",
"prefixes",
")",
"{",
"if",
"(",
"depth",
"==",
"0",
")",
"{",
"prefixes",
".",
"add",
"(",
"choices",
".",
"clone",
... | Generate a list of prefixes down to a given depth. Assumes that the
problem is always deeper than depth.
@param depth the depth to explore down
@param choices an array of length depth to describe a prefix
@param prefixes a working datastructure | [
"Generate",
"a",
"list",
"of",
"prefixes",
"down",
"to",
"a",
"given",
"depth",
".",
"Assumes",
"that",
"the",
"problem",
"is",
"always",
"deeper",
"than",
"depth",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java#L327-L356 |
119,017 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java | DancingLinks.split | public List<int[]> split(int depth) {
int[] choices = new int[depth];
List<int[]> result = new ArrayList<int[]>(100000);
searchPrefixes(depth, choices, result);
return result;
} | java | public List<int[]> split(int depth) {
int[] choices = new int[depth];
List<int[]> result = new ArrayList<int[]>(100000);
searchPrefixes(depth, choices, result);
return result;
} | [
"public",
"List",
"<",
"int",
"[",
"]",
">",
"split",
"(",
"int",
"depth",
")",
"{",
"int",
"[",
"]",
"choices",
"=",
"new",
"int",
"[",
"depth",
"]",
";",
"List",
"<",
"int",
"[",
"]",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"int",
"[",
... | Generate a list of row choices to cover the first moves.
@param depth the length of the prefixes to generate
@return a list of integer arrays that list the rows to pick in order | [
"Generate",
"a",
"list",
"of",
"row",
"choices",
"to",
"cover",
"the",
"first",
"moves",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java#L363-L368 |
119,018 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java | DancingLinks.advance | private Node<ColumnName> advance(int goalRow) {
ColumnHeader<ColumnName> col = findBestColumn();
if (col.size > 0) {
coverColumn(col);
Node<ColumnName> row = col.down;
int id = 0;
while (row != col) {
if (id == goalRow) {
Node<ColumnName> node = row.right;
whi... | java | private Node<ColumnName> advance(int goalRow) {
ColumnHeader<ColumnName> col = findBestColumn();
if (col.size > 0) {
coverColumn(col);
Node<ColumnName> row = col.down;
int id = 0;
while (row != col) {
if (id == goalRow) {
Node<ColumnName> node = row.right;
whi... | [
"private",
"Node",
"<",
"ColumnName",
">",
"advance",
"(",
"int",
"goalRow",
")",
"{",
"ColumnHeader",
"<",
"ColumnName",
">",
"col",
"=",
"findBestColumn",
"(",
")",
";",
"if",
"(",
"col",
".",
"size",
">",
"0",
")",
"{",
"coverColumn",
"(",
"col",
... | Make one move from a prefix
@param goalRow the row that should be choosen
@return the row that was found | [
"Make",
"one",
"move",
"from",
"a",
"prefix"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java#L375-L395 |
119,019 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java | DancingLinks.rollback | private void rollback(Node<ColumnName> row) {
Node<ColumnName> node = row.left;
while (node != row) {
uncoverColumn(node.head);
node = node.left;
}
uncoverColumn(row.head);
} | java | private void rollback(Node<ColumnName> row) {
Node<ColumnName> node = row.left;
while (node != row) {
uncoverColumn(node.head);
node = node.left;
}
uncoverColumn(row.head);
} | [
"private",
"void",
"rollback",
"(",
"Node",
"<",
"ColumnName",
">",
"row",
")",
"{",
"Node",
"<",
"ColumnName",
">",
"node",
"=",
"row",
".",
"left",
";",
"while",
"(",
"node",
"!=",
"row",
")",
"{",
"uncoverColumn",
"(",
"node",
".",
"head",
")",
... | Undo a prefix exploration
@param row | [
"Undo",
"a",
"prefix",
"exploration"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java#L401-L408 |
119,020 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java | DancingLinks.solve | public int solve(int[] prefix, SolutionAcceptor<ColumnName> output) {
List<Node<ColumnName>> choices = new ArrayList<Node<ColumnName>>();
for(int i=0; i < prefix.length; ++i) {
choices.add(advance(prefix[i]));
}
int result = search(choices, output);
for(int i=prefix.length-1; i >=0; --i) {
... | java | public int solve(int[] prefix, SolutionAcceptor<ColumnName> output) {
List<Node<ColumnName>> choices = new ArrayList<Node<ColumnName>>();
for(int i=0; i < prefix.length; ++i) {
choices.add(advance(prefix[i]));
}
int result = search(choices, output);
for(int i=prefix.length-1; i >=0; --i) {
... | [
"public",
"int",
"solve",
"(",
"int",
"[",
"]",
"prefix",
",",
"SolutionAcceptor",
"<",
"ColumnName",
">",
"output",
")",
"{",
"List",
"<",
"Node",
"<",
"ColumnName",
">>",
"choices",
"=",
"new",
"ArrayList",
"<",
"Node",
"<",
"ColumnName",
">",
">",
"... | Given a prefix, find solutions under it.
@param prefix a list of row choices that control which part of the search
tree to explore
@param output the output for each solution
@return the number of solutions | [
"Given",
"a",
"prefix",
"find",
"solutions",
"under",
"it",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/DancingLinks.java#L417-L427 |
119,021 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumCall.java | QuorumCall.waitFor | public synchronized void waitFor(
int minResponses, int minSuccesses, int maxExceptions,
int millis, String operationName)
throws InterruptedException, TimeoutException {
long st = monotonicNow();
long nextLogTime = st + (long)(millis * WAIT_PROGRESS_INFO_THRESHOLD);
long et = st + millis;... | java | public synchronized void waitFor(
int minResponses, int minSuccesses, int maxExceptions,
int millis, String operationName)
throws InterruptedException, TimeoutException {
long st = monotonicNow();
long nextLogTime = st + (long)(millis * WAIT_PROGRESS_INFO_THRESHOLD);
long et = st + millis;... | [
"public",
"synchronized",
"void",
"waitFor",
"(",
"int",
"minResponses",
",",
"int",
"minSuccesses",
",",
"int",
"maxExceptions",
",",
"int",
"millis",
",",
"String",
"operationName",
")",
"throws",
"InterruptedException",
",",
"TimeoutException",
"{",
"long",
"st... | Wait for the quorum to achieve a certain number of responses.
Note that, even after this returns, more responses may arrive,
causing the return value of other methods in this class to change.
@param minResponses return as soon as this many responses have been
received, regardless of whether they are successes or exce... | [
"Wait",
"for",
"the",
"quorum",
"to",
"achieve",
"a",
"certain",
"number",
"of",
"responses",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumCall.java#L103-L149 |
119,022 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumCall.java | QuorumCall.checkAssertionErrors | private synchronized void checkAssertionErrors() {
boolean assertsEnabled = false;
assert assertsEnabled = true; // sets to true if enabled
if (assertsEnabled) {
for (Throwable t : exceptions.values()) {
if (t instanceof AssertionError) {
throw (AssertionError)t;
} else if (t... | java | private synchronized void checkAssertionErrors() {
boolean assertsEnabled = false;
assert assertsEnabled = true; // sets to true if enabled
if (assertsEnabled) {
for (Throwable t : exceptions.values()) {
if (t instanceof AssertionError) {
throw (AssertionError)t;
} else if (t... | [
"private",
"synchronized",
"void",
"checkAssertionErrors",
"(",
")",
"{",
"boolean",
"assertsEnabled",
"=",
"false",
";",
"assert",
"assertsEnabled",
"=",
"true",
";",
"// sets to true if enabled",
"if",
"(",
"assertsEnabled",
")",
"{",
"for",
"(",
"Throwable",
"t... | Check if any of the responses came back with an AssertionError.
If so, it re-throws it, even if there was a quorum of responses.
This code only runs if assertions are enabled for this class,
otherwise it should JIT itself away.
This is done since AssertionError indicates programmer confusion
rather than some kind of e... | [
"Check",
"if",
"any",
"of",
"the",
"responses",
"came",
"back",
"with",
"an",
"AssertionError",
".",
"If",
"so",
"it",
"re",
"-",
"throws",
"it",
"even",
"if",
"there",
"was",
"a",
"quorum",
"of",
"responses",
".",
"This",
"code",
"only",
"runs",
"if",... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumCall.java#L162-L176 |
119,023 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumCall.java | QuorumCall.throwQuorumException | public synchronized void throwQuorumException(String msg) throws QuorumException {
Preconditions.checkState(!exceptions.isEmpty());
throw QuorumException.create(msg, successes, exceptions);
} | java | public synchronized void throwQuorumException(String msg) throws QuorumException {
Preconditions.checkState(!exceptions.isEmpty());
throw QuorumException.create(msg, successes, exceptions);
} | [
"public",
"synchronized",
"void",
"throwQuorumException",
"(",
"String",
"msg",
")",
"throws",
"QuorumException",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"exceptions",
".",
"isEmpty",
"(",
")",
")",
";",
"throw",
"QuorumException",
".",
"create",
"(",... | Throws exception as a result of this quorum call. | [
"Throws",
"exception",
"as",
"a",
"result",
"of",
"this",
"quorum",
"call",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumCall.java#L229-L232 |
119,024 | facebookarchive/hadoop-20 | src/contrib/gridmix/src/java/org/apache/hadoop/mapred/gridmix/JobSubmitter.java | JobSubmitter.add | public void add(final GridmixJob job) throws InterruptedException {
final boolean addToQueue = !shutdown;
if (addToQueue) {
final SubmitTask task = new SubmitTask(job);
sem.acquire();
try {
sched.execute(task);
} catch (RejectedExecutionException e) {
sem.release();
... | java | public void add(final GridmixJob job) throws InterruptedException {
final boolean addToQueue = !shutdown;
if (addToQueue) {
final SubmitTask task = new SubmitTask(job);
sem.acquire();
try {
sched.execute(task);
} catch (RejectedExecutionException e) {
sem.release();
... | [
"public",
"void",
"add",
"(",
"final",
"GridmixJob",
"job",
")",
"throws",
"InterruptedException",
"{",
"final",
"boolean",
"addToQueue",
"=",
"!",
"shutdown",
";",
"if",
"(",
"addToQueue",
")",
"{",
"final",
"SubmitTask",
"task",
"=",
"new",
"SubmitTask",
"... | Enqueue the job to be submitted per the deadline associated with it. | [
"Enqueue",
"the",
"job",
"to",
"be",
"submitted",
"per",
"the",
"deadline",
"associated",
"with",
"it",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/gridmix/src/java/org/apache/hadoop/mapred/gridmix/JobSubmitter.java#L122-L133 |
119,025 | facebookarchive/hadoop-20 | src/contrib/gridmix/src/java/org/apache/hadoop/mapred/gridmix/JobSubmitter.java | JobSubmitter.join | public void join(long millis) throws InterruptedException {
if (!shutdown) {
throw new IllegalStateException("Cannot wait for active submit thread");
}
sched.awaitTermination(millis, TimeUnit.MILLISECONDS);
} | java | public void join(long millis) throws InterruptedException {
if (!shutdown) {
throw new IllegalStateException("Cannot wait for active submit thread");
}
sched.awaitTermination(millis, TimeUnit.MILLISECONDS);
} | [
"public",
"void",
"join",
"(",
"long",
"millis",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"!",
"shutdown",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot wait for active submit thread\"",
")",
";",
"}",
"sched",
".",
"awaitTerminat... | Continue running until all queued jobs have been submitted to the
cluster. | [
"Continue",
"running",
"until",
"all",
"queued",
"jobs",
"have",
"been",
"submitted",
"to",
"the",
"cluster",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/gridmix/src/java/org/apache/hadoop/mapred/gridmix/JobSubmitter.java#L152-L157 |
119,026 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/tools/JMXGet.java | JMXGet.printAllValues | public void printAllValues() throws Exception {
err("List of all the available keys:");
Object val = null;
for (ObjectName oname: hadoopObjectNames) {
err(">>>>>>>>jmx name: " + oname.getCanonicalKeyPropertyListString());
MBeanInfo mbinfo = mbsc.getMBeanInfo(oname);
MBeanAttributeInfo []... | java | public void printAllValues() throws Exception {
err("List of all the available keys:");
Object val = null;
for (ObjectName oname: hadoopObjectNames) {
err(">>>>>>>>jmx name: " + oname.getCanonicalKeyPropertyListString());
MBeanInfo mbinfo = mbsc.getMBeanInfo(oname);
MBeanAttributeInfo []... | [
"public",
"void",
"printAllValues",
"(",
")",
"throws",
"Exception",
"{",
"err",
"(",
"\"List of all the available keys:\"",
")",
";",
"Object",
"val",
"=",
"null",
";",
"for",
"(",
"ObjectName",
"oname",
":",
"hadoopObjectNames",
")",
"{",
"err",
"(",
"\">>>>... | print all attributes' values | [
"print",
"all",
"attributes",
"values"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/JMXGet.java#L91-L106 |
119,027 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/tools/JMXGet.java | JMXGet.getValue | public String getValue(String key) throws Exception{
Object val = null;
for (ObjectName oname: hadoopObjectNames) {
try {
val = mbsc.getAttribute(oname, key);
} catch (AttributeNotFoundException anfe) {
/*just go to the next */
continue;
} catch(ReflectionException re... | java | public String getValue(String key) throws Exception{
Object val = null;
for (ObjectName oname: hadoopObjectNames) {
try {
val = mbsc.getAttribute(oname, key);
} catch (AttributeNotFoundException anfe) {
/*just go to the next */
continue;
} catch(ReflectionException re... | [
"public",
"String",
"getValue",
"(",
"String",
"key",
")",
"throws",
"Exception",
"{",
"Object",
"val",
"=",
"null",
";",
"for",
"(",
"ObjectName",
"oname",
":",
"hadoopObjectNames",
")",
"{",
"try",
"{",
"val",
"=",
"mbsc",
".",
"getAttribute",
"(",
"on... | get single value by key | [
"get",
"single",
"value",
"by",
"key"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/JMXGet.java#L111-L131 |
119,028 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/raid/DirectoryStripeReader.java | DirectoryStripeReader.getDirLogicalSize | public static long getDirLogicalSize(List<FileStatus> lfs) {
long totalSize = 0L;
if (null == lfs) {
return totalSize;
}
for (FileStatus fsStat : lfs) {
totalSize += fsStat.getLen();
}
return totalSize;
} | java | public static long getDirLogicalSize(List<FileStatus> lfs) {
long totalSize = 0L;
if (null == lfs) {
return totalSize;
}
for (FileStatus fsStat : lfs) {
totalSize += fsStat.getLen();
}
return totalSize;
} | [
"public",
"static",
"long",
"getDirLogicalSize",
"(",
"List",
"<",
"FileStatus",
">",
"lfs",
")",
"{",
"long",
"totalSize",
"=",
"0L",
";",
"if",
"(",
"null",
"==",
"lfs",
")",
"{",
"return",
"totalSize",
";",
"}",
"for",
"(",
"FileStatus",
"fsStat",
"... | Get the total logical size in the directory
@param lfs the Files under the directory
@return | [
"Get",
"the",
"total",
"logical",
"size",
"in",
"the",
"directory"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/DirectoryStripeReader.java#L98-L108 |
119,029 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/raid/DirectoryStripeReader.java | DirectoryStripeReader.getDirPhysicalSize | public static long getDirPhysicalSize(List<FileStatus> lfs) {
long totalSize = 0L;
if (null == lfs) {
return totalSize;
}
for (FileStatus fsStat : lfs) {
totalSize += fsStat.getLen() * fsStat.getReplication();
}
return totalSize;
} | java | public static long getDirPhysicalSize(List<FileStatus> lfs) {
long totalSize = 0L;
if (null == lfs) {
return totalSize;
}
for (FileStatus fsStat : lfs) {
totalSize += fsStat.getLen() * fsStat.getReplication();
}
return totalSize;
} | [
"public",
"static",
"long",
"getDirPhysicalSize",
"(",
"List",
"<",
"FileStatus",
">",
"lfs",
")",
"{",
"long",
"totalSize",
"=",
"0L",
";",
"if",
"(",
"null",
"==",
"lfs",
")",
"{",
"return",
"totalSize",
";",
"}",
"for",
"(",
"FileStatus",
"fsStat",
... | Get the total physical size in the directory
@param lfs the Files under the directory
@return | [
"Get",
"the",
"total",
"physical",
"size",
"in",
"the",
"directory"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/DirectoryStripeReader.java#L115-L125 |
119,030 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/record/BinaryRecordOutput.java | BinaryRecordOutput.get | public static BinaryRecordOutput get(DataOutput out) {
BinaryRecordOutput bout = (BinaryRecordOutput) bOut.get();
bout.setDataOutput(out);
return bout;
} | java | public static BinaryRecordOutput get(DataOutput out) {
BinaryRecordOutput bout = (BinaryRecordOutput) bOut.get();
bout.setDataOutput(out);
return bout;
} | [
"public",
"static",
"BinaryRecordOutput",
"get",
"(",
"DataOutput",
"out",
")",
"{",
"BinaryRecordOutput",
"bout",
"=",
"(",
"BinaryRecordOutput",
")",
"bOut",
".",
"get",
"(",
")",
";",
"bout",
".",
"setDataOutput",
"(",
"out",
")",
";",
"return",
"bout",
... | Get a thread-local record output for the supplied DataOutput.
@param out data output stream
@return binary record output corresponding to the supplied DataOutput. | [
"Get",
"a",
"thread",
"-",
"local",
"record",
"output",
"for",
"the",
"supplied",
"DataOutput",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/record/BinaryRecordOutput.java#L51-L55 |
119,031 | facebookarchive/hadoop-20 | src/contrib/index/src/java/org/apache/hadoop/contrib/index/lucene/LuceneUtil.java | LuceneUtil.isSegmentsFile | public static boolean isSegmentsFile(String name) {
return name.startsWith(IndexFileNames.SEGMENTS)
&& !name.equals(IndexFileNames.SEGMENTS_GEN);
} | java | public static boolean isSegmentsFile(String name) {
return name.startsWith(IndexFileNames.SEGMENTS)
&& !name.equals(IndexFileNames.SEGMENTS_GEN);
} | [
"public",
"static",
"boolean",
"isSegmentsFile",
"(",
"String",
"name",
")",
"{",
"return",
"name",
".",
"startsWith",
"(",
"IndexFileNames",
".",
"SEGMENTS",
")",
"&&",
"!",
"name",
".",
"equals",
"(",
"IndexFileNames",
".",
"SEGMENTS_GEN",
")",
";",
"}"
] | Check if the file is a segments_N file
@param name
@return true if the file is a segments_N file | [
"Check",
"if",
"the",
"file",
"is",
"a",
"segments_N",
"file"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/index/src/java/org/apache/hadoop/contrib/index/lucene/LuceneUtil.java#L44-L47 |
119,032 | facebookarchive/hadoop-20 | src/contrib/index/src/java/org/apache/hadoop/contrib/index/lucene/LuceneUtil.java | LuceneUtil.generationFromSegmentsFileName | public static long generationFromSegmentsFileName(String fileName) {
if (fileName.equals(IndexFileNames.SEGMENTS)) {
return 0;
} else if (fileName.startsWith(IndexFileNames.SEGMENTS)) {
return Long.parseLong(
fileName.substring(1 + IndexFileNames.SEGMENTS.length()),
Charact... | java | public static long generationFromSegmentsFileName(String fileName) {
if (fileName.equals(IndexFileNames.SEGMENTS)) {
return 0;
} else if (fileName.startsWith(IndexFileNames.SEGMENTS)) {
return Long.parseLong(
fileName.substring(1 + IndexFileNames.SEGMENTS.length()),
Charact... | [
"public",
"static",
"long",
"generationFromSegmentsFileName",
"(",
"String",
"fileName",
")",
"{",
"if",
"(",
"fileName",
".",
"equals",
"(",
"IndexFileNames",
".",
"SEGMENTS",
")",
")",
"{",
"return",
"0",
";",
"}",
"else",
"if",
"(",
"fileName",
".",
"st... | Parse the generation off the segments file name and return it. | [
"Parse",
"the",
"generation",
"off",
"the",
"segments",
"file",
"name",
"and",
"return",
"it",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/index/src/java/org/apache/hadoop/contrib/index/lucene/LuceneUtil.java#L99-L110 |
119,033 | facebookarchive/hadoop-20 | src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/SimpleSeekableFormatInputStream.java | SimpleSeekableFormatInputStream.createInterleavedInputStream | protected InterleavedInputStream createInterleavedInputStream(InputStream in,
int metaDataBlockLength, int dataBlockLength,
SimpleSeekableFormat.MetaDataConsumer consumer) {
return new InterleavedInputStream(in, metaDataBlockLength, dataBlockLength, consumer);
} | java | protected InterleavedInputStream createInterleavedInputStream(InputStream in,
int metaDataBlockLength, int dataBlockLength,
SimpleSeekableFormat.MetaDataConsumer consumer) {
return new InterleavedInputStream(in, metaDataBlockLength, dataBlockLength, consumer);
} | [
"protected",
"InterleavedInputStream",
"createInterleavedInputStream",
"(",
"InputStream",
"in",
",",
"int",
"metaDataBlockLength",
",",
"int",
"dataBlockLength",
",",
"SimpleSeekableFormat",
".",
"MetaDataConsumer",
"consumer",
")",
"{",
"return",
"new",
"InterleavedInputS... | This factory method can be overwritten by subclass to provide different behavior.
It's only called in the constructor. | [
"This",
"factory",
"method",
"can",
"be",
"overwritten",
"by",
"subclass",
"to",
"provide",
"different",
"behavior",
".",
"It",
"s",
"only",
"called",
"in",
"the",
"constructor",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/SimpleSeekableFormatInputStream.java#L54-L58 |
119,034 | facebookarchive/hadoop-20 | src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/SimpleSeekableFormatInputStream.java | SimpleSeekableFormatInputStream.moveToNextDataSegment | private boolean moveToNextDataSegment() throws IOException {
try {
clearDataSegment();
DataSegmentReader dataSegmentReader =
new DataSegmentReader(dataIn, conf, decompressorCache);
dataSegmentIn = dataSegmentReader.getInputStream();
} catch (EmptyDataSegmentException e){
// no ... | java | private boolean moveToNextDataSegment() throws IOException {
try {
clearDataSegment();
DataSegmentReader dataSegmentReader =
new DataSegmentReader(dataIn, conf, decompressorCache);
dataSegmentIn = dataSegmentReader.getInputStream();
} catch (EmptyDataSegmentException e){
// no ... | [
"private",
"boolean",
"moveToNextDataSegment",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"clearDataSegment",
"(",
")",
";",
"DataSegmentReader",
"dataSegmentReader",
"=",
"new",
"DataSegmentReader",
"(",
"dataIn",
",",
"conf",
",",
"decompressorCache",
")"... | Returns false if there are no more data segments. | [
"Returns",
"false",
"if",
"there",
"are",
"no",
"more",
"data",
"segments",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/SimpleSeekableFormatInputStream.java#L137-L154 |
119,035 | facebookarchive/hadoop-20 | src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/SimpleSeekableFormatInputStream.java | SimpleSeekableFormatInputStream.seekForward | public long seekForward() throws IOException {
// Try to read the last metadata block
interleavedIn.skipToLastAvailableMetaDataBlock();
if (!interleavedIn.readMetaDataIfNeeded()) {
throw new EOFException("Cannot get a complete metadata block");
}
// Move the interleavedIn to the beginning of ... | java | public long seekForward() throws IOException {
// Try to read the last metadata block
interleavedIn.skipToLastAvailableMetaDataBlock();
if (!interleavedIn.readMetaDataIfNeeded()) {
throw new EOFException("Cannot get a complete metadata block");
}
// Move the interleavedIn to the beginning of ... | [
"public",
"long",
"seekForward",
"(",
")",
"throws",
"IOException",
"{",
"// Try to read the last metadata block",
"interleavedIn",
".",
"skipToLastAvailableMetaDataBlock",
"(",
")",
";",
"if",
"(",
"!",
"interleavedIn",
".",
"readMetaDataIfNeeded",
"(",
")",
")",
"{"... | This function seeks forward using all "available" bytes.
It returns the offset after the seek.
This function throws EOFException if there are no available complete metaDataBlock
or the metaDataBlock points to a position after the file end (e.g. truncated files). | [
"This",
"function",
"seeks",
"forward",
"using",
"all",
"available",
"bytes",
".",
"It",
"returns",
"the",
"offset",
"after",
"the",
"seek",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/SimpleSeekableFormatInputStream.java#L178-L203 |
119,036 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/BookKeeperEditLogInputStream.java | BookKeeperEditLogInputStream.refresh | @Override
public void refresh(long position, long skippedUntilTxid) throws IOException {
checkInitialized();
if (isInProgress()) {
// If a ledger is in progress, re-open it for reading in order
// to determine the correct bounds of the ledger.
LedgerHandle ledger = ledgerProvider.openForRea... | java | @Override
public void refresh(long position, long skippedUntilTxid) throws IOException {
checkInitialized();
if (isInProgress()) {
// If a ledger is in progress, re-open it for reading in order
// to determine the correct bounds of the ledger.
LedgerHandle ledger = ledgerProvider.openForRea... | [
"@",
"Override",
"public",
"void",
"refresh",
"(",
"long",
"position",
",",
"long",
"skippedUntilTxid",
")",
"throws",
"IOException",
"{",
"checkInitialized",
"(",
")",
";",
"if",
"(",
"isInProgress",
"(",
")",
")",
"{",
"// If a ledger is in progress, re-open it ... | Refresh, preferably to a known position
@see EditLogInputStream#refresh(long)
@see BookKeeperJournalInputStream#position(long) | [
"Refresh",
"preferably",
"to",
"a",
"known",
"position"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/BookKeeperEditLogInputStream.java#L288-L309 |
119,037 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/DFSLocatedBlocks.java | DFSLocatedBlocks.blockLocationInfoExpiresIfNeeded | public void blockLocationInfoExpiresIfNeeded() {
if (blkLocInfoExpireTimeout < 0) {
return;
}
long timeNow = System.currentTimeMillis();
if (timeBlkLocInfoExpire < timeNow) {
this.writeLock();
try {
long newTimeBlockExpire = Long.MAX_VALUE;
List<LocatedBlock> listToRemo... | java | public void blockLocationInfoExpiresIfNeeded() {
if (blkLocInfoExpireTimeout < 0) {
return;
}
long timeNow = System.currentTimeMillis();
if (timeBlkLocInfoExpire < timeNow) {
this.writeLock();
try {
long newTimeBlockExpire = Long.MAX_VALUE;
List<LocatedBlock> listToRemo... | [
"public",
"void",
"blockLocationInfoExpiresIfNeeded",
"(",
")",
"{",
"if",
"(",
"blkLocInfoExpireTimeout",
"<",
"0",
")",
"{",
"return",
";",
"}",
"long",
"timeNow",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"timeBlkLocInfoExpire",
"<"... | Deprecate block location information that has lived for too long | [
"Deprecate",
"block",
"location",
"information",
"that",
"has",
"lived",
"for",
"too",
"long"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSLocatedBlocks.java#L48-L79 |
119,038 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/DFSLocatedBlocks.java | DFSLocatedBlocks.initBlkLocInfoExpireMap | private void initBlkLocInfoExpireMap(long expireTime) {
if (blkLocInfoExpireTimeout < 0) {
return;
}
this.blkLocInfoExpireMap = new HashMap<LocatedBlock, Long>(this
.getLocatedBlocks().size());
for (LocatedBlock lb : this.getLocatedBlocks()) {
blkLocInfoExpireMap.put(lb, expireTime)... | java | private void initBlkLocInfoExpireMap(long expireTime) {
if (blkLocInfoExpireTimeout < 0) {
return;
}
this.blkLocInfoExpireMap = new HashMap<LocatedBlock, Long>(this
.getLocatedBlocks().size());
for (LocatedBlock lb : this.getLocatedBlocks()) {
blkLocInfoExpireMap.put(lb, expireTime)... | [
"private",
"void",
"initBlkLocInfoExpireMap",
"(",
"long",
"expireTime",
")",
"{",
"if",
"(",
"blkLocInfoExpireTimeout",
"<",
"0",
")",
"{",
"return",
";",
"}",
"this",
".",
"blkLocInfoExpireMap",
"=",
"new",
"HashMap",
"<",
"LocatedBlock",
",",
"Long",
">",
... | Initial the blockExpireMap, which keeps track of the expiration time of all
block location info.
@param expireTime
time for the located block to expire | [
"Initial",
"the",
"blockExpireMap",
"which",
"keeps",
"track",
"of",
"the",
"expiration",
"time",
"of",
"all",
"block",
"location",
"info",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSLocatedBlocks.java#L88-L99 |
119,039 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/DFSLocatedBlocks.java | DFSLocatedBlocks.isUnderConstructionBlock | public boolean isUnderConstructionBlock(Block block) {
if (!isUnderConstruction()) {
return false;
}
LocatedBlock lastBlock = this.get(this.locatedBlockCount() - 1);
// There are potential inconsistency when counting the size of the
// last block, but fileLength is not likely to be under-esti... | java | public boolean isUnderConstructionBlock(Block block) {
if (!isUnderConstruction()) {
return false;
}
LocatedBlock lastBlock = this.get(this.locatedBlockCount() - 1);
// There are potential inconsistency when counting the size of the
// last block, but fileLength is not likely to be under-esti... | [
"public",
"boolean",
"isUnderConstructionBlock",
"(",
"Block",
"block",
")",
"{",
"if",
"(",
"!",
"isUnderConstruction",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"LocatedBlock",
"lastBlock",
"=",
"this",
".",
"get",
"(",
"this",
".",
"locatedBlockCou... | Determine whether the input block is the block under-construction
for the file. If the current file is not under-construction, always
false is returned.
The result is the best guess based on unknown
information. The bottom line is, when the position equals to file length,
the block selected will be return true. This h... | [
"Determine",
"whether",
"the",
"input",
"block",
"is",
"the",
"block",
"under",
"-",
"construction",
"for",
"the",
"file",
".",
"If",
"the",
"current",
"file",
"is",
"not",
"under",
"-",
"construction",
"always",
"false",
"is",
"returned",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSLocatedBlocks.java#L300-L315 |
119,040 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Counters.java | Counters.findCounter | public synchronized Counter findCounter(String group, String name) {
return getGroup(group).getCounterForName(name);
} | java | public synchronized Counter findCounter(String group, String name) {
return getGroup(group).getCounterForName(name);
} | [
"public",
"synchronized",
"Counter",
"findCounter",
"(",
"String",
"group",
",",
"String",
"name",
")",
"{",
"return",
"getGroup",
"(",
"group",
")",
".",
"getCounterForName",
"(",
"name",
")",
";",
"}"
] | Find a counter given the group and the name.
@param group the name of the group
@param name the internal name of the counter
@return the counter for that name | [
"Find",
"a",
"counter",
"given",
"the",
"group",
"and",
"the",
"name",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Counters.java#L390-L392 |
119,041 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Counters.java | Counters.findCounter | @Deprecated
public synchronized Counter findCounter(String group, int id, String name) {
return getGroup(group).getCounterForName(name);
} | java | @Deprecated
public synchronized Counter findCounter(String group, int id, String name) {
return getGroup(group).getCounterForName(name);
} | [
"@",
"Deprecated",
"public",
"synchronized",
"Counter",
"findCounter",
"(",
"String",
"group",
",",
"int",
"id",
",",
"String",
"name",
")",
"{",
"return",
"getGroup",
"(",
"group",
")",
".",
"getCounterForName",
"(",
"name",
")",
";",
"}"
] | Find a counter by using strings
@param group the name of the group
@param id the id of the counter within the group (0 to N-1)
@param name the internal name of the counter
@return the counter for that name
@deprecated | [
"Find",
"a",
"counter",
"by",
"using",
"strings"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Counters.java#L402-L405 |
119,042 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Counters.java | Counters.incrCounter | public synchronized void incrCounter(String group, String counter, long amount) {
getGroup(group).getCounterForName(counter).increment(amount);
} | java | public synchronized void incrCounter(String group, String counter, long amount) {
getGroup(group).getCounterForName(counter).increment(amount);
} | [
"public",
"synchronized",
"void",
"incrCounter",
"(",
"String",
"group",
",",
"String",
"counter",
",",
"long",
"amount",
")",
"{",
"getGroup",
"(",
"group",
")",
".",
"getCounterForName",
"(",
"counter",
")",
".",
"increment",
"(",
"amount",
")",
";",
"}"... | Increments the specified counter by the specified amount, creating it if
it didn't already exist.
@param group the name of the group
@param counter the internal name of the counter
@param amount amount by which counter is to be incremented | [
"Increments",
"the",
"specified",
"counter",
"by",
"the",
"specified",
"amount",
"creating",
"it",
"if",
"it",
"didn",
"t",
"already",
"exist",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Counters.java#L424-L426 |
119,043 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Counters.java | Counters.sum | public static Counters sum(Counters a, Counters b) {
Counters counters = new Counters();
counters.incrAllCounters(a);
counters.incrAllCounters(b);
return counters;
} | java | public static Counters sum(Counters a, Counters b) {
Counters counters = new Counters();
counters.incrAllCounters(a);
counters.incrAllCounters(b);
return counters;
} | [
"public",
"static",
"Counters",
"sum",
"(",
"Counters",
"a",
",",
"Counters",
"b",
")",
"{",
"Counters",
"counters",
"=",
"new",
"Counters",
"(",
")",
";",
"counters",
".",
"incrAllCounters",
"(",
"a",
")",
";",
"counters",
".",
"incrAllCounters",
"(",
"... | Convenience method for computing the sum of two sets of counters. | [
"Convenience",
"method",
"for",
"computing",
"the",
"sum",
"of",
"two",
"sets",
"of",
"counters",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Counters.java#L456-L461 |
119,044 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Counters.java | Counters.log | public void log(Log log) {
log.info("Counters: " + size());
for(Group group: this) {
log.info(" " + group.getDisplayName());
for (Counter counter: group) {
log.info(" " + counter.getDisplayName() + "=" +
counter.getCounter());
}
}
} | java | public void log(Log log) {
log.info("Counters: " + size());
for(Group group: this) {
log.info(" " + group.getDisplayName());
for (Counter counter: group) {
log.info(" " + counter.getDisplayName() + "=" +
counter.getCounter());
}
}
} | [
"public",
"void",
"log",
"(",
"Log",
"log",
")",
"{",
"log",
".",
"info",
"(",
"\"Counters: \"",
"+",
"size",
"(",
")",
")",
";",
"for",
"(",
"Group",
"group",
":",
"this",
")",
"{",
"log",
".",
"info",
"(",
"\" \"",
"+",
"group",
".",
"getDispl... | Logs the current counter values.
@param log The log to use. | [
"Logs",
"the",
"current",
"counter",
"values",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Counters.java#L515-L524 |
119,045 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Counters.java | Counters.makeCompactString | public synchronized String makeCompactString() {
StringBuffer buffer = new StringBuffer();
boolean first = true;
for(Group group: this){
for(Counter counter: group) {
if (first) {
first = false;
} else {
buffer.append(',');
}
buffer.append(group.g... | java | public synchronized String makeCompactString() {
StringBuffer buffer = new StringBuffer();
boolean first = true;
for(Group group: this){
for(Counter counter: group) {
if (first) {
first = false;
} else {
buffer.append(',');
}
buffer.append(group.g... | [
"public",
"synchronized",
"String",
"makeCompactString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"boolean",
"first",
"=",
"true",
";",
"for",
"(",
"Group",
"group",
":",
"this",
")",
"{",
"for",
"(",
"Counter",
... | Convert a counters object into a single line that is easy to parse.
@return the string with "name=value" for each counter and separated by "," | [
"Convert",
"a",
"counters",
"object",
"into",
"a",
"single",
"line",
"that",
"is",
"easy",
"to",
"parse",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Counters.java#L545-L563 |
119,046 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Counters.java | Counters.makeJsonString | public synchronized String makeJsonString() {
Map<String, Map<String, Long>> data =
new HashMap<String, Map<String, Long>>();
for (Group group : this) {
Map<String, Long> groupData = new HashMap<String, Long>();
data.put(group.getDisplayName(), groupData);
for (Counter counte... | java | public synchronized String makeJsonString() {
Map<String, Map<String, Long>> data =
new HashMap<String, Map<String, Long>>();
for (Group group : this) {
Map<String, Long> groupData = new HashMap<String, Long>();
data.put(group.getDisplayName(), groupData);
for (Counter counte... | [
"public",
"synchronized",
"String",
"makeJsonString",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"Long",
">",
">",
"data",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"Long",
">",
">",
"(",
")",
"... | Convert a counters object into a JSON string | [
"Convert",
"a",
"counters",
"object",
"into",
"a",
"JSON",
"string"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Counters.java#L568-L581 |
119,047 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Counters.java | Counters.makeEscapedCompactString | public synchronized String makeEscapedCompactString() {
StringBuffer buffer = new StringBuffer();
for(Group group: this){
buffer.append(group.makeEscapedCompactString());
}
return buffer.toString();
} | java | public synchronized String makeEscapedCompactString() {
StringBuffer buffer = new StringBuffer();
for(Group group: this){
buffer.append(group.makeEscapedCompactString());
}
return buffer.toString();
} | [
"public",
"synchronized",
"String",
"makeEscapedCompactString",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"Group",
"group",
":",
"this",
")",
"{",
"buffer",
".",
"append",
"(",
"group",
".",
"makeEscapedC... | Represent the counter in a textual format that can be converted back to
its object form
@return the string in the following format
{(groupname)(group-displayname)[(countername)(displayname)(value)][][]}{}{} | [
"Represent",
"the",
"counter",
"in",
"a",
"textual",
"format",
"that",
"can",
"be",
"converted",
"back",
"to",
"its",
"object",
"form"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Counters.java#L589-L595 |
119,048 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Counters.java | Counters.getBlock | private static String getBlock(String str, char open, char close,
IntWritable index) throws ParseException {
StringBuilder split = new StringBuilder();
int next = StringUtils.findNext(str, open, StringUtils.ESCAPE_CHAR,
index.get(), split);
... | java | private static String getBlock(String str, char open, char close,
IntWritable index) throws ParseException {
StringBuilder split = new StringBuilder();
int next = StringUtils.findNext(str, open, StringUtils.ESCAPE_CHAR,
index.get(), split);
... | [
"private",
"static",
"String",
"getBlock",
"(",
"String",
"str",
",",
"char",
"open",
",",
"char",
"close",
",",
"IntWritable",
"index",
")",
"throws",
"ParseException",
"{",
"StringBuilder",
"split",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"next"... | returns null. | [
"returns",
"null",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Counters.java#L600-L620 |
119,049 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapreduce/lib/output/FileOutputFormat.java | FileOutputFormat.getUniqueFile | public synchronized static String getUniqueFile(TaskAttemptContext context,
String name,
String extension) {
TaskID taskId = context.getTaskAttemptID().getTaskID();
int partition = taskId.getId();
StringBuild... | java | public synchronized static String getUniqueFile(TaskAttemptContext context,
String name,
String extension) {
TaskID taskId = context.getTaskAttemptID().getTaskID();
int partition = taskId.getId();
StringBuild... | [
"public",
"synchronized",
"static",
"String",
"getUniqueFile",
"(",
"TaskAttemptContext",
"context",
",",
"String",
"name",
",",
"String",
"extension",
")",
"{",
"TaskID",
"taskId",
"=",
"context",
".",
"getTaskAttemptID",
"(",
")",
".",
"getTaskID",
"(",
")",
... | Generate a unique filename, based on the task id, name, and extension
@param context the task that is calling this
@param name the base filename
@param extension the filename extension
@return a string like $name-[mr]-$id$extension | [
"Generate",
"a",
"unique",
"filename",
"based",
"on",
"the",
"task",
"id",
"name",
"and",
"extension"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/lib/output/FileOutputFormat.java#L229-L242 |
119,050 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapreduce/lib/output/FileOutputFormat.java | FileOutputFormat.getDefaultWorkFile | public Path getDefaultWorkFile(TaskAttemptContext context,
String extension) throws IOException{
FileOutputCommitter committer =
(FileOutputCommitter) getOutputCommitter(context);
return new Path(committer.getWorkPath(), getUniqueFile(context, "part",
... | java | public Path getDefaultWorkFile(TaskAttemptContext context,
String extension) throws IOException{
FileOutputCommitter committer =
(FileOutputCommitter) getOutputCommitter(context);
return new Path(committer.getWorkPath(), getUniqueFile(context, "part",
... | [
"public",
"Path",
"getDefaultWorkFile",
"(",
"TaskAttemptContext",
"context",
",",
"String",
"extension",
")",
"throws",
"IOException",
"{",
"FileOutputCommitter",
"committer",
"=",
"(",
"FileOutputCommitter",
")",
"getOutputCommitter",
"(",
"context",
")",
";",
"retu... | Get the default path and filename for the output format.
@param context the task context
@param extension an extension to add to the filename
@return a full path $output/_temporary/$taskid/part-[mr]-$id
@throws IOException | [
"Get",
"the",
"default",
"path",
"and",
"filename",
"for",
"the",
"output",
"format",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/lib/output/FileOutputFormat.java#L251-L257 |
119,051 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorCombiner.java | ValueAggregatorCombiner.reduce | public void reduce(Text key, Iterator<Text> values,
OutputCollector<Text, Text> output, Reporter reporter) throws IOException {
String keyStr = key.toString();
int pos = keyStr.indexOf(ValueAggregatorDescriptor.TYPE_SEPARATOR);
String type = keyStr.substring(0, pos);
ValueAggregator... | java | public void reduce(Text key, Iterator<Text> values,
OutputCollector<Text, Text> output, Reporter reporter) throws IOException {
String keyStr = key.toString();
int pos = keyStr.indexOf(ValueAggregatorDescriptor.TYPE_SEPARATOR);
String type = keyStr.substring(0, pos);
ValueAggregator... | [
"public",
"void",
"reduce",
"(",
"Text",
"key",
",",
"Iterator",
"<",
"Text",
">",
"values",
",",
"OutputCollector",
"<",
"Text",
",",
"Text",
">",
"output",
",",
"Reporter",
"reporter",
")",
"throws",
"IOException",
"{",
"String",
"keyStr",
"=",
"key",
... | Combines values for a given key.
@param key the key is expected to be a Text object, whose prefix indicates
the type of aggregation to aggregate the values.
@param values the values to combine
@param output to collect combined values | [
"Combines",
"values",
"for",
"a",
"given",
"key",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorCombiner.java#L51-L71 |
119,052 | facebookarchive/hadoop-20 | src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/MemoryMatcher.java | MemoryMatcher.getMemReservedForTasks | synchronized Long getMemReservedForTasks(
TaskTrackerStatus taskTracker, TaskType taskType) {
long vmem = 0;
for (TaskStatus task : taskTracker.getTaskReports()) {
// the following task states are one in which the slot is
// still occupied and hence memory of the task should be
// accou... | java | synchronized Long getMemReservedForTasks(
TaskTrackerStatus taskTracker, TaskType taskType) {
long vmem = 0;
for (TaskStatus task : taskTracker.getTaskReports()) {
// the following task states are one in which the slot is
// still occupied and hence memory of the task should be
// accou... | [
"synchronized",
"Long",
"getMemReservedForTasks",
"(",
"TaskTrackerStatus",
"taskTracker",
",",
"TaskType",
"taskType",
")",
"{",
"long",
"vmem",
"=",
"0",
";",
"for",
"(",
"TaskStatus",
"task",
":",
"taskTracker",
".",
"getTaskReports",
"(",
")",
")",
"{",
"/... | Find the memory that is already used by all the running tasks
residing on the given TaskTracker.
@param taskTracker
@param taskType
@return amount of memory that is used by the residing tasks,
null if memory cannot be computed for some reason. | [
"Find",
"the",
"memory",
"that",
"is",
"already",
"used",
"by",
"all",
"the",
"running",
"tasks",
"residing",
"on",
"the",
"given",
"TaskTracker",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/MemoryMatcher.java#L57-L84 |
119,053 | facebookarchive/hadoop-20 | src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/MemoryMatcher.java | MemoryMatcher.matchesMemoryRequirements | boolean matchesMemoryRequirements(JobInProgress job,TaskType taskType,
TaskTrackerStatus taskTracker) {
LOG.debug("Matching memory requirements of " + job.getJobID().toString()
+ " for scheduling on " + taskTracker.trackerName);
if (!isSchedulingBasedOnMemEnabled()... | java | boolean matchesMemoryRequirements(JobInProgress job,TaskType taskType,
TaskTrackerStatus taskTracker) {
LOG.debug("Matching memory requirements of " + job.getJobID().toString()
+ " for scheduling on " + taskTracker.trackerName);
if (!isSchedulingBasedOnMemEnabled()... | [
"boolean",
"matchesMemoryRequirements",
"(",
"JobInProgress",
"job",
",",
"TaskType",
"taskType",
",",
"TaskTrackerStatus",
"taskTracker",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Matching memory requirements of \"",
"+",
"job",
".",
"getJobID",
"(",
")",
".",
"toStri... | Check if a TT has enough memory to run of task specified from this job.
@param job
@param taskType
@param taskTracker
@return true if this TT has enough memory for this job. False otherwise. | [
"Check",
"if",
"a",
"TT",
"has",
"enough",
"memory",
"to",
"run",
"of",
"task",
"specified",
"from",
"this",
"job",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/MemoryMatcher.java#L93-L137 |
119,054 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/LocalDirAllocator.java | LocalDirAllocator.getLocalPathToRead | public Path getLocalPathToRead(String pathStr,
Configuration conf) throws IOException {
AllocatorPerContext context = obtainContext(contextCfgItemName);
return context.getLocalPathToRead(pathStr, conf);
} | java | public Path getLocalPathToRead(String pathStr,
Configuration conf) throws IOException {
AllocatorPerContext context = obtainContext(contextCfgItemName);
return context.getLocalPathToRead(pathStr, conf);
} | [
"public",
"Path",
"getLocalPathToRead",
"(",
"String",
"pathStr",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"AllocatorPerContext",
"context",
"=",
"obtainContext",
"(",
"contextCfgItemName",
")",
";",
"return",
"context",
".",
"getLocalPathToRea... | Get a path from the local FS for reading. We search through all the
configured dirs for the file's existence and return the complete
path to the file when we find one
@param pathStr the requested file (this will be searched)
@param conf the Configuration object
@return the complete path to the file on a local disk
@thr... | [
"Get",
"a",
"path",
"from",
"the",
"local",
"FS",
"for",
"reading",
".",
"We",
"search",
"through",
"all",
"the",
"configured",
"dirs",
"for",
"the",
"file",
"s",
"existence",
"and",
"return",
"the",
"complete",
"path",
"to",
"the",
"file",
"when",
"we",... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/LocalDirAllocator.java#L136-L140 |
119,055 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/LocalDirAllocator.java | LocalDirAllocator.ifExists | public boolean ifExists(String pathStr,Configuration conf) {
AllocatorPerContext context = obtainContext(contextCfgItemName);
return context.ifExists(pathStr, conf);
} | java | public boolean ifExists(String pathStr,Configuration conf) {
AllocatorPerContext context = obtainContext(contextCfgItemName);
return context.ifExists(pathStr, conf);
} | [
"public",
"boolean",
"ifExists",
"(",
"String",
"pathStr",
",",
"Configuration",
"conf",
")",
"{",
"AllocatorPerContext",
"context",
"=",
"obtainContext",
"(",
"contextCfgItemName",
")",
";",
"return",
"context",
".",
"ifExists",
"(",
"pathStr",
",",
"conf",
")"... | We search through all the configured dirs for the file's existence
and return true when we find
@param pathStr the requested file (this will be searched)
@param conf the Configuration object
@return true if files exist. false otherwise
@throws IOException | [
"We",
"search",
"through",
"all",
"the",
"configured",
"dirs",
"for",
"the",
"file",
"s",
"existence",
"and",
"return",
"true",
"when",
"we",
"find"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/LocalDirAllocator.java#L176-L179 |
119,056 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarShell.java | AvatarShell.waitForLastTxIdNode | private void waitForLastTxIdNode(AvatarZooKeeperClient zk, Configuration conf)
throws Exception {
// Gather session id and transaction id data.
String address = conf.get(NameNode.DFS_NAMENODE_RPC_ADDRESS_KEY);
long maxWaitTime = this.getMaxWaitTimeForWaitTxid();
long start = System.currentTimeMill... | java | private void waitForLastTxIdNode(AvatarZooKeeperClient zk, Configuration conf)
throws Exception {
// Gather session id and transaction id data.
String address = conf.get(NameNode.DFS_NAMENODE_RPC_ADDRESS_KEY);
long maxWaitTime = this.getMaxWaitTimeForWaitTxid();
long start = System.currentTimeMill... | [
"private",
"void",
"waitForLastTxIdNode",
"(",
"AvatarZooKeeperClient",
"zk",
",",
"Configuration",
"conf",
")",
"throws",
"Exception",
"{",
"// Gather session id and transaction id data.",
"String",
"address",
"=",
"conf",
".",
"get",
"(",
"NameNode",
".",
"DFS_NAMENOD... | Waits till the last txid node appears in Zookeeper, such that it matches
the ssid node. | [
"Waits",
"till",
"the",
"last",
"txid",
"node",
"appears",
"in",
"Zookeeper",
"such",
"that",
"it",
"matches",
"the",
"ssid",
"node",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarShell.java#L216-L243 |
119,057 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarShell.java | AvatarShell.setAvatar | public int setAvatar(String role, boolean noverification, String serviceName, String instance)
throws IOException {
Avatar dest;
if (Avatar.ACTIVE.toString().equalsIgnoreCase(role)) {
dest = Avatar.ACTIVE;
} else if (Avatar.STANDBY.toString().equalsIgnoreCase(role)) {
throw new IOException... | java | public int setAvatar(String role, boolean noverification, String serviceName, String instance)
throws IOException {
Avatar dest;
if (Avatar.ACTIVE.toString().equalsIgnoreCase(role)) {
dest = Avatar.ACTIVE;
} else if (Avatar.STANDBY.toString().equalsIgnoreCase(role)) {
throw new IOException... | [
"public",
"int",
"setAvatar",
"(",
"String",
"role",
",",
"boolean",
"noverification",
",",
"String",
"serviceName",
",",
"String",
"instance",
")",
"throws",
"IOException",
"{",
"Avatar",
"dest",
";",
"if",
"(",
"Avatar",
".",
"ACTIVE",
".",
"toString",
"("... | Sets the avatar to the specified value | [
"Sets",
"the",
"avatar",
"to",
"the",
"specified",
"value"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarShell.java#L590-L614 |
119,058 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarShell.java | AvatarShell.isServiceSpecified | public static boolean isServiceSpecified(String command, Configuration conf,
String[] argv) {
if (conf.get(FSConstants.DFS_FEDERATION_NAMESERVICES) != null) {
for (int i = 0; i < argv.length; i++) {
if (argv[i].equals("-service")) {
// found service specs
return true;
... | java | public static boolean isServiceSpecified(String command, Configuration conf,
String[] argv) {
if (conf.get(FSConstants.DFS_FEDERATION_NAMESERVICES) != null) {
for (int i = 0; i < argv.length; i++) {
if (argv[i].equals("-service")) {
// found service specs
return true;
... | [
"public",
"static",
"boolean",
"isServiceSpecified",
"(",
"String",
"command",
",",
"Configuration",
"conf",
",",
"String",
"[",
"]",
"argv",
")",
"{",
"if",
"(",
"conf",
".",
"get",
"(",
"FSConstants",
".",
"DFS_FEDERATION_NAMESERVICES",
")",
"!=",
"null",
... | Checks if the service argument is specified in the command arguments. | [
"Checks",
"if",
"the",
"service",
"argument",
"is",
"specified",
"in",
"the",
"command",
"arguments",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarShell.java#L712-L726 |
119,059 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/MapTaskStatus.java | MapTaskStatus.calculateRate | private double calculateRate(long cumulative, long currentTime) {
long timeSinceMapStart = 0;
assert getPhase() == Phase.MAP : "MapTaskStatus not in map phase!";
long startTime = getStartTime();
timeSinceMapStart = currentTime - startTime;
if (timeSinceMapStart <= 0) {
LOG.error("Current time... | java | private double calculateRate(long cumulative, long currentTime) {
long timeSinceMapStart = 0;
assert getPhase() == Phase.MAP : "MapTaskStatus not in map phase!";
long startTime = getStartTime();
timeSinceMapStart = currentTime - startTime;
if (timeSinceMapStart <= 0) {
LOG.error("Current time... | [
"private",
"double",
"calculateRate",
"(",
"long",
"cumulative",
",",
"long",
"currentTime",
")",
"{",
"long",
"timeSinceMapStart",
"=",
"0",
";",
"assert",
"getPhase",
"(",
")",
"==",
"Phase",
".",
"MAP",
":",
"\"MapTaskStatus not in map phase!\"",
";",
"long",... | Helper function that calculate the rate, given the total so far and the
current time
@param cumulative
@param currentTime
@return | [
"Helper",
"function",
"that",
"calculate",
"the",
"rate",
"given",
"the",
"total",
"so",
"far",
"and",
"the",
"current",
"time"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/MapTaskStatus.java#L65-L78 |
119,060 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/ResourceLimit.java | ResourceLimit.hasEnoughMemory | public boolean hasEnoughMemory(ClusterNode node) {
int total = node.getTotal().memoryMB;
int free = node.getFree().memoryMB;
if (free < nodeReservedMemoryMB) {
if (LOG.isDebugEnabled()) {
LOG.debug(node.getHost() + " not enough memory." +
" totalMB:" + total +
" free:" + fr... | java | public boolean hasEnoughMemory(ClusterNode node) {
int total = node.getTotal().memoryMB;
int free = node.getFree().memoryMB;
if (free < nodeReservedMemoryMB) {
if (LOG.isDebugEnabled()) {
LOG.debug(node.getHost() + " not enough memory." +
" totalMB:" + total +
" free:" + fr... | [
"public",
"boolean",
"hasEnoughMemory",
"(",
"ClusterNode",
"node",
")",
"{",
"int",
"total",
"=",
"node",
".",
"getTotal",
"(",
")",
".",
"memoryMB",
";",
"int",
"free",
"=",
"node",
".",
"getFree",
"(",
")",
".",
"memoryMB",
";",
"if",
"(",
"free",
... | Check if the node has enough memory to run tasks
@param node node to check
@return true if the node has enough memory, false otherwise | [
"Check",
"if",
"the",
"node",
"has",
"enough",
"memory",
"to",
"run",
"tasks"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/ResourceLimit.java#L78-L91 |
119,061 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/ResourceLimit.java | ResourceLimit.hasEnoughDiskSpace | private boolean hasEnoughDiskSpace(ClusterNode node) {
int total = node.getTotal().diskGB;
int free = node.getFree().diskGB;
if (free < nodeReservedDiskGB) {
if (LOG.isDebugEnabled()) {
LOG.debug(node.getHost() + " not enough disk space." +
" totalMB:" + total +
" free:" + ... | java | private boolean hasEnoughDiskSpace(ClusterNode node) {
int total = node.getTotal().diskGB;
int free = node.getFree().diskGB;
if (free < nodeReservedDiskGB) {
if (LOG.isDebugEnabled()) {
LOG.debug(node.getHost() + " not enough disk space." +
" totalMB:" + total +
" free:" + ... | [
"private",
"boolean",
"hasEnoughDiskSpace",
"(",
"ClusterNode",
"node",
")",
"{",
"int",
"total",
"=",
"node",
".",
"getTotal",
"(",
")",
".",
"diskGB",
";",
"int",
"free",
"=",
"node",
".",
"getFree",
"(",
")",
".",
"diskGB",
";",
"if",
"(",
"free",
... | Check if the ndoe has enough disk space to run tasks
@param node the node to check
@return true if the node has enough space, false otherwise | [
"Check",
"if",
"the",
"ndoe",
"has",
"enough",
"disk",
"space",
"to",
"run",
"tasks"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/ResourceLimit.java#L98-L111 |
119,062 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/bloom/RetouchedBloomFilter.java | RetouchedBloomFilter.selectiveClearing | public void selectiveClearing(Key k, short scheme) {
if (k == null) {
throw new NullPointerException("Key can not be null");
}
if (!membershipTest(k)) {
throw new IllegalArgumentException("Key is not a member");
}
int index = 0;
int[] h = hash.hash(k);
switch(scheme) {
ca... | java | public void selectiveClearing(Key k, short scheme) {
if (k == null) {
throw new NullPointerException("Key can not be null");
}
if (!membershipTest(k)) {
throw new IllegalArgumentException("Key is not a member");
}
int index = 0;
int[] h = hash.hash(k);
switch(scheme) {
ca... | [
"public",
"void",
"selectiveClearing",
"(",
"Key",
"k",
",",
"short",
"scheme",
")",
"{",
"if",
"(",
"k",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Key can not be null\"",
")",
";",
"}",
"if",
"(",
"!",
"membershipTest",
"(",
... | Performs the selective clearing for a given key.
@param k The false positive key to remove from <i>this</i> retouched Bloom filter.
@param scheme The selective clearing scheme to apply. | [
"Performs",
"the",
"selective",
"clearing",
"for",
"a",
"given",
"key",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/bloom/RetouchedBloomFilter.java#L194-L230 |
119,063 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/bloom/RetouchedBloomFilter.java | RetouchedBloomFilter.minimumFnRemove | private int minimumFnRemove(int[] h) {
int minIndex = Integer.MAX_VALUE;
double minValue = Double.MAX_VALUE;
for (int i = 0; i < nbHash; i++) {
double keyWeight = getWeight(keyVector[h[i]]);
if (keyWeight < minValue) {
minIndex = h[i];
minValue = keyWeight;
}
}
... | java | private int minimumFnRemove(int[] h) {
int minIndex = Integer.MAX_VALUE;
double minValue = Double.MAX_VALUE;
for (int i = 0; i < nbHash; i++) {
double keyWeight = getWeight(keyVector[h[i]]);
if (keyWeight < minValue) {
minIndex = h[i];
minValue = keyWeight;
}
}
... | [
"private",
"int",
"minimumFnRemove",
"(",
"int",
"[",
"]",
"h",
")",
"{",
"int",
"minIndex",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"double",
"minValue",
"=",
"Double",
".",
"MAX_VALUE",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nbHash",... | Chooses the bit position that minimizes the number of false negative generated.
@param h The different bit positions.
@return The position that minimizes the number of false negative generated. | [
"Chooses",
"the",
"bit",
"position",
"that",
"minimizes",
"the",
"number",
"of",
"false",
"negative",
"generated",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/bloom/RetouchedBloomFilter.java#L245-L260 |
119,064 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/bloom/RetouchedBloomFilter.java | RetouchedBloomFilter.maximumFpRemove | private int maximumFpRemove(int[] h) {
int maxIndex = Integer.MIN_VALUE;
double maxValue = Double.MIN_VALUE;
for (int i = 0; i < nbHash; i++) {
double fpWeight = getWeight(fpVector[h[i]]);
if (fpWeight > maxValue) {
maxValue = fpWeight;
maxIndex = h[i];
}
}
retur... | java | private int maximumFpRemove(int[] h) {
int maxIndex = Integer.MIN_VALUE;
double maxValue = Double.MIN_VALUE;
for (int i = 0; i < nbHash; i++) {
double fpWeight = getWeight(fpVector[h[i]]);
if (fpWeight > maxValue) {
maxValue = fpWeight;
maxIndex = h[i];
}
}
retur... | [
"private",
"int",
"maximumFpRemove",
"(",
"int",
"[",
"]",
"h",
")",
"{",
"int",
"maxIndex",
"=",
"Integer",
".",
"MIN_VALUE",
";",
"double",
"maxValue",
"=",
"Double",
".",
"MIN_VALUE",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nbHash",... | Chooses the bit position that maximizes the number of false positive removed.
@param h The different bit positions.
@return The position that maximizes the number of false positive removed. | [
"Chooses",
"the",
"bit",
"position",
"that",
"maximizes",
"the",
"number",
"of",
"false",
"positive",
"removed",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/bloom/RetouchedBloomFilter.java#L267-L281 |
119,065 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/bloom/RetouchedBloomFilter.java | RetouchedBloomFilter.ratioRemove | private int ratioRemove(int[] h) {
computeRatio();
int minIndex = Integer.MAX_VALUE;
double minValue = Double.MAX_VALUE;
for (int i = 0; i < nbHash; i++) {
if (ratio[h[i]] < minValue) {
minValue = ratio[h[i]];
minIndex = h[i];
}
}
return minIndex;
} | java | private int ratioRemove(int[] h) {
computeRatio();
int minIndex = Integer.MAX_VALUE;
double minValue = Double.MAX_VALUE;
for (int i = 0; i < nbHash; i++) {
if (ratio[h[i]] < minValue) {
minValue = ratio[h[i]];
minIndex = h[i];
}
}
return minIndex;
} | [
"private",
"int",
"ratioRemove",
"(",
"int",
"[",
"]",
"h",
")",
"{",
"computeRatio",
"(",
")",
";",
"int",
"minIndex",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"double",
"minValue",
"=",
"Double",
".",
"MAX_VALUE",
";",
"for",
"(",
"int",
"i",
"=",
"0... | Chooses the bit position that minimizes the number of false negative generated while maximizing.
the number of false positive removed.
@param h The different bit positions.
@return The position that minimizes the number of false negative generated while maximizing. | [
"Chooses",
"the",
"bit",
"position",
"that",
"minimizes",
"the",
"number",
"of",
"false",
"negative",
"generated",
"while",
"maximizing",
".",
"the",
"number",
"of",
"false",
"positive",
"removed",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/bloom/RetouchedBloomFilter.java#L289-L302 |
119,066 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/bloom/RetouchedBloomFilter.java | RetouchedBloomFilter.clearBit | private void clearBit(int index) {
if (index < 0 || index >= vectorSize) {
throw new ArrayIndexOutOfBoundsException(index);
}
List<Key> kl = keyVector[index];
List<Key> fpl = fpVector[index];
// update key list
int listSize = kl.size();
for (int i = 0; i < listSize && !kl.isEmpty(); ... | java | private void clearBit(int index) {
if (index < 0 || index >= vectorSize) {
throw new ArrayIndexOutOfBoundsException(index);
}
List<Key> kl = keyVector[index];
List<Key> fpl = fpVector[index];
// update key list
int listSize = kl.size();
for (int i = 0; i < listSize && !kl.isEmpty(); ... | [
"private",
"void",
"clearBit",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"vectorSize",
")",
"{",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"index",
")",
";",
"}",
"List",
"<",
"Key",
">",
"kl",
"=",
... | Clears a specified bit in the bit vector and keeps up-to-date the KeyList vectors.
@param index The position of the bit to clear. | [
"Clears",
"a",
"specified",
"bit",
"in",
"the",
"bit",
"vector",
"and",
"keeps",
"up",
"-",
"to",
"-",
"date",
"the",
"KeyList",
"vectors",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/bloom/RetouchedBloomFilter.java#L308-L339 |
119,067 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/bloom/RetouchedBloomFilter.java | RetouchedBloomFilter.createVector | @SuppressWarnings("unchecked")
private void createVector() {
fpVector = new List[vectorSize];
keyVector = new List[vectorSize];
ratio = new double[vectorSize];
for (int i = 0; i < vectorSize; i++) {
fpVector[i] = Collections.synchronizedList(new ArrayList<Key>());
keyVector[i] = Collectio... | java | @SuppressWarnings("unchecked")
private void createVector() {
fpVector = new List[vectorSize];
keyVector = new List[vectorSize];
ratio = new double[vectorSize];
for (int i = 0; i < vectorSize; i++) {
fpVector[i] = Collections.synchronizedList(new ArrayList<Key>());
keyVector[i] = Collectio... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"createVector",
"(",
")",
"{",
"fpVector",
"=",
"new",
"List",
"[",
"vectorSize",
"]",
";",
"keyVector",
"=",
"new",
"List",
"[",
"vectorSize",
"]",
";",
"ratio",
"=",
"new",
"double",
... | Creates and initialises the various vectors. | [
"Creates",
"and",
"initialises",
"the",
"various",
"vectors",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/bloom/RetouchedBloomFilter.java#L387-L398 |
119,068 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java | AsyncLoggerSet.setEpoch | void setEpoch(long e) {
Preconditions.checkState(!isEpochEstablished(),
"Epoch already established: epoch=%s", myEpoch);
myEpoch = e;
for (AsyncLogger l : loggers) {
l.setEpoch(e);
}
} | java | void setEpoch(long e) {
Preconditions.checkState(!isEpochEstablished(),
"Epoch already established: epoch=%s", myEpoch);
myEpoch = e;
for (AsyncLogger l : loggers) {
l.setEpoch(e);
}
} | [
"void",
"setEpoch",
"(",
"long",
"e",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"isEpochEstablished",
"(",
")",
",",
"\"Epoch already established: epoch=%s\"",
",",
"myEpoch",
")",
";",
"myEpoch",
"=",
"e",
";",
"for",
"(",
"AsyncLogger",
"l",
... | Set the epoch number used for all future calls. | [
"Set",
"the",
"epoch",
"number",
"used",
"for",
"all",
"future",
"calls",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java#L67-L74 |
119,069 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java | AsyncLoggerSet.setCommittedTxId | public void setCommittedTxId(long txid, boolean force) {
for (AsyncLogger logger : loggers) {
logger.setCommittedTxId(txid, force);
}
} | java | public void setCommittedTxId(long txid, boolean force) {
for (AsyncLogger logger : loggers) {
logger.setCommittedTxId(txid, force);
}
} | [
"public",
"void",
"setCommittedTxId",
"(",
"long",
"txid",
",",
"boolean",
"force",
")",
"{",
"for",
"(",
"AsyncLogger",
"logger",
":",
"loggers",
")",
"{",
"logger",
".",
"setCommittedTxId",
"(",
"txid",
",",
"force",
")",
";",
"}",
"}"
] | Set the highest successfully committed txid seen by the writer.
This should be called after a successful write to a quorum, and is used
for extra sanity checks against the protocol. See HDFS-3863. | [
"Set",
"the",
"highest",
"successfully",
"committed",
"txid",
"seen",
"by",
"the",
"writer",
".",
"This",
"should",
"be",
"called",
"after",
"a",
"successful",
"write",
"to",
"a",
"quorum",
"and",
"is",
"used",
"for",
"extra",
"sanity",
"checks",
"against",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java#L81-L85 |
119,070 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java | AsyncLoggerSet.waitForWriteQuorum | <V> Map<AsyncLogger, V> waitForWriteQuorum(QuorumCall<AsyncLogger, V> q,
int timeoutMs, String operationName) throws IOException {
int majority = getMajoritySize();
int numLoggers = loggers.size();
checkMajoritySize(majority, numLoggers);
return waitForQuorumInternal(q, loggers.size(), majority, n... | java | <V> Map<AsyncLogger, V> waitForWriteQuorum(QuorumCall<AsyncLogger, V> q,
int timeoutMs, String operationName) throws IOException {
int majority = getMajoritySize();
int numLoggers = loggers.size();
checkMajoritySize(majority, numLoggers);
return waitForQuorumInternal(q, loggers.size(), majority, n... | [
"<",
"V",
">",
"Map",
"<",
"AsyncLogger",
",",
"V",
">",
"waitForWriteQuorum",
"(",
"QuorumCall",
"<",
"AsyncLogger",
",",
"V",
">",
"q",
",",
"int",
"timeoutMs",
",",
"String",
"operationName",
")",
"throws",
"IOException",
"{",
"int",
"majority",
"=",
... | Wait for a quorum of loggers to respond to the given call. If a quorum
can't be achieved, throws a QuorumException.
@param q the quorum call
@param timeoutMs the number of millis to wait
@param operationName textual description of the operation, for logging
@return a map of successful results
@throws QuorumException if... | [
"Wait",
"for",
"a",
"quorum",
"of",
"loggers",
"to",
"respond",
"to",
"the",
"given",
"call",
".",
"If",
"a",
"quorum",
"can",
"t",
"be",
"achieved",
"throws",
"a",
"QuorumException",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java#L129-L136 |
119,071 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java | AsyncLoggerSet.appendHtmlReport | void appendHtmlReport(StringBuilder sb) {
sb.append("<table class=\"storage\">");
sb.append("<thead><tr><td>JN</td><td>Status</td></tr></thead>\n");
for (AsyncLogger l : loggers) {
sb.append("<tr>");
sb.append("<td>" + JspUtil.escapeXml(l.toString()) + "</td>");
sb.append("<td>");
l.... | java | void appendHtmlReport(StringBuilder sb) {
sb.append("<table class=\"storage\">");
sb.append("<thead><tr><td>JN</td><td>Status</td></tr></thead>\n");
for (AsyncLogger l : loggers) {
sb.append("<tr>");
sb.append("<td>" + JspUtil.escapeXml(l.toString()) + "</td>");
sb.append("<td>");
l.... | [
"void",
"appendHtmlReport",
"(",
"StringBuilder",
"sb",
")",
"{",
"sb",
".",
"append",
"(",
"\"<table class=\\\"storage\\\">\"",
")",
";",
"sb",
".",
"append",
"(",
"\"<thead><tr><td>JN</td><td>Status</td></tr></thead>\\n\"",
")",
";",
"for",
"(",
"AsyncLogger",
"l",
... | Append an HTML-formatted status readout on the current
state of the underlying loggers.
@param sb the StringBuilder to append to | [
"Append",
"an",
"HTML",
"-",
"formatted",
"status",
"readout",
"on",
"the",
"current",
"state",
"of",
"the",
"underlying",
"loggers",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java#L246-L257 |
119,072 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HtmlQuoting.java | HtmlQuoting.quoteHtmlChars | public static void quoteHtmlChars(OutputStream output, byte[] buffer,
int off, int len) throws IOException {
for(int i=off; i < off+len; i++) {
switch (buffer[i]) {
case '&': output.write(ampBytes); break;
case '<': output.write(ltBytes); break;
case '>': ... | java | public static void quoteHtmlChars(OutputStream output, byte[] buffer,
int off, int len) throws IOException {
for(int i=off; i < off+len; i++) {
switch (buffer[i]) {
case '&': output.write(ampBytes); break;
case '<': output.write(ltBytes); break;
case '>': ... | [
"public",
"static",
"void",
"quoteHtmlChars",
"(",
"OutputStream",
"output",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"i",
"=",
"off",
";",
"i",
"<",
"off",
"+",
"len... | Quote all of the active HTML characters in the given string as they
are added to the buffer.
@param output the stream to write the output to
@param buffer the byte array to take the characters from
@param off the index of the first byte to quote
@param len the number of bytes to quote | [
"Quote",
"all",
"of",
"the",
"active",
"HTML",
"characters",
"in",
"the",
"given",
"string",
"as",
"they",
"are",
"added",
"to",
"the",
"buffer",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HtmlQuoting.java#L78-L90 |
119,073 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HtmlQuoting.java | HtmlQuoting.quoteHtmlChars | public static String quoteHtmlChars(String item) {
if (item == null) {
return null;
}
byte[] bytes = item.getBytes();
if (needsQuoting(bytes, 0, bytes.length)) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
try {
quoteHtmlChars(buffer, bytes, 0, bytes.length);
... | java | public static String quoteHtmlChars(String item) {
if (item == null) {
return null;
}
byte[] bytes = item.getBytes();
if (needsQuoting(bytes, 0, bytes.length)) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
try {
quoteHtmlChars(buffer, bytes, 0, bytes.length);
... | [
"public",
"static",
"String",
"quoteHtmlChars",
"(",
"String",
"item",
")",
"{",
"if",
"(",
"item",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"byte",
"[",
"]",
"bytes",
"=",
"item",
".",
"getBytes",
"(",
")",
";",
"if",
"(",
"needsQuoting",... | Quote the given item to make it html-safe.
@param item the string to quote
@return the quoted string | [
"Quote",
"the",
"given",
"item",
"to",
"make",
"it",
"html",
"-",
"safe",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HtmlQuoting.java#L97-L113 |
119,074 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HtmlQuoting.java | HtmlQuoting.quoteOutputStream | public static OutputStream quoteOutputStream(final OutputStream out
) throws IOException {
return new OutputStream() {
private byte[] data = new byte[1];
@Override
public void write(byte[] data, int off, int len) throws IOException {
quoteHtml... | java | public static OutputStream quoteOutputStream(final OutputStream out
) throws IOException {
return new OutputStream() {
private byte[] data = new byte[1];
@Override
public void write(byte[] data, int off, int len) throws IOException {
quoteHtml... | [
"public",
"static",
"OutputStream",
"quoteOutputStream",
"(",
"final",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"return",
"new",
"OutputStream",
"(",
")",
"{",
"private",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"1",
"]",
";",
"@... | Return an output stream that quotes all of the output.
@param out the stream to write the quoted output to
@return a new stream that the application show write to
@throws IOException if the underlying output fails | [
"Return",
"an",
"output",
"stream",
"that",
"quotes",
"all",
"of",
"the",
"output",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HtmlQuoting.java#L121-L146 |
119,075 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HtmlQuoting.java | HtmlQuoting.unquoteHtmlChars | public static String unquoteHtmlChars(String item) {
if (item == null) {
return null;
}
int next = item.indexOf('&');
// nothing was quoted
if (next == -1) {
return item;
}
int len = item.length();
int posn = 0;
StringBuilder buffer = new StringBuilder();
while (next ... | java | public static String unquoteHtmlChars(String item) {
if (item == null) {
return null;
}
int next = item.indexOf('&');
// nothing was quoted
if (next == -1) {
return item;
}
int len = item.length();
int posn = 0;
StringBuilder buffer = new StringBuilder();
while (next ... | [
"public",
"static",
"String",
"unquoteHtmlChars",
"(",
"String",
"item",
")",
"{",
"if",
"(",
"item",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"next",
"=",
"item",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"// nothing was quoted",
"if"... | Remove HTML quoting from a string.
@param item the string to unquote
@return the unquoted string | [
"Remove",
"HTML",
"quoting",
"from",
"a",
"string",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HtmlQuoting.java#L153-L195 |
119,076 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/IndexCache.java | IndexCache.getIndexInformation | public IndexRecord getIndexInformation(String mapId, int reduce,
Path fileName) throws IOException {
IndexInformation info = cache.get(mapId);
if (info == null) {
info = readIndexFileToCache(fileName, mapId);
} else {
synchronized (info) {
while (null == info.mapSpillRecord) {
... | java | public IndexRecord getIndexInformation(String mapId, int reduce,
Path fileName) throws IOException {
IndexInformation info = cache.get(mapId);
if (info == null) {
info = readIndexFileToCache(fileName, mapId);
} else {
synchronized (info) {
while (null == info.mapSpillRecord) {
... | [
"public",
"IndexRecord",
"getIndexInformation",
"(",
"String",
"mapId",
",",
"int",
"reduce",
",",
"Path",
"fileName",
")",
"throws",
"IOException",
"{",
"IndexInformation",
"info",
"=",
"cache",
".",
"get",
"(",
"mapId",
")",
";",
"if",
"(",
"info",
"==",
... | This method gets the index information for the given mapId and reduce.
It reads the index file into cache if it is not already present.
@param mapId
@param reduce
@param fileName The file to read the index information from if it is not
already present in the cache
@return The Index Information
@throws IOException | [
"This",
"method",
"gets",
"the",
"index",
"information",
"for",
"the",
"given",
"mapId",
"and",
"reduce",
".",
"It",
"reads",
"the",
"index",
"file",
"into",
"cache",
"if",
"it",
"is",
"not",
"already",
"present",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/IndexCache.java#L59-L86 |
119,077 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/IndexCache.java | IndexCache.removeMap | public void removeMap(String mapId) {
IndexInformation info = cache.remove(mapId);
if (info != null) {
totalMemoryUsed.addAndGet(-info.getSize());
if (!queue.remove(mapId)) {
LOG.warn("Map ID" + mapId + " not found in queue!!");
}
} else {
LOG.info("Map ID " + mapId + " not f... | java | public void removeMap(String mapId) {
IndexInformation info = cache.remove(mapId);
if (info != null) {
totalMemoryUsed.addAndGet(-info.getSize());
if (!queue.remove(mapId)) {
LOG.warn("Map ID" + mapId + " not found in queue!!");
}
} else {
LOG.info("Map ID " + mapId + " not f... | [
"public",
"void",
"removeMap",
"(",
"String",
"mapId",
")",
"{",
"IndexInformation",
"info",
"=",
"cache",
".",
"remove",
"(",
"mapId",
")",
";",
"if",
"(",
"info",
"!=",
"null",
")",
"{",
"totalMemoryUsed",
".",
"addAndGet",
"(",
"-",
"info",
".",
"ge... | This method removes the map from the cache. It should be called when
a map output on this tracker is discarded.
@param mapId The taskID of this map. | [
"This",
"method",
"removes",
"the",
"map",
"from",
"the",
"cache",
".",
"It",
"should",
"be",
"called",
"when",
"a",
"map",
"output",
"on",
"this",
"tracker",
"is",
"discarded",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/IndexCache.java#L132-L142 |
119,078 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/IndexCache.java | IndexCache.freeIndexInformation | private synchronized void freeIndexInformation() {
while (totalMemoryUsed.get() > totalMemoryAllowed) {
String s = queue.remove();
IndexInformation info = cache.remove(s);
if (info != null) {
totalMemoryUsed.addAndGet(-info.getSize());
}
}
} | java | private synchronized void freeIndexInformation() {
while (totalMemoryUsed.get() > totalMemoryAllowed) {
String s = queue.remove();
IndexInformation info = cache.remove(s);
if (info != null) {
totalMemoryUsed.addAndGet(-info.getSize());
}
}
} | [
"private",
"synchronized",
"void",
"freeIndexInformation",
"(",
")",
"{",
"while",
"(",
"totalMemoryUsed",
".",
"get",
"(",
")",
">",
"totalMemoryAllowed",
")",
"{",
"String",
"s",
"=",
"queue",
".",
"remove",
"(",
")",
";",
"IndexInformation",
"info",
"=",
... | Bring memory usage below totalMemoryAllowed. | [
"Bring",
"memory",
"usage",
"below",
"totalMemoryAllowed",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/IndexCache.java#L147-L155 |
119,079 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.getStatusesOnHost | private List<TaskTrackerStatus> getStatusesOnHost(String hostName) {
List<TaskTrackerStatus> statuses = new ArrayList<TaskTrackerStatus>();
synchronized (taskTrackers) {
for (TaskTracker tt : taskTrackers.values()) {
TaskTrackerStatus status = tt.getStatus();
if (hostName.equals(status.get... | java | private List<TaskTrackerStatus> getStatusesOnHost(String hostName) {
List<TaskTrackerStatus> statuses = new ArrayList<TaskTrackerStatus>();
synchronized (taskTrackers) {
for (TaskTracker tt : taskTrackers.values()) {
TaskTrackerStatus status = tt.getStatus();
if (hostName.equals(status.get... | [
"private",
"List",
"<",
"TaskTrackerStatus",
">",
"getStatusesOnHost",
"(",
"String",
"hostName",
")",
"{",
"List",
"<",
"TaskTrackerStatus",
">",
"statuses",
"=",
"new",
"ArrayList",
"<",
"TaskTrackerStatus",
">",
"(",
")",
";",
"synchronized",
"(",
"taskTracke... | Get all task tracker statuses on given host
Assumes JobTracker is locked on the entry
@param hostName
@return {@link java.util.List} of {@link TaskTrackerStatus} | [
"Get",
"all",
"task",
"tracker",
"statuses",
"on",
"given",
"host"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L1120-L1131 |
119,080 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.markCompletedTaskAttempt | void markCompletedTaskAttempt(String taskTracker, TaskAttemptID taskid) {
// tracker --> taskid
Set<TaskAttemptID> taskset = trackerToMarkedTasksMap.get(taskTracker);
if (taskset == null) {
taskset = new TreeSet<TaskAttemptID>();
trackerToMarkedTasksMap.put(taskTracker, taskset);
}
tasks... | java | void markCompletedTaskAttempt(String taskTracker, TaskAttemptID taskid) {
// tracker --> taskid
Set<TaskAttemptID> taskset = trackerToMarkedTasksMap.get(taskTracker);
if (taskset == null) {
taskset = new TreeSet<TaskAttemptID>();
trackerToMarkedTasksMap.put(taskTracker, taskset);
}
tasks... | [
"void",
"markCompletedTaskAttempt",
"(",
"String",
"taskTracker",
",",
"TaskAttemptID",
"taskid",
")",
"{",
"// tracker --> taskid",
"Set",
"<",
"TaskAttemptID",
">",
"taskset",
"=",
"trackerToMarkedTasksMap",
".",
"get",
"(",
"taskTracker",
")",
";",
"if",
"(",
"... | Mark a 'task' for removal later.
This function assumes that the JobTracker is locked on entry.
@param taskTracker the tasktracker at which the 'task' was running
@param taskid completed (success/failure/killed) task | [
"Mark",
"a",
"task",
"for",
"removal",
"later",
".",
"This",
"function",
"assumes",
"that",
"the",
"JobTracker",
"is",
"locked",
"on",
"entry",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L1782-L1792 |
119,081 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.markCompletedJob | void markCompletedJob(JobInProgress job) {
for (TaskInProgress tip : job.getTasks(TaskType.JOB_SETUP)) {
for (TaskStatus taskStatus : tip.getTaskStatuses()) {
if (taskStatus.getRunState() != TaskStatus.State.RUNNING &&
taskStatus.getRunState() != TaskStatus.State.COMMIT_PENDING &&
... | java | void markCompletedJob(JobInProgress job) {
for (TaskInProgress tip : job.getTasks(TaskType.JOB_SETUP)) {
for (TaskStatus taskStatus : tip.getTaskStatuses()) {
if (taskStatus.getRunState() != TaskStatus.State.RUNNING &&
taskStatus.getRunState() != TaskStatus.State.COMMIT_PENDING &&
... | [
"void",
"markCompletedJob",
"(",
"JobInProgress",
"job",
")",
"{",
"for",
"(",
"TaskInProgress",
"tip",
":",
"job",
".",
"getTasks",
"(",
"TaskType",
".",
"JOB_SETUP",
")",
")",
"{",
"for",
"(",
"TaskStatus",
"taskStatus",
":",
"tip",
".",
"getTaskStatuses",... | Mark all 'non-running' jobs of the job for pruning.
This function assumes that the JobTracker is locked on entry.
@param job the completed job | [
"Mark",
"all",
"non",
"-",
"running",
"jobs",
"of",
"the",
"job",
"for",
"pruning",
".",
"This",
"function",
"assumes",
"that",
"the",
"JobTracker",
"is",
"locked",
"on",
"entry",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L1800-L1835 |
119,082 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.isBlacklisted | synchronized public boolean isBlacklisted(String trackerID) {
TaskTrackerStatus status = getTaskTrackerStatus(trackerID);
if (status != null) {
return faultyTrackers.isBlacklisted(status.getHost());
}
return false;
} | java | synchronized public boolean isBlacklisted(String trackerID) {
TaskTrackerStatus status = getTaskTrackerStatus(trackerID);
if (status != null) {
return faultyTrackers.isBlacklisted(status.getHost());
}
return false;
} | [
"synchronized",
"public",
"boolean",
"isBlacklisted",
"(",
"String",
"trackerID",
")",
"{",
"TaskTrackerStatus",
"status",
"=",
"getTaskTrackerStatus",
"(",
"trackerID",
")",
";",
"if",
"(",
"status",
"!=",
"null",
")",
"{",
"return",
"faultyTrackers",
".",
"isB... | Whether the tracker is blacklisted or not
@param trackerID
@return true if blacklisted, false otherwise | [
"Whether",
"the",
"tracker",
"is",
"blacklisted",
"or",
"not"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L2171-L2177 |
119,083 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.addNewTracker | void addNewTracker(TaskTracker taskTracker) {
TaskTrackerStatus status = taskTracker.getStatus();
trackerExpiryQueue.add(status);
// Register the tracker if its not registered
String hostname = status.getHost();
if (getNode(status.getTrackerName()) == null) {
// Making the network location r... | java | void addNewTracker(TaskTracker taskTracker) {
TaskTrackerStatus status = taskTracker.getStatus();
trackerExpiryQueue.add(status);
// Register the tracker if its not registered
String hostname = status.getHost();
if (getNode(status.getTrackerName()) == null) {
// Making the network location r... | [
"void",
"addNewTracker",
"(",
"TaskTracker",
"taskTracker",
")",
"{",
"TaskTrackerStatus",
"status",
"=",
"taskTracker",
".",
"getStatus",
"(",
")",
";",
"trackerExpiryQueue",
".",
"add",
"(",
"status",
")",
";",
"// Register the tracker if its not registered",
"Stri... | Adds a new node to the jobtracker. It involves adding it to the expiry
thread and adding it for resolution
Assumes JobTracker, taskTrackers and trackerExpiryQueue is locked on entry
@param taskTracker Task Tracker | [
"Adds",
"a",
"new",
"node",
"to",
"the",
"jobtracker",
".",
"It",
"involves",
"adding",
"it",
"to",
"the",
"expiry",
"thread",
"and",
"adding",
"it",
"for",
"resolution"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L2206-L2228 |
119,084 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.getNextHeartbeatInterval | public int getNextHeartbeatInterval() {
// get the no of task trackers
int clusterSize = getClusterStatus().getTaskTrackers();
int heartbeatInterval = Math.max(
(int)(1000 * HEARTBEATS_SCALING_FACTOR *
Math.ceil((double)clusterSize /
... | java | public int getNextHeartbeatInterval() {
// get the no of task trackers
int clusterSize = getClusterStatus().getTaskTrackers();
int heartbeatInterval = Math.max(
(int)(1000 * HEARTBEATS_SCALING_FACTOR *
Math.ceil((double)clusterSize /
... | [
"public",
"int",
"getNextHeartbeatInterval",
"(",
")",
"{",
"// get the no of task trackers",
"int",
"clusterSize",
"=",
"getClusterStatus",
"(",
")",
".",
"getTaskTrackers",
"(",
")",
";",
"int",
"heartbeatInterval",
"=",
"Math",
".",
"max",
"(",
"(",
"int",
")... | Calculates next heartbeat interval using cluster size.
Heartbeat interval is incremented by 1 second for every 100 nodes by default.
@return next heartbeat interval. | [
"Calculates",
"next",
"heartbeat",
"interval",
"using",
"cluster",
"size",
".",
"Heartbeat",
"interval",
"is",
"incremented",
"by",
"1",
"second",
"for",
"every",
"100",
"nodes",
"by",
"default",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L2574-L2583 |
119,085 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.inHostsList | private boolean inHostsList(TaskTrackerStatus status) {
Set<String> hostsList = hostsReader.getHosts();
return (hostsList.isEmpty() || hostsList.contains(status.getHost()));
} | java | private boolean inHostsList(TaskTrackerStatus status) {
Set<String> hostsList = hostsReader.getHosts();
return (hostsList.isEmpty() || hostsList.contains(status.getHost()));
} | [
"private",
"boolean",
"inHostsList",
"(",
"TaskTrackerStatus",
"status",
")",
"{",
"Set",
"<",
"String",
">",
"hostsList",
"=",
"hostsReader",
".",
"getHosts",
"(",
")",
";",
"return",
"(",
"hostsList",
".",
"isEmpty",
"(",
")",
"||",
"hostsList",
".",
"co... | Return if the specified tasktracker is in the hosts list,
if one was configured. If none was configured, then this
returns true. | [
"Return",
"if",
"the",
"specified",
"tasktracker",
"is",
"in",
"the",
"hosts",
"list",
"if",
"one",
"was",
"configured",
".",
"If",
"none",
"was",
"configured",
"then",
"this",
"returns",
"true",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L2590-L2593 |
119,086 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.inExcludedHostsList | private boolean inExcludedHostsList(TaskTrackerStatus status) {
Set<String> excludeList = hostsReader.getExcludedHosts();
return excludeList.contains(status.getHost());
} | java | private boolean inExcludedHostsList(TaskTrackerStatus status) {
Set<String> excludeList = hostsReader.getExcludedHosts();
return excludeList.contains(status.getHost());
} | [
"private",
"boolean",
"inExcludedHostsList",
"(",
"TaskTrackerStatus",
"status",
")",
"{",
"Set",
"<",
"String",
">",
"excludeList",
"=",
"hostsReader",
".",
"getExcludedHosts",
"(",
")",
";",
"return",
"excludeList",
".",
"contains",
"(",
"status",
".",
"getHos... | Return if the specified tasktracker is in the exclude list. | [
"Return",
"if",
"the",
"specified",
"tasktracker",
"is",
"in",
"the",
"exclude",
"list",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L2598-L2601 |
119,087 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.incrementReservations | void incrementReservations(TaskType type, int reservedSlots) {
if (type.equals(TaskType.MAP)) {
reservedMapSlots += reservedSlots;
} else if (type.equals(TaskType.REDUCE)) {
reservedReduceSlots += reservedSlots;
}
} | java | void incrementReservations(TaskType type, int reservedSlots) {
if (type.equals(TaskType.MAP)) {
reservedMapSlots += reservedSlots;
} else if (type.equals(TaskType.REDUCE)) {
reservedReduceSlots += reservedSlots;
}
} | [
"void",
"incrementReservations",
"(",
"TaskType",
"type",
",",
"int",
"reservedSlots",
")",
"{",
"if",
"(",
"type",
".",
"equals",
"(",
"TaskType",
".",
"MAP",
")",
")",
"{",
"reservedMapSlots",
"+=",
"reservedSlots",
";",
"}",
"else",
"if",
"(",
"type",
... | This method assumes the caller has JobTracker lock. | [
"This",
"method",
"assumes",
"the",
"caller",
"has",
"JobTracker",
"lock",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L2756-L2762 |
119,088 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.processHeartbeat | synchronized boolean processHeartbeat(
TaskTrackerStatus trackerStatus,
boolean initialContact) {
String trackerName = trackerStatus.getTrackerName();
synchronized (taskTrackers) {
synchronized (trackerExpiryQueue) {
boolean seenBe... | java | synchronized boolean processHeartbeat(
TaskTrackerStatus trackerStatus,
boolean initialContact) {
String trackerName = trackerStatus.getTrackerName();
synchronized (taskTrackers) {
synchronized (trackerExpiryQueue) {
boolean seenBe... | [
"synchronized",
"boolean",
"processHeartbeat",
"(",
"TaskTrackerStatus",
"trackerStatus",
",",
"boolean",
"initialContact",
")",
"{",
"String",
"trackerName",
"=",
"trackerStatus",
".",
"getTrackerName",
"(",
")",
";",
"synchronized",
"(",
"taskTrackers",
")",
"{",
... | Process incoming heartbeat messages from the task trackers. | [
"Process",
"incoming",
"heartbeat",
"messages",
"from",
"the",
"task",
"trackers",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L2785-L2826 |
119,089 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.addJobForCleanup | private void addJobForCleanup(JobID id) {
for (String taskTracker : taskTrackers.keySet()) {
LOG.debug("Marking job " + id + " for cleanup by tracker " + taskTracker);
synchronized (trackerToJobsToCleanup) {
Set<JobID> jobsToKill = trackerToJobsToCleanup.get(taskTracker);
if (jobsToKill ... | java | private void addJobForCleanup(JobID id) {
for (String taskTracker : taskTrackers.keySet()) {
LOG.debug("Marking job " + id + " for cleanup by tracker " + taskTracker);
synchronized (trackerToJobsToCleanup) {
Set<JobID> jobsToKill = trackerToJobsToCleanup.get(taskTracker);
if (jobsToKill ... | [
"private",
"void",
"addJobForCleanup",
"(",
"JobID",
"id",
")",
"{",
"for",
"(",
"String",
"taskTracker",
":",
"taskTrackers",
".",
"keySet",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Marking job \"",
"+",
"id",
"+",
"\" for cleanup by tracker \"",
"+... | Add a job to cleanup for the tracker. | [
"Add",
"a",
"job",
"to",
"cleanup",
"for",
"the",
"tracker",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L2873-L2885 |
119,090 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.getJobsForCleanup | private List<TaskTrackerAction> getJobsForCleanup(String taskTracker) {
Set<JobID> jobs = null;
synchronized (trackerToJobsToCleanup) {
jobs = trackerToJobsToCleanup.remove(taskTracker);
}
if (jobs != null) {
// prepare the actions list
List<TaskTrackerAction> killList = new ArrayList<... | java | private List<TaskTrackerAction> getJobsForCleanup(String taskTracker) {
Set<JobID> jobs = null;
synchronized (trackerToJobsToCleanup) {
jobs = trackerToJobsToCleanup.remove(taskTracker);
}
if (jobs != null) {
// prepare the actions list
List<TaskTrackerAction> killList = new ArrayList<... | [
"private",
"List",
"<",
"TaskTrackerAction",
">",
"getJobsForCleanup",
"(",
"String",
"taskTracker",
")",
"{",
"Set",
"<",
"JobID",
">",
"jobs",
"=",
"null",
";",
"synchronized",
"(",
"trackerToJobsToCleanup",
")",
"{",
"jobs",
"=",
"trackerToJobsToCleanup",
"."... | A tracker wants to know if any job needs cleanup because the job completed. | [
"A",
"tracker",
"wants",
"to",
"know",
"if",
"any",
"job",
"needs",
"cleanup",
"because",
"the",
"job",
"completed",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L2890-L2906 |
119,091 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.getSetupAndCleanupTasks | List<Task> getSetupAndCleanupTasks(
TaskTrackerStatus taskTracker) throws IOException {
int maxMapTasks = taskScheduler.getMaxSlots(taskTracker, TaskType.MAP);
int maxReduceTasks =
taskScheduler.getMaxSlots(taskTracker, TaskType.REDUCE);
int numMaps = taskTracker.countOccupiedMapSlots();
int... | java | List<Task> getSetupAndCleanupTasks(
TaskTrackerStatus taskTracker) throws IOException {
int maxMapTasks = taskScheduler.getMaxSlots(taskTracker, TaskType.MAP);
int maxReduceTasks =
taskScheduler.getMaxSlots(taskTracker, TaskType.REDUCE);
int numMaps = taskTracker.countOccupiedMapSlots();
int... | [
"List",
"<",
"Task",
">",
"getSetupAndCleanupTasks",
"(",
"TaskTrackerStatus",
"taskTracker",
")",
"throws",
"IOException",
"{",
"int",
"maxMapTasks",
"=",
"taskScheduler",
".",
"getMaxSlots",
"(",
"taskTracker",
",",
"TaskType",
".",
"MAP",
")",
";",
"int",
"ma... | returns cleanup tasks first, then setup tasks. | [
"returns",
"cleanup",
"tasks",
"first",
"then",
"setup",
"tasks",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L2936-L3001 |
119,092 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.getNewJobId | public JobID getNewJobId() throws IOException {
JobID id = new JobID(getTrackerIdentifier(), nextJobId.getAndIncrement());
// get the user group info
UserGroupInformation ugi = UserGroupInformation.getCurrentUGI();
// mark the user for this id
jobToUserMap.put(id, ugi.getUserName());
LOG.info... | java | public JobID getNewJobId() throws IOException {
JobID id = new JobID(getTrackerIdentifier(), nextJobId.getAndIncrement());
// get the user group info
UserGroupInformation ugi = UserGroupInformation.getCurrentUGI();
// mark the user for this id
jobToUserMap.put(id, ugi.getUserName());
LOG.info... | [
"public",
"JobID",
"getNewJobId",
"(",
")",
"throws",
"IOException",
"{",
"JobID",
"id",
"=",
"new",
"JobID",
"(",
"getTrackerIdentifier",
"(",
")",
",",
"nextJobId",
".",
"getAndIncrement",
"(",
")",
")",
";",
"// get the user group info",
"UserGroupInformation",... | Allocates a new JobId string. | [
"Allocates",
"a",
"new",
"JobId",
"string",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L3034-L3046 |
119,093 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.addJob | protected synchronized JobStatus addJob(JobID jobId, JobInProgress job) {
totalSubmissions++;
synchronized (jobs) {
synchronized (taskScheduler) {
jobs.put(job.getProfile().getJobID(), job);
for (JobInProgressListener listener : jobInProgressListeners) {
try {
listen... | java | protected synchronized JobStatus addJob(JobID jobId, JobInProgress job) {
totalSubmissions++;
synchronized (jobs) {
synchronized (taskScheduler) {
jobs.put(job.getProfile().getJobID(), job);
for (JobInProgressListener listener : jobInProgressListeners) {
try {
listen... | [
"protected",
"synchronized",
"JobStatus",
"addJob",
"(",
"JobID",
"jobId",
",",
"JobInProgress",
"job",
")",
"{",
"totalSubmissions",
"++",
";",
"synchronized",
"(",
"jobs",
")",
"{",
"synchronized",
"(",
"taskScheduler",
")",
"{",
"jobs",
".",
"put",
"(",
"... | Adds a job to the jobtracker. Make sure that the checks are inplace before
adding a job. This is the core job submission logic
@param jobId The id for the job submitted which needs to be added | [
"Adds",
"a",
"job",
"to",
"the",
"jobtracker",
".",
"Make",
"sure",
"that",
"the",
"checks",
"are",
"inplace",
"before",
"adding",
"a",
"job",
".",
"This",
"is",
"the",
"core",
"job",
"submission",
"logic"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L3173-L3200 |
119,094 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.checkAccess | private void checkAccess(JobInProgress job,
QueueManager.QueueOperation oper)
throws IOException {
// get the user group info
UserGroupInformation ugi = UserGroupInformation.getCurrentUGI();
checkAccess(job, oper, ugi);
} | java | private void checkAccess(JobInProgress job,
QueueManager.QueueOperation oper)
throws IOException {
// get the user group info
UserGroupInformation ugi = UserGroupInformation.getCurrentUGI();
checkAccess(job, oper, ugi);
} | [
"private",
"void",
"checkAccess",
"(",
"JobInProgress",
"job",
",",
"QueueManager",
".",
"QueueOperation",
"oper",
")",
"throws",
"IOException",
"{",
"// get the user group info",
"UserGroupInformation",
"ugi",
"=",
"UserGroupInformation",
".",
"getCurrentUGI",
"(",
")"... | related to the job. | [
"related",
"to",
"the",
"job",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L3204-L3210 |
119,095 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.checkAccess | private void checkAccess(JobInProgress job, QueueManager.QueueOperation oper,
UserGroupInformation ugi) throws IOException {
// get the queue
String queue = job.getProfile().getQueueName();
if (!queueManager.hasAccess(queue, job, oper, ugi)) {
throw new AccessControlExceptio... | java | private void checkAccess(JobInProgress job, QueueManager.QueueOperation oper,
UserGroupInformation ugi) throws IOException {
// get the queue
String queue = job.getProfile().getQueueName();
if (!queueManager.hasAccess(queue, job, oper, ugi)) {
throw new AccessControlExceptio... | [
"private",
"void",
"checkAccess",
"(",
"JobInProgress",
"job",
",",
"QueueManager",
".",
"QueueOperation",
"oper",
",",
"UserGroupInformation",
"ugi",
")",
"throws",
"IOException",
"{",
"// get the queue",
"String",
"queue",
"=",
"job",
".",
"getProfile",
"(",
")"... | use the passed ugi for checking the access | [
"use",
"the",
"passed",
"ugi",
"for",
"checking",
"the",
"access"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L3213-L3226 |
119,096 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.failJob | public synchronized void failJob(JobInProgress job) {
if (null == job) {
LOG.info("Fail on null job is not valid");
return;
}
JobStatus prevStatus = (JobStatus)job.getStatus().clone();
LOG.info("Failing job " + job.getJobID());
job.fail();
// Inform the listeners if the job state h... | java | public synchronized void failJob(JobInProgress job) {
if (null == job) {
LOG.info("Fail on null job is not valid");
return;
}
JobStatus prevStatus = (JobStatus)job.getStatus().clone();
LOG.info("Failing job " + job.getJobID());
job.fail();
// Inform the listeners if the job state h... | [
"public",
"synchronized",
"void",
"failJob",
"(",
"JobInProgress",
"job",
")",
"{",
"if",
"(",
"null",
"==",
"job",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Fail on null job is not valid\"",
")",
";",
"return",
";",
"}",
"JobStatus",
"prevStatus",
"=",
"(",
"... | Fail a job and inform the listeners. Other components in the framework
should use this to fail a job. | [
"Fail",
"a",
"job",
"and",
"inform",
"the",
"listeners",
".",
"Other",
"components",
"in",
"the",
"framework",
"should",
"use",
"this",
"to",
"fail",
"a",
"job",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L3367-L3385 |
119,097 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.setJobPriority | public synchronized void setJobPriority(JobID jobid,
String priority)
throws IOException {
JobInProgress job = jobs.get(jobid);
if (null == job) {
LOG.info("setJobPriority(): JobId " + jobid.toString()
... | java | public synchronized void setJobPriority(JobID jobid,
String priority)
throws IOException {
JobInProgress job = jobs.get(jobid);
if (null == job) {
LOG.info("setJobPriority(): JobId " + jobid.toString()
... | [
"public",
"synchronized",
"void",
"setJobPriority",
"(",
"JobID",
"jobid",
",",
"String",
"priority",
")",
"throws",
"IOException",
"{",
"JobInProgress",
"job",
"=",
"jobs",
".",
"get",
"(",
"jobid",
")",
";",
"if",
"(",
"null",
"==",
"job",
")",
"{",
"L... | Set the priority of a job
@param jobid id of the job
@param priority new priority of the job | [
"Set",
"the",
"priority",
"of",
"a",
"job"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L3392-L3404 |
119,098 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.getTaskStatuses | TaskStatus[] getTaskStatuses(TaskID tipid) {
TaskInProgress tip = getTip(tipid);
return (tip == null ? new TaskStatus[0]
: tip.getTaskStatuses());
} | java | TaskStatus[] getTaskStatuses(TaskID tipid) {
TaskInProgress tip = getTip(tipid);
return (tip == null ? new TaskStatus[0]
: tip.getTaskStatuses());
} | [
"TaskStatus",
"[",
"]",
"getTaskStatuses",
"(",
"TaskID",
"tipid",
")",
"{",
"TaskInProgress",
"tip",
"=",
"getTip",
"(",
"tipid",
")",
";",
"return",
"(",
"tip",
"==",
"null",
"?",
"new",
"TaskStatus",
"[",
"0",
"]",
":",
"tip",
".",
"getTaskStatuses",
... | Get all the TaskStatuses from the tipid. | [
"Get",
"all",
"the",
"TaskStatuses",
"from",
"the",
"tipid",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L3541-L3545 |
119,099 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobTracker.java | JobTracker.getTaskStatus | TaskStatus getTaskStatus(TaskAttemptID taskid) {
TaskInProgress tip = getTip(taskid.getTaskID());
return (tip == null ? null
: tip.getTaskStatus(taskid));
} | java | TaskStatus getTaskStatus(TaskAttemptID taskid) {
TaskInProgress tip = getTip(taskid.getTaskID());
return (tip == null ? null
: tip.getTaskStatus(taskid));
} | [
"TaskStatus",
"getTaskStatus",
"(",
"TaskAttemptID",
"taskid",
")",
"{",
"TaskInProgress",
"tip",
"=",
"getTip",
"(",
"taskid",
".",
"getTaskID",
"(",
")",
")",
";",
"return",
"(",
"tip",
"==",
"null",
"?",
"null",
":",
"tip",
".",
"getTaskStatus",
"(",
... | Returns the TaskStatus for a particular taskid. | [
"Returns",
"the",
"TaskStatus",
"for",
"a",
"particular",
"taskid",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L3548-L3552 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.