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
117,800
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.copyFromLocalFile
@Deprecated public void copyFromLocalFile(Path src, Path dst) throws IOException { copyFromLocalFile(false, true, false, src, dst); }
java
@Deprecated public void copyFromLocalFile(Path src, Path dst) throws IOException { copyFromLocalFile(false, true, false, src, dst); }
[ "@", "Deprecated", "public", "void", "copyFromLocalFile", "(", "Path", "src", ",", "Path", "dst", ")", "throws", "IOException", "{", "copyFromLocalFile", "(", "false", ",", "true", ",", "false", ",", "src", ",", "dst", ")", ";", "}" ]
The src file is on the local disk. Add it to FS at the given dst name and the source is kept intact afterwards
[ "The", "src", "file", "is", "on", "the", "local", "disk", ".", "Add", "it", "to", "FS", "at", "the", "given", "dst", "name", "and", "the", "source", "is", "kept", "intact", "afterwards" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1622-L1626
117,801
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.moveFromLocalFile
public void moveFromLocalFile(Path[] srcs, Path dst) throws IOException { copyFromLocalFile(true, true, false, srcs, dst); }
java
public void moveFromLocalFile(Path[] srcs, Path dst) throws IOException { copyFromLocalFile(true, true, false, srcs, dst); }
[ "public", "void", "moveFromLocalFile", "(", "Path", "[", "]", "srcs", ",", "Path", "dst", ")", "throws", "IOException", "{", "copyFromLocalFile", "(", "true", ",", "true", ",", "false", ",", "srcs", ",", "dst", ")", ";", "}" ]
The src files is on the local disk. Add it to FS at the given dst name, removing the source afterwards.
[ "The", "src", "files", "is", "on", "the", "local", "disk", ".", "Add", "it", "to", "FS", "at", "the", "given", "dst", "name", "removing", "the", "source", "afterwards", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1632-L1635
117,802
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.moveFromLocalFile
public void moveFromLocalFile(Path src, Path dst) throws IOException { copyFromLocalFile(true, true, false, src, dst); }
java
public void moveFromLocalFile(Path src, Path dst) throws IOException { copyFromLocalFile(true, true, false, src, dst); }
[ "public", "void", "moveFromLocalFile", "(", "Path", "src", ",", "Path", "dst", ")", "throws", "IOException", "{", "copyFromLocalFile", "(", "true", ",", "true", ",", "false", ",", "src", ",", "dst", ")", ";", "}" ]
The src file is on the local disk. Add it to FS at the given dst name, removing the source afterwards.
[ "The", "src", "file", "is", "on", "the", "local", "disk", ".", "Add", "it", "to", "FS", "at", "the", "given", "dst", "name", "removing", "the", "source", "afterwards", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1641-L1644
117,803
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.copyFromLocalFile
public void copyFromLocalFile(boolean delSrc, boolean overwrite, boolean validate, Path src, Path dst) throws IOException { Configuration conf = getConf(); FileUtil.copy(getLocal(conf), src, this, dst, delSrc, overwrite, validate, conf); }
java
public void copyFromLocalFile(boolean delSrc, boolean overwrite, boolean validate, Path src, Path dst) throws IOException { Configuration conf = getConf(); FileUtil.copy(getLocal(conf), src, this, dst, delSrc, overwrite, validate, conf); }
[ "public", "void", "copyFromLocalFile", "(", "boolean", "delSrc", ",", "boolean", "overwrite", ",", "boolean", "validate", ",", "Path", "src", ",", "Path", "dst", ")", "throws", "IOException", "{", "Configuration", "conf", "=", "getConf", "(", ")", ";", "File...
copy a file from local to a file in this file system @param delSrc if source should be deleted @param overwrite if destination should be overwritten @param validate if copied destination should be validated against source @param src source file @param dst destination path @throws IOException
[ "copy", "a", "file", "from", "local", "to", "a", "file", "in", "this", "file", "system" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1708-L1714
117,804
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.copyToLocalFile
@Deprecated public void copyToLocalFile(Path src, Path dst) throws IOException { copyToLocalFile(false, false, src, dst); }
java
@Deprecated public void copyToLocalFile(Path src, Path dst) throws IOException { copyToLocalFile(false, false, src, dst); }
[ "@", "Deprecated", "public", "void", "copyToLocalFile", "(", "Path", "src", ",", "Path", "dst", ")", "throws", "IOException", "{", "copyToLocalFile", "(", "false", ",", "false", ",", "src", ",", "dst", ")", ";", "}" ]
The src file is under FS, and the dst is on the local disk. Copy it from FS control to the local dst name.
[ "The", "src", "file", "is", "under", "FS", "and", "the", "dst", "is", "on", "the", "local", "disk", ".", "Copy", "it", "from", "FS", "control", "to", "the", "local", "dst", "name", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1720-L1723
117,805
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.moveToLocalFile
public void moveToLocalFile(Path src, Path dst) throws IOException { copyToLocalFile(true, false, src, dst); }
java
public void moveToLocalFile(Path src, Path dst) throws IOException { copyToLocalFile(true, false, src, dst); }
[ "public", "void", "moveToLocalFile", "(", "Path", "src", ",", "Path", "dst", ")", "throws", "IOException", "{", "copyToLocalFile", "(", "true", ",", "false", ",", "src", ",", "dst", ")", ";", "}" ]
The src file is under FS, and the dst is on the local disk. Copy it from FS control to the local dst name. Remove the source afterwards
[ "The", "src", "file", "is", "under", "FS", "and", "the", "dst", "is", "on", "the", "local", "disk", ".", "Copy", "it", "from", "FS", "control", "to", "the", "local", "dst", "name", ".", "Remove", "the", "source", "afterwards" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1730-L1732
117,806
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.copyToLocalFile
public void copyToLocalFile(boolean delSrc, boolean validate, Path src, Path dst) throws IOException { FileUtil.copy(this, src, getLocal(getConf()), dst, delSrc, validate, getConf()); }
java
public void copyToLocalFile(boolean delSrc, boolean validate, Path src, Path dst) throws IOException { FileUtil.copy(this, src, getLocal(getConf()), dst, delSrc, validate, getConf()); }
[ "public", "void", "copyToLocalFile", "(", "boolean", "delSrc", ",", "boolean", "validate", ",", "Path", "src", ",", "Path", "dst", ")", "throws", "IOException", "{", "FileUtil", ".", "copy", "(", "this", ",", "src", ",", "getLocal", "(", "getConf", "(", ...
Copy a file from this file system to local @param delSrc if source should be deleted @param validate if copied destination should be validated against source @param src source file @param dst destination file @throws IOException if error occurs
[ "Copy", "a", "file", "from", "this", "file", "system", "to", "local" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1754-L1759
117,807
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.getUsed
public long getUsed() throws IOException{ long used = 0; FileStatus[] files = listStatus(new Path("/")); for(FileStatus file:files){ used += file.getLen(); } return used; }
java
public long getUsed() throws IOException{ long used = 0; FileStatus[] files = listStatus(new Path("/")); for(FileStatus file:files){ used += file.getLen(); } return used; }
[ "public", "long", "getUsed", "(", ")", "throws", "IOException", "{", "long", "used", "=", "0", ";", "FileStatus", "[", "]", "files", "=", "listStatus", "(", "new", "Path", "(", "\"/\"", ")", ")", ";", "for", "(", "FileStatus", "file", ":", "files", "...
Return the total size of all files in the filesystem.
[ "Return", "the", "total", "size", "of", "all", "files", "in", "the", "filesystem", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1809-L1816
117,808
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.getFileStatus
private FileStatus[] getFileStatus(Path[] paths) throws IOException { if (paths == null) { return null; } ArrayList<FileStatus> results = new ArrayList<FileStatus>(paths.length); for (int i = 0; i < paths.length; i++) { try { results.add(getFileStatus(paths[i])); } catch (FileN...
java
private FileStatus[] getFileStatus(Path[] paths) throws IOException { if (paths == null) { return null; } ArrayList<FileStatus> results = new ArrayList<FileStatus>(paths.length); for (int i = 0; i < paths.length; i++) { try { results.add(getFileStatus(paths[i])); } catch (FileN...
[ "private", "FileStatus", "[", "]", "getFileStatus", "(", "Path", "[", "]", "paths", ")", "throws", "IOException", "{", "if", "(", "paths", "==", "null", ")", "{", "return", "null", ";", "}", "ArrayList", "<", "FileStatus", ">", "results", "=", "new", "...
Return a list of file status objects that corresponds to the list of paths excluding those non-existent paths. @param paths the list of paths we want information from @return a list of FileStatus objects @throws IOException see specific implementation
[ "Return", "a", "list", "of", "file", "status", "objects", "that", "corresponds", "to", "the", "list", "of", "paths", "excluding", "those", "non", "-", "existent", "paths", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1906-L1918
117,809
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.getStatistics
public static synchronized Map<String, Statistics> getStatistics() { Map<String, Statistics> result = new HashMap<String, Statistics>(); for(Statistics stat: statisticsTable.values()) { result.put(stat.getScheme(), stat); } return result; }
java
public static synchronized Map<String, Statistics> getStatistics() { Map<String, Statistics> result = new HashMap<String, Statistics>(); for(Statistics stat: statisticsTable.values()) { result.put(stat.getScheme(), stat); } return result; }
[ "public", "static", "synchronized", "Map", "<", "String", ",", "Statistics", ">", "getStatistics", "(", ")", "{", "Map", "<", "String", ",", "Statistics", ">", "result", "=", "new", "HashMap", "<", "String", ",", "Statistics", ">", "(", ")", ";", "for", ...
Get the Map of Statistics object indexed by URI Scheme. @return a Map having a key as URI scheme and value as Statistics object @deprecated use {@link #getAllStatistics} instead
[ "Get", "the", "Map", "of", "Statistics", "object", "indexed", "by", "URI", "Scheme", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L2409-L2415
117,810
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.getStatistics
public static synchronized Statistics getStatistics(String scheme, Class<? extends FileSystem> cls) { Statistics result = statisticsTable.get(cls); if (result == null) { result = new Statistics(scheme); statisticsTable.put(cls, result); } return result; }
java
public static synchronized Statistics getStatistics(String scheme, Class<? extends FileSystem> cls) { Statistics result = statisticsTable.get(cls); if (result == null) { result = new Statistics(scheme); statisticsTable.put(cls, result); } return result; }
[ "public", "static", "synchronized", "Statistics", "getStatistics", "(", "String", "scheme", ",", "Class", "<", "?", "extends", "FileSystem", ">", "cls", ")", "{", "Statistics", "result", "=", "statisticsTable", ".", "get", "(", "cls", ")", ";", "if", "(", ...
Get the statistics for a particular file system @param cls the class to lookup @return a statistics object
[ "Get", "the", "statistics", "for", "a", "particular", "file", "system" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L2429-L2437
117,811
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderUtil.java
ServerLogReaderUtil.createNotification
static NamespaceNotification createNotification(FSEditLogOp op) { switch (op.opCode) { case OP_ADD: return new NamespaceNotification(((AddOp)op).path, EventType.FILE_ADDED.getByteValue(), op.getTransactionId()); case OP_CLOSE: return new NamespaceNotification(((CloseOp)op).p...
java
static NamespaceNotification createNotification(FSEditLogOp op) { switch (op.opCode) { case OP_ADD: return new NamespaceNotification(((AddOp)op).path, EventType.FILE_ADDED.getByteValue(), op.getTransactionId()); case OP_CLOSE: return new NamespaceNotification(((CloseOp)op).p...
[ "static", "NamespaceNotification", "createNotification", "(", "FSEditLogOp", "op", ")", "{", "switch", "(", "op", ".", "opCode", ")", "{", "case", "OP_ADD", ":", "return", "new", "NamespaceNotification", "(", "(", "(", "AddOp", ")", "op", ")", ".", "path", ...
Converts a Transaction Log operation into a NamespaceNotification object. @param op the Transaction Log operation. @return the NamespaceNotification object or null if the type of the operation isn't supported to be transformed into a NamespaceNotification.
[ "Converts", "a", "Transaction", "Log", "operation", "into", "a", "NamespaceNotification", "object", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderUtil.java#L44-L64
117,812
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderUtil.java
ServerLogReaderUtil.shouldSkipOp
static boolean shouldSkipOp(long currentTransactionId, FSEditLogOp op) { if (currentTransactionId == -1 || op.getTransactionId() > currentTransactionId) { return false; } return true; }
java
static boolean shouldSkipOp(long currentTransactionId, FSEditLogOp op) { if (currentTransactionId == -1 || op.getTransactionId() > currentTransactionId) { return false; } return true; }
[ "static", "boolean", "shouldSkipOp", "(", "long", "currentTransactionId", ",", "FSEditLogOp", "op", ")", "{", "if", "(", "currentTransactionId", "==", "-", "1", "||", "op", ".", "getTransactionId", "(", ")", ">", "currentTransactionId", ")", "{", "return", "fa...
We would skip the transaction if its id is less than or equal to current transaction id.
[ "We", "would", "skip", "the", "transaction", "if", "its", "id", "is", "less", "than", "or", "equal", "to", "current", "transaction", "id", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderUtil.java#L70-L77
117,813
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderUtil.java
ServerLogReaderUtil.checkTransactionId
static long checkTransactionId(long currentTransactionId, FSEditLogOp op) throws IOException { if (currentTransactionId != -1) { if (op.getTransactionId() != currentTransactionId + 1) { LOG.error("Read invalid txId=" + op.getTransactionId() + " expectedTxId=" + (currentTransactionId ...
java
static long checkTransactionId(long currentTransactionId, FSEditLogOp op) throws IOException { if (currentTransactionId != -1) { if (op.getTransactionId() != currentTransactionId + 1) { LOG.error("Read invalid txId=" + op.getTransactionId() + " expectedTxId=" + (currentTransactionId ...
[ "static", "long", "checkTransactionId", "(", "long", "currentTransactionId", ",", "FSEditLogOp", "op", ")", "throws", "IOException", "{", "if", "(", "currentTransactionId", "!=", "-", "1", ")", "{", "if", "(", "op", ".", "getTransactionId", "(", ")", "!=", "...
Asserts the read operation is the expected one. @param op the newly read operation @param expectedTransactionId @return next expected transaction id @throws IOException if the transaction id doesn't match the expected transaction id. The transaction id's should be consecutive.
[ "Asserts", "the", "read", "operation", "is", "the", "expected", "one", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderUtil.java#L87-L98
117,814
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/file/tfile/Utils.java
Utils.writeString
public static void writeString(DataOutput out, String s) throws IOException { if (s != null) { Text text = new Text(s); byte[] buffer = text.getBytes(); int len = text.getLength(); writeVInt(out, len); out.write(buffer, 0, len); } else { writeVInt(out, -1); } }
java
public static void writeString(DataOutput out, String s) throws IOException { if (s != null) { Text text = new Text(s); byte[] buffer = text.getBytes(); int len = text.getLength(); writeVInt(out, len); out.write(buffer, 0, len); } else { writeVInt(out, -1); } }
[ "public", "static", "void", "writeString", "(", "DataOutput", "out", ",", "String", "s", ")", "throws", "IOException", "{", "if", "(", "s", "!=", "null", ")", "{", "Text", "text", "=", "new", "Text", "(", "s", ")", ";", "byte", "[", "]", "buffer", ...
Write a String as a VInt n, followed by n Bytes as in Text format. @param out @param s @throws IOException
[ "Write", "a", "String", "as", "a", "VInt", "n", "followed", "by", "n", "Bytes", "as", "in", "Text", "format", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/file/tfile/Utils.java#L246-L256
117,815
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/file/tfile/Utils.java
Utils.readString
public static String readString(DataInput in) throws IOException { int length = readVInt(in); if (length == -1) return null; byte[] buffer = new byte[length]; in.readFully(buffer); return Text.decode(buffer); }
java
public static String readString(DataInput in) throws IOException { int length = readVInt(in); if (length == -1) return null; byte[] buffer = new byte[length]; in.readFully(buffer); return Text.decode(buffer); }
[ "public", "static", "String", "readString", "(", "DataInput", "in", ")", "throws", "IOException", "{", "int", "length", "=", "readVInt", "(", "in", ")", ";", "if", "(", "length", "==", "-", "1", ")", "return", "null", ";", "byte", "[", "]", "buffer", ...
Read a String as a VInt n, followed by n Bytes in Text format. @param in The input stream. @return The string @throws IOException
[ "Read", "a", "String", "as", "a", "VInt", "n", "followed", "by", "n", "Bytes", "in", "Text", "format", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/file/tfile/Utils.java#L266-L272
117,816
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/join/Parser.java
Parser.parse
static Node parse(String expr, JobConf job) throws IOException { if (null == expr) { throw new IOException("Expression is null"); } Class<? extends WritableComparator> cmpcl = job.getClass("mapred.join.keycomparator", null, WritableComparator.class); Lexer lex = new Lexer(expr); Stack<To...
java
static Node parse(String expr, JobConf job) throws IOException { if (null == expr) { throw new IOException("Expression is null"); } Class<? extends WritableComparator> cmpcl = job.getClass("mapred.join.keycomparator", null, WritableComparator.class); Lexer lex = new Lexer(expr); Stack<To...
[ "static", "Node", "parse", "(", "String", "expr", ",", "JobConf", "job", ")", "throws", "IOException", "{", "if", "(", "null", "==", "expr", ")", "{", "throw", "new", "IOException", "(", "\"Expression is null\"", ")", ";", "}", "Class", "<", "?", "extend...
Given an expression and an optional comparator, build a tree of InputFormats using the comparator to sort keys.
[ "Given", "an", "expression", "and", "an", "optional", "comparator", "build", "a", "tree", "of", "InputFormats", "using", "the", "comparator", "to", "sort", "keys", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/join/Parser.java#L461-L485
117,817
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/BookKeeperJournalOutputStream.java
BookKeeperJournalOutputStream.addBookKeeperEntry
private synchronized void addBookKeeperEntry(byte[] buf, int off, int len) throws IOException { try { ledger.addEntry(buf, off, len); if (LOG.isDebugEnabled()) { LOG.debug("Last add pushed to ledger " + ledger.getId() + " is " + ledger.getLastAddPushed()); LOG.debug("La...
java
private synchronized void addBookKeeperEntry(byte[] buf, int off, int len) throws IOException { try { ledger.addEntry(buf, off, len); if (LOG.isDebugEnabled()) { LOG.debug("Last add pushed to ledger " + ledger.getId() + " is " + ledger.getLastAddPushed()); LOG.debug("La...
[ "private", "synchronized", "void", "addBookKeeperEntry", "(", "byte", "[", "]", "buf", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "try", "{", "ledger", ".", "addEntry", "(", "buf", ",", "off", ",", "len", ")", ";", "if", ...
Write the buffer to a new entry in a BookKeeper ledger or throw an IOException if we are unable to successfully write to a quorum of bookies @param buf Buffer to write from @param off Offset in the buffer @param len How many bytes to write, starting the offset @throws IOException If we are interrupted while writing to ...
[ "Write", "the", "buffer", "to", "a", "new", "entry", "in", "a", "BookKeeper", "ledger", "or", "throw", "an", "IOException", "if", "we", "are", "unable", "to", "successfully", "write", "to", "a", "quorum", "of", "bookies" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/BookKeeperJournalOutputStream.java#L69-L85
117,818
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/BookKeeperJournalOutputStream.java
BookKeeperJournalOutputStream.write
@Override public void write(byte[] buf, int off, int len) throws IOException { addBookKeeperEntry(buf, off, len); }
java
@Override public void write(byte[] buf, int off, int len) throws IOException { addBookKeeperEntry(buf, off, len); }
[ "@", "Override", "public", "void", "write", "(", "byte", "[", "]", "buf", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "addBookKeeperEntry", "(", "buf", ",", "off", ",", "len", ")", ";", "}" ]
Write the buffer to a new entry in a BookKeeper ledger. @see OutputStream#write(byte[], int, int) @see #addBookKeeperEntry(byte[], int, int) @throws IOException If there is an error adding the BookKeeper entry.
[ "Write", "the", "buffer", "to", "a", "new", "entry", "in", "a", "BookKeeper", "ledger", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/BookKeeperJournalOutputStream.java#L110-L113
117,819
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/DistributedAvatarFileSystem.java
DistributedAvatarFileSystem.initStandbyFS
private void initStandbyFS() { lastStandbyFSInit = System.currentTimeMillis(); try { if (standbyFS != null) { standbyFS.close(); } LOG.info("DAFS initializing standbyFS"); LOG.info("DAFS primary=" + primaryURI.toString() + " standby=" + standbyURI.toString()); ...
java
private void initStandbyFS() { lastStandbyFSInit = System.currentTimeMillis(); try { if (standbyFS != null) { standbyFS.close(); } LOG.info("DAFS initializing standbyFS"); LOG.info("DAFS primary=" + primaryURI.toString() + " standby=" + standbyURI.toString()); ...
[ "private", "void", "initStandbyFS", "(", ")", "{", "lastStandbyFSInit", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "try", "{", "if", "(", "standbyFS", "!=", "null", ")", "{", "standbyFS", ".", "close", "(", ")", ";", "}", "LOG", ".", "info...
Try to initialize standbyFS. Must hold writelock to call this method.
[ "Try", "to", "initialize", "standbyFS", ".", "Must", "hold", "writelock", "to", "call", "this", "method", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/DistributedAvatarFileSystem.java#L179-L197
117,820
facebookarchive/hadoop-20
src/core/org/apache/hadoop/util/DataChecksum.java
DataChecksum.newDataChecksum
public static DataChecksum newDataChecksum( int type, int bytesPerChecksum, Checksum sum ) { if ( bytesPerChecksum <= 0 ) { return null; } int checksumSize = getChecksumSizeByType(type); switch ( type ) { case CHECKSUM_NULL : return new DataChecksum( CHECKSUM_NULL, new Che...
java
public static DataChecksum newDataChecksum( int type, int bytesPerChecksum, Checksum sum ) { if ( bytesPerChecksum <= 0 ) { return null; } int checksumSize = getChecksumSizeByType(type); switch ( type ) { case CHECKSUM_NULL : return new DataChecksum( CHECKSUM_NULL, new Che...
[ "public", "static", "DataChecksum", "newDataChecksum", "(", "int", "type", ",", "int", "bytesPerChecksum", ",", "Checksum", "sum", ")", "{", "if", "(", "bytesPerChecksum", "<=", "0", ")", "{", "return", "null", ";", "}", "int", "checksumSize", "=", "getCheck...
This constructor uses the specified summer instance
[ "This", "constructor", "uses", "the", "specified", "summer", "instance" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/DataChecksum.java#L74-L91
117,821
facebookarchive/hadoop-20
src/core/org/apache/hadoop/util/DataChecksum.java
DataChecksum.verifyChunkedSums
public void verifyChunkedSums(ByteBuffer data, ByteBuffer checksums, String fileName, long basePos) throws ChecksumException { if (size == 0) return; if (data.isDirect() && checksums.isDirect() && NativeCrc32.isAvailable()) { NativeCrc32.verifyChunkedSums(bytesPerChecksum, type, checksums, ...
java
public void verifyChunkedSums(ByteBuffer data, ByteBuffer checksums, String fileName, long basePos) throws ChecksumException { if (size == 0) return; if (data.isDirect() && checksums.isDirect() && NativeCrc32.isAvailable()) { NativeCrc32.verifyChunkedSums(bytesPerChecksum, type, checksums, ...
[ "public", "void", "verifyChunkedSums", "(", "ByteBuffer", "data", ",", "ByteBuffer", "checksums", ",", "String", "fileName", ",", "long", "basePos", ")", "throws", "ChecksumException", "{", "if", "(", "size", "==", "0", ")", "return", ";", "if", "(", "data",...
Verify that the given checksums match the given data. The 'mark' of the ByteBuffer parameters may be modified by this function,. but the position is maintained. @param data the DirectByteBuffer pointing to the data to verify. @param checksums the DirectByteBuffer pointing to a series of stored checksums @param fileNa...
[ "Verify", "that", "the", "given", "checksums", "match", "the", "given", "data", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/DataChecksum.java#L307-L354
117,822
facebookarchive/hadoop-20
src/core/org/apache/hadoop/util/DataChecksum.java
DataChecksum.verifyChunkedSums
private void verifyChunkedSums( byte[] data, int dataOff, int dataLen, byte[] checksums, int checksumsOff, String fileName, long basePos) throws ChecksumException { int remaining = dataLen; int dataPos = 0; while (remaining > 0) { int n = Math.min(remaining, bytesPerChec...
java
private void verifyChunkedSums( byte[] data, int dataOff, int dataLen, byte[] checksums, int checksumsOff, String fileName, long basePos) throws ChecksumException { int remaining = dataLen; int dataPos = 0; while (remaining > 0) { int n = Math.min(remaining, bytesPerChec...
[ "private", "void", "verifyChunkedSums", "(", "byte", "[", "]", "data", ",", "int", "dataOff", ",", "int", "dataLen", ",", "byte", "[", "]", "checksums", ",", "int", "checksumsOff", ",", "String", "fileName", ",", "long", "basePos", ")", "throws", "Checksum...
Implementation of chunked verification specifically on byte arrays. This is to avoid the copy when dealing with ByteBuffers that have array backing.
[ "Implementation", "of", "chunked", "verification", "specifically", "on", "byte", "arrays", ".", "This", "is", "to", "avoid", "the", "copy", "when", "dealing", "with", "ByteBuffers", "that", "have", "array", "backing", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/DataChecksum.java#L360-L388
117,823
facebookarchive/hadoop-20
src/core/org/apache/hadoop/util/DataChecksum.java
DataChecksum.calculateChunkedSums
public void calculateChunkedSums(ByteBuffer data, ByteBuffer checksums) { if (size == 0) return; if (data.hasArray() && checksums.hasArray()) { calculateChunkedSums(data.array(), data.arrayOffset() + data.position(), data.remaining(), checksums.array(), checksums.arrayOffset() + checks...
java
public void calculateChunkedSums(ByteBuffer data, ByteBuffer checksums) { if (size == 0) return; if (data.hasArray() && checksums.hasArray()) { calculateChunkedSums(data.array(), data.arrayOffset() + data.position(), data.remaining(), checksums.array(), checksums.arrayOffset() + checks...
[ "public", "void", "calculateChunkedSums", "(", "ByteBuffer", "data", ",", "ByteBuffer", "checksums", ")", "{", "if", "(", "size", "==", "0", ")", "return", ";", "if", "(", "data", ".", "hasArray", "(", ")", "&&", "checksums", ".", "hasArray", "(", ")", ...
Calculate checksums for the given data. The 'mark' of the ByteBuffer parameters may be modified by this function, but the position is maintained. @param data the DirectByteBuffer pointing to the data to checksum. @param checksums the DirectByteBuffer into which checksums will be stored. Enough space must be available...
[ "Calculate", "checksums", "for", "the", "given", "data", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/DataChecksum.java#L401-L425
117,824
facebookarchive/hadoop-20
src/core/org/apache/hadoop/util/DataChecksum.java
DataChecksum.calculateChunkedSums
private void calculateChunkedSums( byte[] data, int dataOffset, int dataLength, byte[] sums, int sumsOffset) { int remaining = dataLength; while (remaining > 0) { int n = Math.min(remaining, bytesPerChecksum); summer.reset(); summer.update(data, dataOffset, n); data...
java
private void calculateChunkedSums( byte[] data, int dataOffset, int dataLength, byte[] sums, int sumsOffset) { int remaining = dataLength; while (remaining > 0) { int n = Math.min(remaining, bytesPerChecksum); summer.reset(); summer.update(data, dataOffset, n); data...
[ "private", "void", "calculateChunkedSums", "(", "byte", "[", "]", "data", ",", "int", "dataOffset", ",", "int", "dataLength", ",", "byte", "[", "]", "sums", ",", "int", "sumsOffset", ")", "{", "int", "remaining", "=", "dataLength", ";", "while", "(", "re...
Implementation of chunked calculation specifically on byte arrays. This is to avoid the copy when dealing with ByteBuffers that have array backing.
[ "Implementation", "of", "chunked", "calculation", "specifically", "on", "byte", "arrays", ".", "This", "is", "to", "avoid", "the", "copy", "when", "dealing", "with", "ByteBuffers", "that", "have", "array", "backing", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/DataChecksum.java#L431-L448
117,825
facebookarchive/hadoop-20
src/core/org/apache/hadoop/util/AsyncDiskService.java
AsyncDiskService.shutdown
public synchronized void shutdown() { LOG.info("Shutting down all AsyncDiskService threads..."); for (Map.Entry<String, ThreadPoolExecutor> e : executors.entrySet()) { e.getValue().shutdown(); } }
java
public synchronized void shutdown() { LOG.info("Shutting down all AsyncDiskService threads..."); for (Map.Entry<String, ThreadPoolExecutor> e : executors.entrySet()) { e.getValue().shutdown(); } }
[ "public", "synchronized", "void", "shutdown", "(", ")", "{", "LOG", ".", "info", "(", "\"Shutting down all AsyncDiskService threads...\"", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "ThreadPoolExecutor", ">", "e", ":", "executors", ".", "en...
Gracefully start the shut down of all ThreadPools.
[ "Gracefully", "start", "the", "shut", "down", "of", "all", "ThreadPools", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/AsyncDiskService.java#L127-L135
117,826
facebookarchive/hadoop-20
src/core/org/apache/hadoop/util/AsyncDiskService.java
AsyncDiskService.shutdownNow
public synchronized List<Runnable> shutdownNow() { LOG.info("Shutting down all AsyncDiskService threads immediately..."); List<Runnable> list = new ArrayList<Runnable>(); for (Map.Entry<String, ThreadPoolExecutor> e : executors.entrySet()) { list.addAll(e.getValue().shutdownNow()); ...
java
public synchronized List<Runnable> shutdownNow() { LOG.info("Shutting down all AsyncDiskService threads immediately..."); List<Runnable> list = new ArrayList<Runnable>(); for (Map.Entry<String, ThreadPoolExecutor> e : executors.entrySet()) { list.addAll(e.getValue().shutdownNow()); ...
[ "public", "synchronized", "List", "<", "Runnable", ">", "shutdownNow", "(", ")", "{", "LOG", ".", "info", "(", "\"Shutting down all AsyncDiskService threads immediately...\"", ")", ";", "List", "<", "Runnable", ">", "list", "=", "new", "ArrayList", "<", "Runnable"...
Shut down all ThreadPools immediately.
[ "Shut", "down", "all", "ThreadPools", "immediately", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/AsyncDiskService.java#L165-L175
117,827
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/server/UploadImageServlet.java
UploadImageServlet.clearObsoleteImageUploads
public synchronized static void clearObsoleteImageUploads(long minTxIdToKeep, String journalId) { for (Iterator<Map.Entry<Long, SessionDescriptor>> it = sessions.entrySet() .iterator(); it.hasNext();) { Map.Entry<Long, SessionDescriptor> entry = it.next(); if (entry.getValue().journalId.eq...
java
public synchronized static void clearObsoleteImageUploads(long minTxIdToKeep, String journalId) { for (Iterator<Map.Entry<Long, SessionDescriptor>> it = sessions.entrySet() .iterator(); it.hasNext();) { Map.Entry<Long, SessionDescriptor> entry = it.next(); if (entry.getValue().journalId.eq...
[ "public", "synchronized", "static", "void", "clearObsoleteImageUploads", "(", "long", "minTxIdToKeep", ",", "String", "journalId", ")", "{", "for", "(", "Iterator", "<", "Map", ".", "Entry", "<", "Long", ",", "SessionDescriptor", ">", ">", "it", "=", "sessions...
Clean the map from obsolete images.
[ "Clean", "the", "map", "from", "obsolete", "images", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/UploadImageServlet.java#L77-L87
117,828
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/server/UploadImageServlet.java
UploadImageServlet.getStorage
private static Journal getStorage(ServletContext context, UploadImageParam params) throws IOException { final Journal journal = JournalNodeHttpServer .getJournalFromContextIfExists(context, params.journalId); if (journal == null) { throwIOException("Journal: " + params.journalId + " does not...
java
private static Journal getStorage(ServletContext context, UploadImageParam params) throws IOException { final Journal journal = JournalNodeHttpServer .getJournalFromContextIfExists(context, params.journalId); if (journal == null) { throwIOException("Journal: " + params.journalId + " does not...
[ "private", "static", "Journal", "getStorage", "(", "ServletContext", "context", ",", "UploadImageParam", "params", ")", "throws", "IOException", "{", "final", "Journal", "journal", "=", "JournalNodeHttpServer", ".", "getJournalFromContextIfExists", "(", "context", ",", ...
Get storage object from underlying journal node, given request parameters. If yournal does not exist, an exception will be thrown. If the journal metadata does not match the request metadata, we also fail.
[ "Get", "storage", "object", "from", "underlying", "journal", "node", "given", "request", "parameters", ".", "If", "yournal", "does", "not", "exist", "an", "exception", "will", "be", "thrown", ".", "If", "the", "journal", "metadata", "does", "not", "match", "...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/UploadImageServlet.java#L94-L111
117,829
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapreduce/Reducer.java
Reducer.reduce
@SuppressWarnings("unchecked") protected void reduce(KEYIN key, Iterable<VALUEIN> values, Context context ) throws IOException, InterruptedException { for(VALUEIN value: values) { context.write((KEYOUT) key, (VALUEOUT) value); } }
java
@SuppressWarnings("unchecked") protected void reduce(KEYIN key, Iterable<VALUEIN> values, Context context ) throws IOException, InterruptedException { for(VALUEIN value: values) { context.write((KEYOUT) key, (VALUEOUT) value); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "void", "reduce", "(", "KEYIN", "key", ",", "Iterable", "<", "VALUEIN", ">", "values", ",", "Context", "context", ")", "throws", "IOException", ",", "InterruptedException", "{", "for", "(", "VALU...
This method is called once for each key. Most applications will define their reduce class by overriding this method. The default implementation is an identity function.
[ "This", "method", "is", "called", "once", "for", "each", "key", ".", "Most", "applications", "will", "define", "their", "reduce", "class", "by", "overriding", "this", "method", ".", "The", "default", "implementation", "is", "an", "identity", "function", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/Reducer.java#L152-L158
117,830
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/BufferedByteOutputStream.java
BufferedByteOutputStream.wrapOutputStream
public static DataOutputStream wrapOutputStream(OutputStream os, int bufferSize, int writeBufferSize) { // wrapping BufferedByteOutputStream in BufferedOutputStream decreases // pressure on BBOS internal locks, and we read from the BBOS in // bigger chunks return new DataOutputStream(new BufferedO...
java
public static DataOutputStream wrapOutputStream(OutputStream os, int bufferSize, int writeBufferSize) { // wrapping BufferedByteOutputStream in BufferedOutputStream decreases // pressure on BBOS internal locks, and we read from the BBOS in // bigger chunks return new DataOutputStream(new BufferedO...
[ "public", "static", "DataOutputStream", "wrapOutputStream", "(", "OutputStream", "os", ",", "int", "bufferSize", ",", "int", "writeBufferSize", ")", "{", "// wrapping BufferedByteOutputStream in BufferedOutputStream decreases", "// pressure on BBOS internal locks, and we read from th...
Wrap given output stream with BufferedByteInputOutput. This is the only way to instantiate the buffered output stream. @param os underlying output stream @param bufferSize size of the in memory buffer @param writeBufferSize size of the buffer used for writing to is
[ "Wrap", "given", "output", "stream", "with", "BufferedByteInputOutput", ".", "This", "is", "the", "only", "way", "to", "instantiate", "the", "buffered", "output", "stream", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/BufferedByteOutputStream.java#L59-L66
117,831
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/BufferedByteOutputStream.java
BufferedByteOutputStream.close
public void close() throws IOException { if (closed) { checkWriteThread(); return; } try { buffer.close(); // writeThread should exit after this // and close underlying stream try { writeThread.join(); } catch (InterruptedException e) { throw new...
java
public void close() throws IOException { if (closed) { checkWriteThread(); return; } try { buffer.close(); // writeThread should exit after this // and close underlying stream try { writeThread.join(); } catch (InterruptedException e) { throw new...
[ "public", "void", "close", "(", ")", "throws", "IOException", "{", "if", "(", "closed", ")", "{", "checkWriteThread", "(", ")", ";", "return", ";", "}", "try", "{", "buffer", ".", "close", "(", ")", ";", "// writeThread should exit after this", "// and close...
Close the output stream. Joins the thread and closes the underlying output stream.
[ "Close", "the", "output", "stream", ".", "Joins", "the", "thread", "and", "closes", "the", "underlying", "output", "stream", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/BufferedByteOutputStream.java#L87-L104
117,832
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/BufferedByteOutputStream.java
BufferedByteOutputStream.flush
public void flush() throws IOException { // check if the stream has been closed checkError(); // how many bytes were written to the buffer long totalBytesWritten = buffer.totalWritten(); // unblock reads from the buffer buffer.unblockReads(); // wait until the write thread tra...
java
public void flush() throws IOException { // check if the stream has been closed checkError(); // how many bytes were written to the buffer long totalBytesWritten = buffer.totalWritten(); // unblock reads from the buffer buffer.unblockReads(); // wait until the write thread tra...
[ "public", "void", "flush", "(", ")", "throws", "IOException", "{", "// check if the stream has been closed", "checkError", "(", ")", ";", "// how many bytes were written to the buffer", "long", "totalBytesWritten", "=", "buffer", ".", "totalWritten", "(", ")", ";", "// ...
Waits until the buffer has been written to underlying stream. Flushes the underlying stream.
[ "Waits", "until", "the", "buffer", "has", "been", "written", "to", "underlying", "stream", ".", "Flushes", "the", "underlying", "stream", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/BufferedByteOutputStream.java#L110-L138
117,833
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java
ImageSet.validate
private void validate(File root, Collection<URI> dirs) throws IOException { if (dirs == null) return; for (URI dir : dirs) { if (new File(dir.getPath()).getAbsolutePath().equals( root.getAbsolutePath())) { // we found the corresponding entry return; } } throwI...
java
private void validate(File root, Collection<URI> dirs) throws IOException { if (dirs == null) return; for (URI dir : dirs) { if (new File(dir.getPath()).getAbsolutePath().equals( root.getAbsolutePath())) { // we found the corresponding entry return; } } throwI...
[ "private", "void", "validate", "(", "File", "root", ",", "Collection", "<", "URI", ">", "dirs", ")", "throws", "IOException", "{", "if", "(", "dirs", "==", "null", ")", "return", ";", "for", "(", "URI", "dir", ":", "dirs", ")", "{", "if", "(", "new...
For sanity checking that the given storage directory was configured.
[ "For", "sanity", "checking", "that", "the", "given", "storage", "directory", "was", "configured", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java#L90-L102
117,834
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java
ImageSet.validate
private void validate(URI location, Collection<URI> dirs) throws IOException { if (dirs != null && !dirs.contains(location)) { throwIOException("Error. Location: " + location + " is not in the configured list of storage directories: " + dirs); } }
java
private void validate(URI location, Collection<URI> dirs) throws IOException { if (dirs != null && !dirs.contains(location)) { throwIOException("Error. Location: " + location + " is not in the configured list of storage directories: " + dirs); } }
[ "private", "void", "validate", "(", "URI", "location", ",", "Collection", "<", "URI", ">", "dirs", ")", "throws", "IOException", "{", "if", "(", "dirs", "!=", "null", "&&", "!", "dirs", ".", "contains", "(", "location", ")", ")", "{", "throwIOException",...
For sanity checking that the given location was configured.
[ "For", "sanity", "checking", "that", "the", "given", "location", "was", "configured", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java#L107-L112
117,835
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java
ImageSet.getCheckpointImageOutputStreams
public synchronized List<OutputStream> getCheckpointImageOutputStreams( long imageTxId) throws IOException { List<OutputStream> list = new ArrayList<OutputStream>(); for (ImageManager im : imageManagers) { list.add(im.getCheckpointOutputStream(imageTxId)); } return list; }
java
public synchronized List<OutputStream> getCheckpointImageOutputStreams( long imageTxId) throws IOException { List<OutputStream> list = new ArrayList<OutputStream>(); for (ImageManager im : imageManagers) { list.add(im.getCheckpointOutputStream(imageTxId)); } return list; }
[ "public", "synchronized", "List", "<", "OutputStream", ">", "getCheckpointImageOutputStreams", "(", "long", "imageTxId", ")", "throws", "IOException", "{", "List", "<", "OutputStream", ">", "list", "=", "new", "ArrayList", "<", "OutputStream", ">", "(", ")", ";"...
Get the list of output streams for all underlying image managers, given the checkpoint transaction id.
[ "Get", "the", "list", "of", "output", "streams", "for", "all", "underlying", "image", "managers", "given", "the", "checkpoint", "transaction", "id", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java#L118-L125
117,836
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java
ImageSet.saveDigestAndRenameCheckpointImage
public synchronized void saveDigestAndRenameCheckpointImage(long txid, MD5Hash digest) throws IOException { for (ImageManager im : imageManagers) { if (im.saveDigestAndRenameCheckpointImage(txid, digest)) { // restore enabled state im.setImageDisabled(false); } else { // fa...
java
public synchronized void saveDigestAndRenameCheckpointImage(long txid, MD5Hash digest) throws IOException { for (ImageManager im : imageManagers) { if (im.saveDigestAndRenameCheckpointImage(txid, digest)) { // restore enabled state im.setImageDisabled(false); } else { // fa...
[ "public", "synchronized", "void", "saveDigestAndRenameCheckpointImage", "(", "long", "txid", ",", "MD5Hash", "digest", ")", "throws", "IOException", "{", "for", "(", "ImageManager", "im", ":", "imageManagers", ")", "{", "if", "(", "im", ".", "saveDigestAndRenameCh...
Save digest in all underlying image managers, and rename the checkpoint file. This will throw an exception if all image managers fail.
[ "Save", "digest", "in", "all", "underlying", "image", "managers", "and", "rename", "the", "checkpoint", "file", ".", "This", "will", "throw", "an", "exception", "if", "all", "image", "managers", "fail", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java#L131-L143
117,837
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java
ImageSet.checkImageManagers
void checkImageManagers() throws IOException { updateImageMetrics(); int numAvailable = 0; for (ImageManager im : imageManagers) { if (!im.isImageDisabled()) { numAvailable++; } } if (numAvailable == 0) { throwIOException("No image locations are available"); } }
java
void checkImageManagers() throws IOException { updateImageMetrics(); int numAvailable = 0; for (ImageManager im : imageManagers) { if (!im.isImageDisabled()) { numAvailable++; } } if (numAvailable == 0) { throwIOException("No image locations are available"); } }
[ "void", "checkImageManagers", "(", ")", "throws", "IOException", "{", "updateImageMetrics", "(", ")", ";", "int", "numAvailable", "=", "0", ";", "for", "(", "ImageManager", "im", ":", "imageManagers", ")", "{", "if", "(", "!", "im", ".", "isImageDisabled", ...
Check if any image managers are available.
[ "Check", "if", "any", "image", "managers", "are", "available", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java#L148-L159
117,838
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java
ImageSet.updateImageMetrics
void updateImageMetrics() { if (metrics == null) { return; } int failedImageDirs = 0; for (ImageManager im : imageManagers) { if(im.isImageDisabled()) { failedImageDirs++; } } // update only images, journals are handled in JournalSet metrics.imagesFailed.set(failedI...
java
void updateImageMetrics() { if (metrics == null) { return; } int failedImageDirs = 0; for (ImageManager im : imageManagers) { if(im.isImageDisabled()) { failedImageDirs++; } } // update only images, journals are handled in JournalSet metrics.imagesFailed.set(failedI...
[ "void", "updateImageMetrics", "(", ")", "{", "if", "(", "metrics", "==", "null", ")", "{", "return", ";", "}", "int", "failedImageDirs", "=", "0", ";", "for", "(", "ImageManager", "im", ":", "imageManagers", ")", "{", "if", "(", "im", ".", "isImageDisa...
Count available image managers and update namenode metrics.
[ "Count", "available", "image", "managers", "and", "update", "namenode", "metrics", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java#L171-L183
117,839
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java
ImageSet.transitionNonFileImages
public void transitionNonFileImages(StorageInfo nsInfo, boolean checkEmpty, Transition transition, StartupOption startOpt) throws IOException { for (ImageManager im : imageManagers) { if (!(im instanceof FileImageManager)) { if (checkEmpty && im.hasSomeImageData()) { LOG.warn("Im...
java
public void transitionNonFileImages(StorageInfo nsInfo, boolean checkEmpty, Transition transition, StartupOption startOpt) throws IOException { for (ImageManager im : imageManagers) { if (!(im instanceof FileImageManager)) { if (checkEmpty && im.hasSomeImageData()) { LOG.warn("Im...
[ "public", "void", "transitionNonFileImages", "(", "StorageInfo", "nsInfo", ",", "boolean", "checkEmpty", ",", "Transition", "transition", ",", "StartupOption", "startOpt", ")", "throws", "IOException", "{", "for", "(", "ImageManager", "im", ":", "imageManagers", ")"...
Format the non-file images.
[ "Format", "the", "non", "-", "file", "images", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java#L206-L219
117,840
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java
ImageSet.getNonFileImageManagers
List<ImageManager> getNonFileImageManagers() { List<ImageManager> nonFile = new ArrayList<ImageManager>(); for (ImageManager im : imageManagers) { if (!(im instanceof FileImageManager)) { nonFile.add(im); } } return nonFile; }
java
List<ImageManager> getNonFileImageManagers() { List<ImageManager> nonFile = new ArrayList<ImageManager>(); for (ImageManager im : imageManagers) { if (!(im instanceof FileImageManager)) { nonFile.add(im); } } return nonFile; }
[ "List", "<", "ImageManager", ">", "getNonFileImageManagers", "(", ")", "{", "List", "<", "ImageManager", ">", "nonFile", "=", "new", "ArrayList", "<", "ImageManager", ">", "(", ")", ";", "for", "(", "ImageManager", "im", ":", "imageManagers", ")", "{", "if...
Get the list of non-file image managers.
[ "Get", "the", "list", "of", "non", "-", "file", "image", "managers", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java#L231-L239
117,841
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java
ImageSet.convertFilesToStreams
public static List<OutputStream> convertFilesToStreams(File[] localPaths, Storage dstStorage, String str) throws IOException { List<OutputStream> outputStreams = new ArrayList<OutputStream>(); if (localPaths != null) { for (File f : localPaths) { try { if (f.exists()) { ...
java
public static List<OutputStream> convertFilesToStreams(File[] localPaths, Storage dstStorage, String str) throws IOException { List<OutputStream> outputStreams = new ArrayList<OutputStream>(); if (localPaths != null) { for (File f : localPaths) { try { if (f.exists()) { ...
[ "public", "static", "List", "<", "OutputStream", ">", "convertFilesToStreams", "(", "File", "[", "]", "localPaths", ",", "Storage", "dstStorage", ",", "String", "str", ")", "throws", "IOException", "{", "List", "<", "OutputStream", ">", "outputStreams", "=", "...
Convert given list of files to a list of output streams.
[ "Convert", "given", "list", "of", "files", "to", "a", "list", "of", "output", "streams", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java#L251-L276
117,842
facebookarchive/hadoop-20
src/contrib/storageservice/src/java/org/apache/hadoop/hdfs/storageservice/server/TClientProxyProtocolServer.java
TClientProxyProtocolServer.getServerConfig
private static ThriftServerConfig getServerConfig(Configuration conf) { ThriftServerConfig serverConfig = new ThriftServerConfig(); serverConfig.setPort(conf.getInt(StorageServiceConfigKeys.PROXY_THRIFT_PORT_KEY, StorageServiceConfigKeys.PROXY_THRIFT_PORT_DEFAULT)); return serverConfig; }
java
private static ThriftServerConfig getServerConfig(Configuration conf) { ThriftServerConfig serverConfig = new ThriftServerConfig(); serverConfig.setPort(conf.getInt(StorageServiceConfigKeys.PROXY_THRIFT_PORT_KEY, StorageServiceConfigKeys.PROXY_THRIFT_PORT_DEFAULT)); return serverConfig; }
[ "private", "static", "ThriftServerConfig", "getServerConfig", "(", "Configuration", "conf", ")", "{", "ThriftServerConfig", "serverConfig", "=", "new", "ThriftServerConfig", "(", ")", ";", "serverConfig", ".", "setPort", "(", "conf", ".", "getInt", "(", "StorageServ...
Translates Hadoop's Configuration into Thrift's server config
[ "Translates", "Hadoop", "s", "Configuration", "into", "Thrift", "s", "server", "config" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/storageservice/src/java/org/apache/hadoop/hdfs/storageservice/server/TClientProxyProtocolServer.java#L73-L78
117,843
facebookarchive/hadoop-20
src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/SensorsParser.java
SensorsParser.query
public EventRecord query(String s) throws Exception { StringBuffer sb; //sb = Environment.runCommand("sensors -A"); sb = Environment.runCommand("cat sensors.out"); EventRecord retval = new EventRecord(InetAddress.getLocalHost() .getCanonicalHostName(), InetAddress.getAllByName(InetAddress.get...
java
public EventRecord query(String s) throws Exception { StringBuffer sb; //sb = Environment.runCommand("sensors -A"); sb = Environment.runCommand("cat sensors.out"); EventRecord retval = new EventRecord(InetAddress.getLocalHost() .getCanonicalHostName(), InetAddress.getAllByName(InetAddress.get...
[ "public", "EventRecord", "query", "(", "String", "s", ")", "throws", "Exception", "{", "StringBuffer", "sb", ";", "//sb = Environment.runCommand(\"sensors -A\");", "sb", "=", "Environment", ".", "runCommand", "(", "\"cat sensors.out\"", ")", ";", "EventRecord", "retva...
Reads and parses the output of the 'sensors' command and creates an appropriate EventRecord that holds the desirable information. @param s unused parameter @return the EventRecord created
[ "Reads", "and", "parses", "the", "output", "of", "the", "sensors", "command", "and", "creates", "an", "appropriate", "EventRecord", "that", "holds", "the", "desirable", "information", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/SensorsParser.java#L44-L60
117,844
facebookarchive/hadoop-20
src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/SensorsParser.java
SensorsParser.readGroup
private EventRecord readGroup(EventRecord er, StringBuffer sb, String prefix) { Pattern pattern = Pattern.compile(".*(" + prefix + "\\s*\\d*)\\s*:\\s*(\\+?\\d+)", Pattern.MULTILINE); Matcher matcher = pattern.matcher(sb); while (matcher.find()) er.set(matcher.group(1), matcher.group(2)); ...
java
private EventRecord readGroup(EventRecord er, StringBuffer sb, String prefix) { Pattern pattern = Pattern.compile(".*(" + prefix + "\\s*\\d*)\\s*:\\s*(\\+?\\d+)", Pattern.MULTILINE); Matcher matcher = pattern.matcher(sb); while (matcher.find()) er.set(matcher.group(1), matcher.group(2)); ...
[ "private", "EventRecord", "readGroup", "(", "EventRecord", "er", ",", "StringBuffer", "sb", ",", "String", "prefix", ")", "{", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "\".*(\"", "+", "prefix", "+", "\"\\\\s*\\\\d*)\\\\s*:\\\\s*(\\\\+?\\\\d+)\"", ...
Reads and parses lines that provide the output of a group of sensors with the same functionality. @param er the EventRecord to which the new attributes are added @param sb the text to parse @param prefix a String prefix specifying the common prefix of the sensors' names in the group (e.g. "fan", "in", "temp" @return ...
[ "Reads", "and", "parses", "lines", "that", "provide", "the", "output", "of", "a", "group", "of", "sensors", "with", "the", "same", "functionality", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/SensorsParser.java#L73-L83
117,845
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/ChecksumFileSystem.java
ChecksumFileSystem.isChecksumFile
public static boolean isChecksumFile(Path file) { String name = file.getName(); return name.startsWith(".") && name.endsWith(".crc"); }
java
public static boolean isChecksumFile(Path file) { String name = file.getName(); return name.startsWith(".") && name.endsWith(".crc"); }
[ "public", "static", "boolean", "isChecksumFile", "(", "Path", "file", ")", "{", "String", "name", "=", "file", ".", "getName", "(", ")", ";", "return", "name", ".", "startsWith", "(", "\".\"", ")", "&&", "name", ".", "endsWith", "(", "\".crc\"", ")", "...
Return true iff file is a checksum file name.
[ "Return", "true", "iff", "file", "is", "a", "checksum", "file", "name", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/ChecksumFileSystem.java#L77-L80
117,846
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/ChecksumFileSystem.java
ChecksumFileSystem.copyToLocalFile
public void copyToLocalFile(Path src, Path dst, boolean copyCrc) throws IOException { if (!fs.isDirectory(src)) { // source is a file fs.copyToLocalFile(src, dst); FileSystem localFs = getLocal(getConf()).getRawFileSystem(); if (localFs.isDirectory(dst)) { dst = new Path(dst, src.getNa...
java
public void copyToLocalFile(Path src, Path dst, boolean copyCrc) throws IOException { if (!fs.isDirectory(src)) { // source is a file fs.copyToLocalFile(src, dst); FileSystem localFs = getLocal(getConf()).getRawFileSystem(); if (localFs.isDirectory(dst)) { dst = new Path(dst, src.getNa...
[ "public", "void", "copyToLocalFile", "(", "Path", "src", ",", "Path", "dst", ",", "boolean", "copyCrc", ")", "throws", "IOException", "{", "if", "(", "!", "fs", ".", "isDirectory", "(", "src", ")", ")", "{", "// source is a file", "fs", ".", "copyToLocalFi...
The src file is under FS, and the dst is on the local disk. Copy it from FS control to the local dst name. If src and dst are directories, the copyCrc parameter determines whether to copy CRC files.
[ "The", "src", "file", "is", "under", "FS", "and", "the", "dst", "is", "on", "the", "local", "disk", ".", "Copy", "it", "from", "FS", "control", "to", "the", "local", "dst", "name", ".", "If", "src", "and", "dst", "are", "directories", "the", "copyCrc...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/ChecksumFileSystem.java#L547-L570
117,847
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/ChecksumFileSystem.java
ChecksumFileSystem.reportChecksumFailure
public boolean reportChecksumFailure(Path f, FSDataInputStream in, long inPos, FSDataInputStream sums, long sumsPos) { return false; }
java
public boolean reportChecksumFailure(Path f, FSDataInputStream in, long inPos, FSDataInputStream sums, long sumsPos) { return false; }
[ "public", "boolean", "reportChecksumFailure", "(", "Path", "f", ",", "FSDataInputStream", "in", ",", "long", "inPos", ",", "FSDataInputStream", "sums", ",", "long", "sumsPos", ")", "{", "return", "false", ";", "}" ]
Report a checksum error to the file system. @param f the file name containing the error @param in the stream open on the file @param inPos the position of the beginning of the bad data in the file @param sums the stream open on the checksum file @param sumsPos the position of the beginning of the bad data in the checks...
[ "Report", "a", "checksum", "error", "to", "the", "file", "system", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/ChecksumFileSystem.java#L593-L596
117,848
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/Encoder.java
Encoder.recoverParityBlockToStream
public CRC32 recoverParityBlockToStream( FileSystem fs, FileStatus srcStat, long blockSize, Path parityFile, long corruptOffset, OutputStream out, Progressable progress) throws IOException { LOG.info("Recovering parity block" + parityFile + ":" + corruptOffset); Path srcFile = srcStat.getPath(); ...
java
public CRC32 recoverParityBlockToStream( FileSystem fs, FileStatus srcStat, long blockSize, Path parityFile, long corruptOffset, OutputStream out, Progressable progress) throws IOException { LOG.info("Recovering parity block" + parityFile + ":" + corruptOffset); Path srcFile = srcStat.getPath(); ...
[ "public", "CRC32", "recoverParityBlockToStream", "(", "FileSystem", "fs", ",", "FileStatus", "srcStat", ",", "long", "blockSize", ",", "Path", "parityFile", ",", "long", "corruptOffset", ",", "OutputStream", "out", ",", "Progressable", "progress", ")", "throws", "...
Recovers a corrupt block in a parity file to a local file. The encoder generates codec.parityLength parity blocks for a source file stripe. Since we want only one of the parity blocks, this function creates null outputs for the blocks to be discarded. @param fs The filesystem in which both srcFile and parityFile resi...
[ "Recovers", "a", "corrupt", "block", "in", "a", "parity", "file", "to", "a", "local", "file", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/Encoder.java#L562-L613
117,849
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/Encoder.java
Encoder.encodeStripe
void encodeStripe( InputStream[] blocks, long blockSize, OutputStream[] outs, CRC32[] crcOuts, Progressable reporter, boolean computeSrcChecksum, List<Integer> errorLocations) throws IOException { configureBuffers(blockSize); int boundedBufferCapacity = 1; ParallelStreamReader pa...
java
void encodeStripe( InputStream[] blocks, long blockSize, OutputStream[] outs, CRC32[] crcOuts, Progressable reporter, boolean computeSrcChecksum, List<Integer> errorLocations) throws IOException { configureBuffers(blockSize); int boundedBufferCapacity = 1; ParallelStreamReader pa...
[ "void", "encodeStripe", "(", "InputStream", "[", "]", "blocks", ",", "long", "blockSize", ",", "OutputStream", "[", "]", "outs", ",", "CRC32", "[", "]", "crcOuts", ",", "Progressable", "reporter", ",", "boolean", "computeSrcChecksum", ",", "List", "<", "Inte...
Wraps around encodeStripeImpl in order to configure buffers. Having buffers of the right size is extremely important. If the the buffer size is not a divisor of the block size, we may end up reading across block boundaries.
[ "Wraps", "around", "encodeStripeImpl", "in", "order", "to", "configure", "buffers", ".", "Having", "buffers", "of", "the", "right", "size", "is", "extremely", "important", ".", "If", "the", "the", "buffer", "size", "is", "not", "a", "divisor", "of", "the", ...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/Encoder.java#L750-L805
117,850
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/Text.java
Text.writeStringOpt
public static void writeStringOpt(DataOutput out, String str) throws IOException{ if (str == null) { WritableUtils.writeVInt(out, NULL_STRING_LENGTH); return; } final int len = str.length(); TempArrays ta = UTF8.getArrays(len); byte[] rawBytes = ta.byteArray; char[] charArray ...
java
public static void writeStringOpt(DataOutput out, String str) throws IOException{ if (str == null) { WritableUtils.writeVInt(out, NULL_STRING_LENGTH); return; } final int len = str.length(); TempArrays ta = UTF8.getArrays(len); byte[] rawBytes = ta.byteArray; char[] charArray ...
[ "public", "static", "void", "writeStringOpt", "(", "DataOutput", "out", ",", "String", "str", ")", "throws", "IOException", "{", "if", "(", "str", "==", "null", ")", "{", "WritableUtils", ".", "writeVInt", "(", "out", ",", "NULL_STRING_LENGTH", ")", ";", "...
Writes the string to the output, if possible the encoding part is optimized.
[ "Writes", "the", "string", "to", "the", "output", "if", "possible", "the", "encoding", "part", "is", "optimized", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/Text.java#L448-L474
117,851
facebookarchive/hadoop-20
src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/NICParser.java
NICParser.query
public EventRecord query(String device) throws UnknownHostException { StringBuffer sb = Environment.runCommand("/sbin/ifconfig " + device); EventRecord retval = new EventRecord(InetAddress.getLocalHost() .getCanonicalHostName(), InetAddress.getAllByName(InetAddress.getLocalHost() .getHostName())...
java
public EventRecord query(String device) throws UnknownHostException { StringBuffer sb = Environment.runCommand("/sbin/ifconfig " + device); EventRecord retval = new EventRecord(InetAddress.getLocalHost() .getCanonicalHostName(), InetAddress.getAllByName(InetAddress.getLocalHost() .getHostName())...
[ "public", "EventRecord", "query", "(", "String", "device", ")", "throws", "UnknownHostException", "{", "StringBuffer", "sb", "=", "Environment", ".", "runCommand", "(", "\"/sbin/ifconfig \"", "+", "device", ")", ";", "EventRecord", "retval", "=", "new", "EventReco...
Reads and parses the output of ifconfig for a specified NIC and creates an appropriate EventRecord that holds the desirable information for it. @param device the NIC device name to query @return the EventRecord created
[ "Reads", "and", "parses", "the", "output", "of", "ifconfig", "for", "a", "specified", "NIC", "and", "creates", "an", "appropriate", "EventRecord", "that", "holds", "the", "desirable", "information", "for", "it", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/NICParser.java#L56-L104
117,852
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/join/JoinRecordReader.java
JoinRecordReader.next
public boolean next(K key, TupleWritable value) throws IOException { if (jc.flush(value)) { WritableUtils.cloneInto(key, jc.key()); return true; } jc.clear(); K iterkey = createKey(); final PriorityQueue<ComposableRecordReader<K,?>> q = getRecordReaderQueue(); while (!q.isEmpty()) { ...
java
public boolean next(K key, TupleWritable value) throws IOException { if (jc.flush(value)) { WritableUtils.cloneInto(key, jc.key()); return true; } jc.clear(); K iterkey = createKey(); final PriorityQueue<ComposableRecordReader<K,?>> q = getRecordReaderQueue(); while (!q.isEmpty()) { ...
[ "public", "boolean", "next", "(", "K", "key", ",", "TupleWritable", "value", ")", "throws", "IOException", "{", "if", "(", "jc", ".", "flush", "(", "value", ")", ")", "{", "WritableUtils", ".", "cloneInto", "(", "key", ",", "jc", ".", "key", "(", ")"...
Emit the next set of key, value pairs as defined by the child RecordReaders and operation associated with this composite RR.
[ "Emit", "the", "next", "set", "of", "key", "value", "pairs", "as", "defined", "by", "the", "child", "RecordReaders", "and", "operation", "associated", "with", "this", "composite", "RR", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/join/JoinRecordReader.java#L47-L65
117,853
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java
CompletedJobStatusStore.store
public void store(JobInProgress job) { if (active && retainTime > 0) { JobID jobId = job.getStatus().getJobID(); Path jobStatusFile = getInfoFilePath(jobId); try { FSDataOutputStream dataOut = fs.create(jobStatusFile); job.getStatus().write(dataOut); job.getProfile().writ...
java
public void store(JobInProgress job) { if (active && retainTime > 0) { JobID jobId = job.getStatus().getJobID(); Path jobStatusFile = getInfoFilePath(jobId); try { FSDataOutputStream dataOut = fs.create(jobStatusFile); job.getStatus().write(dataOut); job.getProfile().writ...
[ "public", "void", "store", "(", "JobInProgress", "job", ")", "{", "if", "(", "active", "&&", "retainTime", ">", "0", ")", "{", "JobID", "jobId", "=", "job", ".", "getStatus", "(", ")", ".", "getJobID", "(", ")", ";", "Path", "jobStatusFile", "=", "ge...
Persists a job in DFS. @param job the job about to be 'retired'
[ "Persists", "a", "job", "in", "DFS", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java#L140-L172
117,854
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java
CompletedJobStatusStore.readJobStatus
public JobStatus readJobStatus(JobID jobId) { JobStatus jobStatus = null; if (null == jobId) { LOG.warn("Could not read job status for null jobId"); return null; } if (active) { try { FSDataInputStream dataIn = getJobInfoFile(jobId); if (dataIn != null) { ...
java
public JobStatus readJobStatus(JobID jobId) { JobStatus jobStatus = null; if (null == jobId) { LOG.warn("Could not read job status for null jobId"); return null; } if (active) { try { FSDataInputStream dataIn = getJobInfoFile(jobId); if (dataIn != null) { ...
[ "public", "JobStatus", "readJobStatus", "(", "JobID", "jobId", ")", "{", "JobStatus", "jobStatus", "=", "null", ";", "if", "(", "null", "==", "jobId", ")", "{", "LOG", ".", "warn", "(", "\"Could not read job status for null jobId\"", ")", ";", "return", "null"...
This method retrieves JobStatus information from DFS stored using store method. @param jobId the jobId for which jobStatus is queried @return JobStatus object, null if not able to retrieve
[ "This", "method", "retrieves", "JobStatus", "information", "from", "DFS", "stored", "using", "store", "method", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java#L226-L246
117,855
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java
CompletedJobStatusStore.readJobProfile
public JobProfile readJobProfile(JobID jobId) { JobProfile jobProfile = null; if (active) { try { FSDataInputStream dataIn = getJobInfoFile(jobId); if (dataIn != null) { readJobStatus(dataIn); jobProfile = readJobProfile(dataIn); dataIn.close(); } ...
java
public JobProfile readJobProfile(JobID jobId) { JobProfile jobProfile = null; if (active) { try { FSDataInputStream dataIn = getJobInfoFile(jobId); if (dataIn != null) { readJobStatus(dataIn); jobProfile = readJobProfile(dataIn); dataIn.close(); } ...
[ "public", "JobProfile", "readJobProfile", "(", "JobID", "jobId", ")", "{", "JobProfile", "jobProfile", "=", "null", ";", "if", "(", "active", ")", "{", "try", "{", "FSDataInputStream", "dataIn", "=", "getJobInfoFile", "(", "jobId", ")", ";", "if", "(", "da...
This method retrieves JobProfile information from DFS stored using store method. @param jobId the jobId for which jobProfile is queried @return JobProfile object, null if not able to retrieve
[ "This", "method", "retrieves", "JobProfile", "information", "from", "DFS", "stored", "using", "store", "method", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java#L255-L270
117,856
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java
CompletedJobStatusStore.readCounters
public Counters readCounters(JobID jobId) { Counters counters = null; if (active) { try { FSDataInputStream dataIn = getJobInfoFile(jobId); if (dataIn != null) { readJobStatus(dataIn); readJobProfile(dataIn); counters = readCounters(dataIn); dataIn.c...
java
public Counters readCounters(JobID jobId) { Counters counters = null; if (active) { try { FSDataInputStream dataIn = getJobInfoFile(jobId); if (dataIn != null) { readJobStatus(dataIn); readJobProfile(dataIn); counters = readCounters(dataIn); dataIn.c...
[ "public", "Counters", "readCounters", "(", "JobID", "jobId", ")", "{", "Counters", "counters", "=", "null", ";", "if", "(", "active", ")", "{", "try", "{", "FSDataInputStream", "dataIn", "=", "getJobInfoFile", "(", "jobId", ")", ";", "if", "(", "dataIn", ...
This method retrieves Counters information from DFS stored using store method. @param jobId the jobId for which Counters is queried @return Counters object, null if not able to retrieve
[ "This", "method", "retrieves", "Counters", "information", "from", "DFS", "stored", "using", "store", "method", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java#L279-L295
117,857
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java
CompletedJobStatusStore.readJobTaskCompletionEvents
public TaskCompletionEvent[] readJobTaskCompletionEvents(JobID jobId, int fromEventId, int maxEvents) { TaskCompletionEvent[] events = TaskCompletionEvent.EMPTY_ARRAY; if (active) { ...
java
public TaskCompletionEvent[] readJobTaskCompletionEvents(JobID jobId, int fromEventId, int maxEvents) { TaskCompletionEvent[] events = TaskCompletionEvent.EMPTY_ARRAY; if (active) { ...
[ "public", "TaskCompletionEvent", "[", "]", "readJobTaskCompletionEvents", "(", "JobID", "jobId", ",", "int", "fromEventId", ",", "int", "maxEvents", ")", "{", "TaskCompletionEvent", "[", "]", "events", "=", "TaskCompletionEvent", ".", "EMPTY_ARRAY", ";", "if", "("...
This method retrieves TaskCompletionEvents information from DFS stored using store method. @param jobId the jobId for which TaskCompletionEvents is queried @param fromEventId events offset @param maxEvents max number of events @return TaskCompletionEvent[], empty array if not able to retrieve
[ "This", "method", "retrieves", "TaskCompletionEvents", "information", "from", "DFS", "stored", "using", "store", "method", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java#L306-L325
117,858
facebookarchive/hadoop-20
src/core/org/apache/hadoop/util/UTF8ByteArrayUtils.java
UTF8ByteArrayUtils.findBytes
public static int findBytes(byte [] utf, int start, int end, byte[] b) { int matchEnd = end - b.length; for(int i=start; i<=matchEnd; i++) { boolean matched = true; for(int j=0; j<b.length; j++) { if (utf[i+j] != b[j]) { matched = false; break; } } if ...
java
public static int findBytes(byte [] utf, int start, int end, byte[] b) { int matchEnd = end - b.length; for(int i=start; i<=matchEnd; i++) { boolean matched = true; for(int j=0; j<b.length; j++) { if (utf[i+j] != b[j]) { matched = false; break; } } if ...
[ "public", "static", "int", "findBytes", "(", "byte", "[", "]", "utf", ",", "int", "start", ",", "int", "end", ",", "byte", "[", "]", "b", ")", "{", "int", "matchEnd", "=", "end", "-", "b", ".", "length", ";", "for", "(", "int", "i", "=", "start...
Find the first occurrence of the given bytes b in a UTF-8 encoded string @param utf a byte array containing a UTF-8 encoded string @param start starting offset @param end ending position @param b the bytes to find @return position that first byte occures otherwise -1
[ "Find", "the", "first", "occurrence", "of", "the", "given", "bytes", "b", "in", "a", "UTF", "-", "8", "encoded", "string" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/UTF8ByteArrayUtils.java#L47-L62
117,859
facebookarchive/hadoop-20
src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java
HadoopJob.getStatus
public String getStatus() { StringBuffer s = new StringBuffer(); s.append("Maps : " + completedMaps + "/" + totalMaps); s.append(" (" + mapProgress + ")"); s.append(" Reduces : " + completedReduces + "/" + totalReduces); s.append(" (" + reduceProgress + ")"); return s.toString(); }
java
public String getStatus() { StringBuffer s = new StringBuffer(); s.append("Maps : " + completedMaps + "/" + totalMaps); s.append(" (" + mapProgress + ")"); s.append(" Reduces : " + completedReduces + "/" + totalReduces); s.append(" (" + reduceProgress + ")"); return s.toString(); }
[ "public", "String", "getStatus", "(", ")", "{", "StringBuffer", "s", "=", "new", "StringBuffer", "(", ")", ";", "s", ".", "append", "(", "\"Maps : \"", "+", "completedMaps", "+", "\"/\"", "+", "totalMaps", ")", ";", "s", ".", "append", "(", "\" (\"", "...
Returns a string representation of this job status @return string representation of this job status
[ "Returns", "a", "string", "representation", "of", "this", "job", "status" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java#L261-L271
117,860
facebookarchive/hadoop-20
src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java
HadoopJob.update
void update(JobStatus status) { this.status = status; try { this.counters = running.getCounters(); this.completed = running.isComplete(); this.successful = running.isSuccessful(); this.mapProgress = running.mapProgress(); this.reduceProgress = running.reduceProgress(); // run...
java
void update(JobStatus status) { this.status = status; try { this.counters = running.getCounters(); this.completed = running.isComplete(); this.successful = running.isSuccessful(); this.mapProgress = running.mapProgress(); this.reduceProgress = running.reduceProgress(); // run...
[ "void", "update", "(", "JobStatus", "status", ")", "{", "this", ".", "status", "=", "status", ";", "try", "{", "this", ".", "counters", "=", "running", ".", "getCounters", "(", ")", ";", "this", ".", "completed", "=", "running", ".", "isComplete", "(",...
Update this job status according to the given JobStatus @param status
[ "Update", "this", "job", "status", "according", "to", "the", "given", "JobStatus" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java#L278-L294
117,861
facebookarchive/hadoop-20
src/core/org/apache/hadoop/util/FlushableLogger.java
FlushableLogger.setFlush
private synchronized void setFlush(boolean immediateFlush) { try { Set<FileAppender> flushedFileAppenders = new HashSet<FileAppender>(); Enumeration<?> currentLoggers = LogManager.getLoggerRepository() .getCurrentLoggers(); while (currentLoggers.hasMoreElements()) { Object nextLo...
java
private synchronized void setFlush(boolean immediateFlush) { try { Set<FileAppender> flushedFileAppenders = new HashSet<FileAppender>(); Enumeration<?> currentLoggers = LogManager.getLoggerRepository() .getCurrentLoggers(); while (currentLoggers.hasMoreElements()) { Object nextLo...
[ "private", "synchronized", "void", "setFlush", "(", "boolean", "immediateFlush", ")", "{", "try", "{", "Set", "<", "FileAppender", ">", "flushedFileAppenders", "=", "new", "HashSet", "<", "FileAppender", ">", "(", ")", ";", "Enumeration", "<", "?", ">", "cur...
Set immediateFlush property for all file appenders.
[ "Set", "immediateFlush", "property", "for", "all", "file", "appenders", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/FlushableLogger.java#L67-L94
117,862
facebookarchive/hadoop-20
src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/PersistentState.java
PersistentState.readState
public static void readState(String fname) { filename = fname; try { persData.load(new FileInputStream(filename)); } catch (FileNotFoundException e1) { // ignore } catch (IOException e) { e.printStackTrace(); } }
java
public static void readState(String fname) { filename = fname; try { persData.load(new FileInputStream(filename)); } catch (FileNotFoundException e1) { // ignore } catch (IOException e) { e.printStackTrace(); } }
[ "public", "static", "void", "readState", "(", "String", "fname", ")", "{", "filename", "=", "fname", ";", "try", "{", "persData", ".", "load", "(", "new", "FileInputStream", "(", "filename", ")", ")", ";", "}", "catch", "(", "FileNotFoundException", "e1", ...
Read the state of parsing for all open log files from a property file. @param fname the filename of the property file to be read
[ "Read", "the", "state", "of", "parsing", "for", "all", "open", "log", "files", "from", "a", "property", "file", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/PersistentState.java#L58-L69
117,863
facebookarchive/hadoop-20
src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/PersistentState.java
PersistentState.getState
public static ParseState getState(String fname) { String [] fields = persData.getProperty(fname, "null" + SEPARATOR + "0").split(SEPARATOR, 2); String firstLine; long offset; if (fields.length < 2) { System.err.println("Malformed persistent state data found"); Environment.logInfo("Malfo...
java
public static ParseState getState(String fname) { String [] fields = persData.getProperty(fname, "null" + SEPARATOR + "0").split(SEPARATOR, 2); String firstLine; long offset; if (fields.length < 2) { System.err.println("Malformed persistent state data found"); Environment.logInfo("Malfo...
[ "public", "static", "ParseState", "getState", "(", "String", "fname", ")", "{", "String", "[", "]", "fields", "=", "persData", ".", "getProperty", "(", "fname", ",", "\"null\"", "+", "SEPARATOR", "+", "\"0\"", ")", ".", "split", "(", "SEPARATOR", ",", "2...
Read and return the state of parsing for a particular log file. @param fname the log file for which to read the state
[ "Read", "and", "return", "the", "state", "of", "parsing", "for", "a", "particular", "log", "file", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/PersistentState.java#L76-L92
117,864
facebookarchive/hadoop-20
src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/PersistentState.java
PersistentState.setState
public static void setState(ParseState state) { if (state == null) { System.err.println("Null state found"); Environment.logInfo("Null state found"); } persData.setProperty(state.filename, state.firstLine + SEPARATOR + state.offset); }
java
public static void setState(ParseState state) { if (state == null) { System.err.println("Null state found"); Environment.logInfo("Null state found"); } persData.setProperty(state.filename, state.firstLine + SEPARATOR + state.offset); }
[ "public", "static", "void", "setState", "(", "ParseState", "state", ")", "{", "if", "(", "state", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"Null state found\"", ")", ";", "Environment", ".", "logInfo", "(", "\"Null state found\"",...
Set the state of parsing for a particular log file. @param state the ParseState to set
[ "Set", "the", "state", "of", "parsing", "for", "a", "particular", "log", "file", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/PersistentState.java#L99-L107
117,865
facebookarchive/hadoop-20
src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/PersistentState.java
PersistentState.updateState
public static void updateState(String filename, String firstLine, long offset) { ParseState ps = getState(filename); if (firstLine != null) ps.firstLine = firstLine; ps.offset = offset; setState(ps); }
java
public static void updateState(String filename, String firstLine, long offset) { ParseState ps = getState(filename); if (firstLine != null) ps.firstLine = firstLine; ps.offset = offset; setState(ps); }
[ "public", "static", "void", "updateState", "(", "String", "filename", ",", "String", "firstLine", ",", "long", "offset", ")", "{", "ParseState", "ps", "=", "getState", "(", "filename", ")", ";", "if", "(", "firstLine", "!=", "null", ")", "ps", ".", "firs...
Upadate the state of parsing for a particular log file. @param filename the log file for which to update the state @param firstLine the first line of the log file currently @param offset the byte offset of the last character parsed
[ "Upadate", "the", "state", "of", "parsing", "for", "a", "particular", "log", "file", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/PersistentState.java#L116-L126
117,866
facebookarchive/hadoop-20
src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/PersistentState.java
PersistentState.writeState
public static void writeState(String fname) { try { persData.store(new FileOutputStream(fname), Calendar.getInstance().getTime().toString()); } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
java
public static void writeState(String fname) { try { persData.store(new FileOutputStream(fname), Calendar.getInstance().getTime().toString()); } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
[ "public", "static", "void", "writeState", "(", "String", "fname", ")", "{", "try", "{", "persData", ".", "store", "(", "new", "FileOutputStream", "(", "fname", ")", ",", "Calendar", ".", "getInstance", "(", ")", ".", "getTime", "(", ")", ".", "toString",...
Write the state of parsing for all open log files to a property file on disk. @param fname the filename of the property file to write to
[ "Write", "the", "state", "of", "parsing", "for", "all", "open", "log", "files", "to", "a", "property", "file", "on", "disk", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/PersistentState.java#L134-L142
117,867
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/lib/db/DBInputFormat.java
DBInputFormat.getCountQuery
protected String getCountQuery() { if(dbConf.getInputCountQuery() != null) { return dbConf.getInputCountQuery(); } StringBuilder query = new StringBuilder(); query.append("SELECT COUNT(*) FROM " + tableName); if (conditions != null && conditions.length() > 0) query.append(" WH...
java
protected String getCountQuery() { if(dbConf.getInputCountQuery() != null) { return dbConf.getInputCountQuery(); } StringBuilder query = new StringBuilder(); query.append("SELECT COUNT(*) FROM " + tableName); if (conditions != null && conditions.length() > 0) query.append(" WH...
[ "protected", "String", "getCountQuery", "(", ")", "{", "if", "(", "dbConf", ".", "getInputCountQuery", "(", ")", "!=", "null", ")", "{", "return", "dbConf", ".", "getInputCountQuery", "(", ")", ";", "}", "StringBuilder", "query", "=", "new", "StringBuilder",...
Returns the query for getting the total number of rows, subclasses can override this for custom behaviour.
[ "Returns", "the", "query", "for", "getting", "the", "total", "number", "of", "rows", "subclasses", "can", "override", "this", "for", "custom", "behaviour", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/db/DBInputFormat.java#L332-L344
117,868
facebookarchive/hadoop-20
src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java
DFSPath.delete
public void delete() { try { getDFS().delete(this.path, true); } catch (IOException e) { e.printStackTrace(); MessageDialog.openWarning(null, "Delete file", "Unable to delete file \"" + this.path + "\"\n" + e); } }
java
public void delete() { try { getDFS().delete(this.path, true); } catch (IOException e) { e.printStackTrace(); MessageDialog.openWarning(null, "Delete file", "Unable to delete file \"" + this.path + "\"\n" + e); } }
[ "public", "void", "delete", "(", ")", "{", "try", "{", "getDFS", "(", ")", ".", "delete", "(", "this", ".", "path", ",", "true", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "MessageDialog",...
Does a recursive delete of the remote directory tree at this node.
[ "Does", "a", "recursive", "delete", "of", "the", "remote", "directory", "tree", "at", "this", "node", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java#L102-L111
117,869
facebookarchive/hadoop-20
src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java
DFSPath.getDFS
DistributedFileSystem getDFS() throws IOException { if (this.dfs == null) { FileSystem fs = location.getDFS(); if (!(fs instanceof DistributedFileSystem)) { ErrorMessageDialog.display("DFS Browser", "The DFS Browser cannot browse anything else " + "but a Distributed F...
java
DistributedFileSystem getDFS() throws IOException { if (this.dfs == null) { FileSystem fs = location.getDFS(); if (!(fs instanceof DistributedFileSystem)) { ErrorMessageDialog.display("DFS Browser", "The DFS Browser cannot browse anything else " + "but a Distributed F...
[ "DistributedFileSystem", "getDFS", "(", ")", "throws", "IOException", "{", "if", "(", "this", ".", "dfs", "==", "null", ")", "{", "FileSystem", "fs", "=", "location", ".", "getDFS", "(", ")", ";", "if", "(", "!", "(", "fs", "instanceof", "DistributedFile...
Gets a connection to the DFS @return a connection to the DFS @throws IOException
[ "Gets", "a", "connection", "to", "the", "DFS" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java#L144-L156
117,870
facebookarchive/hadoop-20
src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/CapBasedLoadManager.java
CapBasedLoadManager.getCap
int getCap(int totalRunnableTasks, int localMaxTasks, int totalSlots) { double load = maxDiff + ((double)totalRunnableTasks) / totalSlots; int cap = (int) Math.min(localMaxTasks, Math.ceil(load * localMaxTasks)); if (LOG.isDebugEnabled()) { LOG.debug("load:" + load + " maxDiff:" + maxDiff + ...
java
int getCap(int totalRunnableTasks, int localMaxTasks, int totalSlots) { double load = maxDiff + ((double)totalRunnableTasks) / totalSlots; int cap = (int) Math.min(localMaxTasks, Math.ceil(load * localMaxTasks)); if (LOG.isDebugEnabled()) { LOG.debug("load:" + load + " maxDiff:" + maxDiff + ...
[ "int", "getCap", "(", "int", "totalRunnableTasks", ",", "int", "localMaxTasks", ",", "int", "totalSlots", ")", "{", "double", "load", "=", "maxDiff", "+", "(", "(", "double", ")", "totalRunnableTasks", ")", "/", "totalSlots", ";", "int", "cap", "=", "(", ...
Determine how many tasks of a given type we want to run on a TaskTracker. This cap is chosen based on how many tasks of that type are outstanding in total, so that when the cluster is used below capacity, tasks are spread out uniformly across the nodes rather than being clumped up on whichever machines sent out heartbe...
[ "Determine", "how", "many", "tasks", "of", "a", "given", "type", "we", "want", "to", "run", "on", "a", "TaskTracker", ".", "This", "cap", "is", "chosen", "based", "on", "how", "many", "tasks", "of", "that", "type", "are", "outstanding", "in", "total", ...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/CapBasedLoadManager.java#L96-L106
117,871
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java
ServerLogReaderTransactional.tryReloadingEditLog
private void tryReloadingEditLog() throws IOException { LOG.info("Segment - trying to reload edit log segment"); // sleep on error sleep(errorSleepTimeout); // check if a new segment exists checkProgress(); // reopen current segment setupIngestStreamWithRetries(currentSegmentTxId); //...
java
private void tryReloadingEditLog() throws IOException { LOG.info("Segment - trying to reload edit log segment"); // sleep on error sleep(errorSleepTimeout); // check if a new segment exists checkProgress(); // reopen current segment setupIngestStreamWithRetries(currentSegmentTxId); //...
[ "private", "void", "tryReloadingEditLog", "(", ")", "throws", "IOException", "{", "LOG", ".", "info", "(", "\"Segment - trying to reload edit log segment\"", ")", ";", "// sleep on error", "sleep", "(", "errorSleepTimeout", ")", ";", "// check if a new segment exists", "c...
On error when reading transactions from the stream, try reloading the input stream.
[ "On", "error", "when", "reading", "transactions", "from", "the", "stream", "try", "reloading", "the", "input", "stream", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java#L197-L210
117,872
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java
ServerLogReaderTransactional.updateState
private void updateState(FSEditLogOp op, boolean checkTxnId) throws IOException { InjectionHandler.processEvent(InjectionEvent.SERVERLOGREADER_UPDATE, op); if (checkTxnId) { mostRecentlyReadTransactionTxId = ServerLogReaderUtil.checkTransactionId( mostRecentlyReadTransactionTxId, op); } ...
java
private void updateState(FSEditLogOp op, boolean checkTxnId) throws IOException { InjectionHandler.processEvent(InjectionEvent.SERVERLOGREADER_UPDATE, op); if (checkTxnId) { mostRecentlyReadTransactionTxId = ServerLogReaderUtil.checkTransactionId( mostRecentlyReadTransactionTxId, op); } ...
[ "private", "void", "updateState", "(", "FSEditLogOp", "op", ",", "boolean", "checkTxnId", ")", "throws", "IOException", "{", "InjectionHandler", ".", "processEvent", "(", "InjectionEvent", ".", "SERVERLOGREADER_UPDATE", ",", "op", ")", ";", "if", "(", "checkTxnId"...
For each operation read from the stream, check if this is a closing transaction. If so, we are sure we need to move to the next segment. We also mark that this is the most recent time, we read something valid from the input.
[ "For", "each", "operation", "read", "from", "the", "stream", "check", "if", "this", "is", "a", "closing", "transaction", ".", "If", "so", "we", "are", "sure", "we", "need", "to", "move", "to", "the", "next", "segment", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java#L253-L282
117,873
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java
ServerLogReaderTransactional.refreshStreamPosition
private void refreshStreamPosition() throws IOException { if (currentEditLogInputStreamPosition != -1) { // stream was reopened currentEditLogInputStream.refresh(currentEditLogInputStreamPosition, mostRecentlyReadTransactionTxId); } else { // freshly opened stream currentEditLo...
java
private void refreshStreamPosition() throws IOException { if (currentEditLogInputStreamPosition != -1) { // stream was reopened currentEditLogInputStream.refresh(currentEditLogInputStreamPosition, mostRecentlyReadTransactionTxId); } else { // freshly opened stream currentEditLo...
[ "private", "void", "refreshStreamPosition", "(", ")", "throws", "IOException", "{", "if", "(", "currentEditLogInputStreamPosition", "!=", "-", "1", ")", "{", "// stream was reopened", "currentEditLogInputStream", ".", "refresh", "(", "currentEditLogInputStreamPosition", "...
Called to refresh the position in the current input stream to the last ACK'd one. @throws IOException if a fatal error occurred.
[ "Called", "to", "refresh", "the", "position", "in", "the", "current", "input", "stream", "to", "the", "last", "ACK", "d", "one", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java#L291-L300
117,874
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java
ServerLogReaderTransactional.refreshInputStream
private void refreshInputStream() throws IOException { // if stream is null, we probably switched to a new // segment. if (currentEditLogInputStream == null) { LOG.info("Segment - setup input stream for txid: " + currentSegmentTxId); setupIngestStreamWithRetries(currentSegmentTxId); if (cu...
java
private void refreshInputStream() throws IOException { // if stream is null, we probably switched to a new // segment. if (currentEditLogInputStream == null) { LOG.info("Segment - setup input stream for txid: " + currentSegmentTxId); setupIngestStreamWithRetries(currentSegmentTxId); if (cu...
[ "private", "void", "refreshInputStream", "(", ")", "throws", "IOException", "{", "// if stream is null, we probably switched to a new", "// segment.", "if", "(", "currentEditLogInputStream", "==", "null", ")", "{", "LOG", ".", "info", "(", "\"Segment - setup input stream fo...
On normal activity, when we reach END_LOG_SEGMENT, we will null the stream and at next read we want to instantiate a stream for next segment. This function repositions the stream to the last correct known position as well.
[ "On", "normal", "activity", "when", "we", "reach", "END_LOG_SEGMENT", "we", "will", "null", "the", "stream", "and", "at", "next", "read", "we", "want", "to", "instantiate", "a", "stream", "for", "next", "segment", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java#L326-L344
117,875
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java
ServerLogReaderTransactional.initialize
protected void initialize() throws IOException { for (int i = 0; i < 3; i++) { try { LOG.info("Detecting current primary node - attempt " + i); detectJournalManager(); LOG.info("Finding oldest segment txid - attempt " + i); currentSegmentTxId = findOldestLogSegmentTxid...
java
protected void initialize() throws IOException { for (int i = 0; i < 3; i++) { try { LOG.info("Detecting current primary node - attempt " + i); detectJournalManager(); LOG.info("Finding oldest segment txid - attempt " + i); currentSegmentTxId = findOldestLogSegmentTxid...
[ "protected", "void", "initialize", "(", ")", "throws", "IOException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", "{", "try", "{", "LOG", ".", "info", "(", "\"Detecting current primary node - attempt \"", "+", "i", "...
Initialize first stream. Just for startup, we are extra careful to try 3 times, as there is potential race between finding the txid and then setting up the stream.
[ "Initialize", "first", "stream", ".", "Just", "for", "startup", "we", "are", "extra", "careful", "to", "try", "3", "times", "as", "there", "is", "potential", "race", "between", "finding", "the", "txid", "and", "then", "setting", "up", "the", "stream", "." ...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java#L351-L372
117,876
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java
ServerLogReaderTransactional.setupIngestStreamWithRetries
private void setupIngestStreamWithRetries(long txid) throws IOException { for (int i = 0; i < inputStreamRetries; i++) { try { setupCurrentEditStream(txid); return; } catch (IOException e) { if (i == inputStreamRetries - 1) { throw new IOException("Cannot obtain stream ...
java
private void setupIngestStreamWithRetries(long txid) throws IOException { for (int i = 0; i < inputStreamRetries; i++) { try { setupCurrentEditStream(txid); return; } catch (IOException e) { if (i == inputStreamRetries - 1) { throw new IOException("Cannot obtain stream ...
[ "private", "void", "setupIngestStreamWithRetries", "(", "long", "txid", ")", "throws", "IOException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "inputStreamRetries", ";", "i", "++", ")", "{", "try", "{", "setupCurrentEditStream", "(", "txid", "...
Setup the input stream to be consumed by the reader, with retries on failures.
[ "Setup", "the", "input", "stream", "to", "be", "consumed", "by", "the", "reader", "with", "retries", "on", "failures", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java#L378-L393
117,877
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java
ServerLogReaderTransactional.setupCurrentEditStream
private void setupCurrentEditStream(long txid) throws IOException { // get new stream currentEditLogInputStream = JournalSet.getInputStream(remoteJournalManager, txid); // we just started a new log segment currentSegmentTxId = txid; // indicate that we successfully reopened the stream mo...
java
private void setupCurrentEditStream(long txid) throws IOException { // get new stream currentEditLogInputStream = JournalSet.getInputStream(remoteJournalManager, txid); // we just started a new log segment currentSegmentTxId = txid; // indicate that we successfully reopened the stream mo...
[ "private", "void", "setupCurrentEditStream", "(", "long", "txid", ")", "throws", "IOException", "{", "// get new stream", "currentEditLogInputStream", "=", "JournalSet", ".", "getInputStream", "(", "remoteJournalManager", ",", "txid", ")", ";", "// we just started a new l...
Setup the input stream to be consumed by the reader. The input stream corresponds to a single segment.
[ "Setup", "the", "input", "stream", "to", "be", "consumed", "by", "the", "reader", ".", "The", "input", "stream", "corresponds", "to", "a", "single", "segment", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java#L399-L407
117,878
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java
ServerLogReaderTransactional.segmentExists
boolean segmentExists(long txid) throws IOException { List<RemoteEditLog> segments = getManifest(); for (RemoteEditLog segment : segments) { if (segment.getStartTxId() == txid) { return true; } } return false; }
java
boolean segmentExists(long txid) throws IOException { List<RemoteEditLog> segments = getManifest(); for (RemoteEditLog segment : segments) { if (segment.getStartTxId() == txid) { return true; } } return false; }
[ "boolean", "segmentExists", "(", "long", "txid", ")", "throws", "IOException", "{", "List", "<", "RemoteEditLog", ">", "segments", "=", "getManifest", "(", ")", ";", "for", "(", "RemoteEditLog", "segment", ":", "segments", ")", "{", "if", "(", "segment", "...
Check if a segment of a given txid exists in the underlying storage directory. Whne the reader cannot read any new data, it will periodically check if there was some unclean shutdown, which results in an unfinalized log.
[ "Check", "if", "a", "segment", "of", "a", "given", "txid", "exists", "in", "the", "underlying", "storage", "directory", ".", "Whne", "the", "reader", "cannot", "read", "any", "new", "data", "it", "will", "periodically", "check", "if", "there", "was", "some...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java#L415-L423
117,879
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java
ServerLogReaderTransactional.getManifest
List<RemoteEditLog> getManifest() throws IOException { RemoteEditLogManifest rm = remoteJournalManager.getEditLogManifest(-1); if (rm == null || rm.getLogs().size() == 0) { throw new IOException("Cannot obtain the list of log segments"); } return rm.getLogs(); }
java
List<RemoteEditLog> getManifest() throws IOException { RemoteEditLogManifest rm = remoteJournalManager.getEditLogManifest(-1); if (rm == null || rm.getLogs().size() == 0) { throw new IOException("Cannot obtain the list of log segments"); } return rm.getLogs(); }
[ "List", "<", "RemoteEditLog", ">", "getManifest", "(", ")", "throws", "IOException", "{", "RemoteEditLogManifest", "rm", "=", "remoteJournalManager", ".", "getEditLogManifest", "(", "-", "1", ")", ";", "if", "(", "rm", "==", "null", "||", "rm", ".", "getLogs...
Get all available log segments present in the underlying storage directory. This function will never return null, or empty list of segments - it will throw exception in this case.
[ "Get", "all", "available", "log", "segments", "present", "in", "the", "underlying", "storage", "directory", ".", "This", "function", "will", "never", "return", "null", "or", "empty", "list", "of", "segments", "-", "it", "will", "throw", "exception", "in", "t...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java#L444-L450
117,880
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java
ServerLogReaderTransactional.sleep
protected void sleep(long ms) throws IOException { try { Thread.sleep(ms); } catch (InterruptedException e) { LOG.error("Interrupted when sleeping", e); Thread.currentThread().interrupt(); throw new IOException("Received interruption"); } }
java
protected void sleep(long ms) throws IOException { try { Thread.sleep(ms); } catch (InterruptedException e) { LOG.error("Interrupted when sleeping", e); Thread.currentThread().interrupt(); throw new IOException("Received interruption"); } }
[ "protected", "void", "sleep", "(", "long", "ms", ")", "throws", "IOException", "{", "try", "{", "Thread", ".", "sleep", "(", "ms", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "LOG", ".", "error", "(", "\"Interrupted when sleeping\""...
Sleep for n milliseconds. Throw IOException when interrupted. @param ms @throws IOException
[ "Sleep", "for", "n", "milliseconds", ".", "Throw", "IOException", "when", "interrupted", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java#L458-L466
117,881
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/SequenceFile.java
SequenceFile.getCompressionType
@Deprecated static public CompressionType getCompressionType(Configuration job) { String name = job.get("io.seqfile.compression.type"); return name == null ? CompressionType.RECORD : CompressionType.valueOf(name); }
java
@Deprecated static public CompressionType getCompressionType(Configuration job) { String name = job.get("io.seqfile.compression.type"); return name == null ? CompressionType.RECORD : CompressionType.valueOf(name); }
[ "@", "Deprecated", "static", "public", "CompressionType", "getCompressionType", "(", "Configuration", "job", ")", "{", "String", "name", "=", "job", ".", "get", "(", "\"io.seqfile.compression.type\"", ")", ";", "return", "name", "==", "null", "?", "CompressionType...
Get the compression type for the reduce outputs @param job the job config to look in @return the kind of compression to use @deprecated Use {@link org.apache.hadoop.mapred.SequenceFileOutputFormat#getOutputCompressionType(org.apache.hadoop.mapred.JobConf)} to get {@link CompressionType} for job-outputs.
[ "Get", "the", "compression", "type", "for", "the", "reduce", "outputs" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/SequenceFile.java#L230-L235
117,882
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/SequenceFile.java
SequenceFile.setCompressionType
@Deprecated static public void setCompressionType(Configuration job, CompressionType val) { job.set("io.seqfile.compression.type", val.toString()); }
java
@Deprecated static public void setCompressionType(Configuration job, CompressionType val) { job.set("io.seqfile.compression.type", val.toString()); }
[ "@", "Deprecated", "static", "public", "void", "setCompressionType", "(", "Configuration", "job", ",", "CompressionType", "val", ")", "{", "job", ".", "set", "(", "\"io.seqfile.compression.type\"", ",", "val", ".", "toString", "(", ")", ")", ";", "}" ]
Set the compression type for sequence files. @param job the configuration to modify @param val the new compression type (none, block, record) @deprecated Use the one of the many SequenceFile.createWriter methods to specify the {@link CompressionType} while creating the {@link SequenceFile} or {@link org.apache.hadoop.m...
[ "Set", "the", "compression", "type", "for", "sequence", "files", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/SequenceFile.java#L247-L251
117,883
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameCache.java
NameCache.put
K put(final K name) { K internal = cache.get(name); if (internal != null) { lookups++; return internal; } // Track the usage count only during initialization if (!initialized) { UseCount useCount = transientMap.get(name); if (useCount != null) { useCount.increment();...
java
K put(final K name) { K internal = cache.get(name); if (internal != null) { lookups++; return internal; } // Track the usage count only during initialization if (!initialized) { UseCount useCount = transientMap.get(name); if (useCount != null) { useCount.increment();...
[ "K", "put", "(", "final", "K", "name", ")", "{", "K", "internal", "=", "cache", ".", "get", "(", "name", ")", ";", "if", "(", "internal", "!=", "null", ")", "{", "lookups", "++", ";", "return", "internal", ";", "}", "// Track the usage count only durin...
Add a given name to the cache or track use count. exist. If the name already exists, then the internal value is returned. @param name name to be looked up @return internal value for the name if found; otherwise null
[ "Add", "a", "given", "name", "to", "the", "cache", "or", "track", "use", "count", ".", "exist", ".", "If", "the", "name", "already", "exists", "then", "the", "internal", "value", "is", "returned", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameCache.java#L98-L119
117,884
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameCache.java
NameCache.initialized
void initialized() { LOG.info("initialized with " + size() + " entries " + lookups + " lookups"); this.initialized = true; transientMap.clear(); transientMap = null; }
java
void initialized() { LOG.info("initialized with " + size() + " entries " + lookups + " lookups"); this.initialized = true; transientMap.clear(); transientMap = null; }
[ "void", "initialized", "(", ")", "{", "LOG", ".", "info", "(", "\"initialized with \"", "+", "size", "(", ")", "+", "\" entries \"", "+", "lookups", "+", "\" lookups\"", ")", ";", "this", ".", "initialized", "=", "true", ";", "transientMap", ".", "clear", ...
Mark the name cache as initialized. The use count is no longer tracked and the transient map used for initializing the cache is discarded to save heap space.
[ "Mark", "the", "name", "cache", "as", "initialized", ".", "The", "use", "count", "is", "no", "longer", "tracked", "and", "the", "transient", "map", "used", "for", "initializing", "the", "cache", "is", "discarded", "to", "save", "heap", "space", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameCache.java#L142-L147
117,885
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameCache.java
NameCache.promote
private void promote(final K name) { transientMap.remove(name); cache.put(name, name); lookups += useThreshold; }
java
private void promote(final K name) { transientMap.remove(name); cache.put(name, name); lookups += useThreshold; }
[ "private", "void", "promote", "(", "final", "K", "name", ")", "{", "transientMap", ".", "remove", "(", "name", ")", ";", "cache", ".", "put", "(", "name", ",", "name", ")", ";", "lookups", "+=", "useThreshold", ";", "}" ]
Promote a frequently used name to the cache
[ "Promote", "a", "frequently", "used", "name", "to", "the", "cache" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameCache.java#L150-L154
117,886
facebookarchive/hadoop-20
src/core/org/apache/hadoop/util/PriorityQueue.java
PriorityQueue.initialize
@SuppressWarnings("unchecked") protected final void initialize(int maxSize) { size = 0; int heapSize = maxSize + 1; heap = (T[]) new Object[heapSize]; this.maxSize = maxSize; }
java
@SuppressWarnings("unchecked") protected final void initialize(int maxSize) { size = 0; int heapSize = maxSize + 1; heap = (T[]) new Object[heapSize]; this.maxSize = maxSize; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "final", "void", "initialize", "(", "int", "maxSize", ")", "{", "size", "=", "0", ";", "int", "heapSize", "=", "maxSize", "+", "1", ";", "heap", "=", "(", "T", "[", "]", ")", "new", "Ob...
Subclass constructors must call this.
[ "Subclass", "constructors", "must", "call", "this", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/PriorityQueue.java#L36-L42
117,887
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/protocol/RemoteEditLogManifest.java
RemoteEditLogManifest.checkState
private void checkState() { Preconditions.checkNotNull(logs); if (!contiguous) return; RemoteEditLog prev = null; for (RemoteEditLog log : logs) { if (prev != null) { if (log.getStartTxId() <= prev.getEndTxId()) { throw new IllegalStateException("Invalid log manifest:" + t...
java
private void checkState() { Preconditions.checkNotNull(logs); if (!contiguous) return; RemoteEditLog prev = null; for (RemoteEditLog log : logs) { if (prev != null) { if (log.getStartTxId() <= prev.getEndTxId()) { throw new IllegalStateException("Invalid log manifest:" + t...
[ "private", "void", "checkState", "(", ")", "{", "Preconditions", ".", "checkNotNull", "(", "logs", ")", ";", "if", "(", "!", "contiguous", ")", "return", ";", "RemoteEditLog", "prev", "=", "null", ";", "for", "(", "RemoteEditLog", "log", ":", "logs", ")"...
Check that the logs are contiguous and non-overlapping sequences of transactions, in sorted order @throws IllegalStateException if incorrect
[ "Check", "that", "the", "logs", "are", "contiguous", "and", "non", "-", "overlapping", "sequences", "of", "transactions", "in", "sorted", "order" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/protocol/RemoteEditLogManifest.java#L72-L86
117,888
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/ReduceTaskStatus.java
ReduceTaskStatus.getSortProcessingRate
@Override public double getSortProcessingRate(long currentTime) { long timeSpentSorting = 0; float progress = 0; Phase phase = getPhase(); long sortFinishTime = getSortFinishTime(); long shuffleFinishTime = getShuffleFinishTime(); if (phase == Phase.SHUFFLE ) { return 0; ...
java
@Override public double getSortProcessingRate(long currentTime) { long timeSpentSorting = 0; float progress = 0; Phase phase = getPhase(); long sortFinishTime = getSortFinishTime(); long shuffleFinishTime = getShuffleFinishTime(); if (phase == Phase.SHUFFLE ) { return 0; ...
[ "@", "Override", "public", "double", "getSortProcessingRate", "(", "long", "currentTime", ")", "{", "long", "timeSpentSorting", "=", "0", ";", "float", "progress", "=", "0", ";", "Phase", "phase", "=", "getPhase", "(", ")", ";", "long", "sortFinishTime", "="...
for sort phase, use the accumulated progress rate as the processing rate
[ "for", "sort", "phase", "use", "the", "accumulated", "progress", "rate", "as", "the", "processing", "rate" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/ReduceTaskStatus.java#L126-L165
117,889
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/ReduceTaskStatus.java
ReduceTaskStatus.getReduceProcessingRate
@Override public double getReduceProcessingRate(long currentTime) { Phase phase = getPhase(); if (phase != Phase.REDUCE) { return 0; } @SuppressWarnings("deprecation") long bytesProcessed = super.getCounters().findCounter (Task.Counter.REDUCE_INPUT_BYTES).getCounte...
java
@Override public double getReduceProcessingRate(long currentTime) { Phase phase = getPhase(); if (phase != Phase.REDUCE) { return 0; } @SuppressWarnings("deprecation") long bytesProcessed = super.getCounters().findCounter (Task.Counter.REDUCE_INPUT_BYTES).getCounte...
[ "@", "Override", "public", "double", "getReduceProcessingRate", "(", "long", "currentTime", ")", "{", "Phase", "phase", "=", "getPhase", "(", ")", ";", "if", "(", "phase", "!=", "Phase", ".", "REDUCE", ")", "{", "return", "0", ";", "}", "@", "SuppressWar...
as the processing rate
[ "as", "the", "processing", "rate" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/ReduceTaskStatus.java#L169-L192
117,890
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/corona/SessionManager.java
SessionManager.readSessions
private void readSessions(CoronaSerializer coronaSerializer) throws IOException { coronaSerializer.readField("sessions"); // Expecting the START_OBJECT token for sessions coronaSerializer.readStartObjectToken("sessions"); JsonToken current = coronaSerializer.nextToken(); while (current != JsonTo...
java
private void readSessions(CoronaSerializer coronaSerializer) throws IOException { coronaSerializer.readField("sessions"); // Expecting the START_OBJECT token for sessions coronaSerializer.readStartObjectToken("sessions"); JsonToken current = coronaSerializer.nextToken(); while (current != JsonTo...
[ "private", "void", "readSessions", "(", "CoronaSerializer", "coronaSerializer", ")", "throws", "IOException", "{", "coronaSerializer", ".", "readField", "(", "\"sessions\"", ")", ";", "// Expecting the START_OBJECT token for sessions", "coronaSerializer", ".", "readStartObjec...
Reads back the sessions map from a JSON stream @param coronaSerializer The CoronaSerializer instance to be used to read the JSON @throws IOException
[ "Reads", "back", "the", "sessions", "map", "from", "a", "JSON", "stream" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SessionManager.java#L141-L155
117,891
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/corona/SessionManager.java
SessionManager.restoreAfterSafeModeRestart
public void restoreAfterSafeModeRestart() { if (!clusterManager.safeMode) { return; } for (Session session : sessions.values()) { for (ResourceRequestInfo resourceRequestInfo : session.idToRequest.values()) { // The helper method to restore the ResourceRequestInfo instances ...
java
public void restoreAfterSafeModeRestart() { if (!clusterManager.safeMode) { return; } for (Session session : sessions.values()) { for (ResourceRequestInfo resourceRequestInfo : session.idToRequest.values()) { // The helper method to restore the ResourceRequestInfo instances ...
[ "public", "void", "restoreAfterSafeModeRestart", "(", ")", "{", "if", "(", "!", "clusterManager", ".", "safeMode", ")", "{", "return", ";", "}", "for", "(", "Session", "session", ":", "sessions", ".", "values", "(", ")", ")", "{", "for", "(", "ResourceRe...
This method rebuilds members related to the SessionManager instance, which were not directly persisted themselves.
[ "This", "method", "rebuilds", "members", "related", "to", "the", "SessionManager", "instance", "which", "were", "not", "directly", "persisted", "themselves", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SessionManager.java#L161-L182
117,892
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/corona/SessionManager.java
SessionManager.write
public void write(JsonGenerator jsonGenerator) throws IOException { jsonGenerator.writeStartObject(); // retiredSessions and numRetiredSessions need not be persisted // sessionCounter can be set to 0, when the SessionManager is instantiated // sessions begins jsonGenerator.writeFieldName("sessions...
java
public void write(JsonGenerator jsonGenerator) throws IOException { jsonGenerator.writeStartObject(); // retiredSessions and numRetiredSessions need not be persisted // sessionCounter can be set to 0, when the SessionManager is instantiated // sessions begins jsonGenerator.writeFieldName("sessions...
[ "public", "void", "write", "(", "JsonGenerator", "jsonGenerator", ")", "throws", "IOException", "{", "jsonGenerator", ".", "writeStartObject", "(", ")", ";", "// retiredSessions and numRetiredSessions need not be persisted", "// sessionCounter can be set to 0, when the SessionManag...
Used to write the state of the SessionManager instance to disk, when we are persisting the state of the ClusterManager @param jsonGenerator The JsonGenerator instance being used to write JSON to disk @throws IOException
[ "Used", "to", "write", "the", "state", "of", "the", "SessionManager", "instance", "to", "disk", "when", "we", "are", "persisting", "the", "state", "of", "the", "ClusterManager" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SessionManager.java#L192-L215
117,893
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/corona/SessionManager.java
SessionManager.getTypePoolInfoAveFirstWaitMs
public Map<PoolInfo, Long> getTypePoolInfoAveFirstWaitMs(ResourceType type) { Map<PoolInfo, WaitCount> poolInfoWaitCount = new HashMap<PoolInfo, WaitCount>(); for (Session session : sessions.values()) { synchronized (session) { if (!session.isDeleted()) { Long wait = session.getT...
java
public Map<PoolInfo, Long> getTypePoolInfoAveFirstWaitMs(ResourceType type) { Map<PoolInfo, WaitCount> poolInfoWaitCount = new HashMap<PoolInfo, WaitCount>(); for (Session session : sessions.values()) { synchronized (session) { if (!session.isDeleted()) { Long wait = session.getT...
[ "public", "Map", "<", "PoolInfo", ",", "Long", ">", "getTypePoolInfoAveFirstWaitMs", "(", "ResourceType", "type", ")", "{", "Map", "<", "PoolInfo", ",", "WaitCount", ">", "poolInfoWaitCount", "=", "new", "HashMap", "<", "PoolInfo", ",", "WaitCount", ">", "(", ...
Get a map of pool infos to average wait times for first resource of a resource type. @param type Resource type @return Map of pools into average first resource time
[ "Get", "a", "map", "of", "pool", "infos", "to", "average", "wait", "times", "for", "first", "resource", "of", "a", "resource", "type", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SessionManager.java#L263-L290
117,894
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/StreamFile.java
StreamFile.getDFSClient
protected DFSClient getDFSClient(HttpServletRequest request) throws IOException, InterruptedException { Configuration conf = new Configuration(masterConf); UnixUserGroupInformation.saveToConf(conf, UnixUserGroupInformation.UGI_PROPERTY_NAME, getUGI(request)); return JspHelper.getDFSClient(requ...
java
protected DFSClient getDFSClient(HttpServletRequest request) throws IOException, InterruptedException { Configuration conf = new Configuration(masterConf); UnixUserGroupInformation.saveToConf(conf, UnixUserGroupInformation.UGI_PROPERTY_NAME, getUGI(request)); return JspHelper.getDFSClient(requ...
[ "protected", "DFSClient", "getDFSClient", "(", "HttpServletRequest", "request", ")", "throws", "IOException", ",", "InterruptedException", "{", "Configuration", "conf", "=", "new", "Configuration", "(", "masterConf", ")", ";", "UnixUserGroupInformation", ".", "saveToCon...
getting a client for connecting to dfs
[ "getting", "a", "client", "for", "connecting", "to", "dfs" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/StreamFile.java#L40-L46
117,895
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/StreamFile.java
StreamFile.getDatanodes
private DatanodeID[] getDatanodes(HttpServletRequest request) throws IOException { final String datanodes = request.getParameter("candidates"); if (datanodes == null) { return null; } final String[] datanodeStrs = datanodes.split(" "); if (datanodeStrs.length == 0) { return null; }...
java
private DatanodeID[] getDatanodes(HttpServletRequest request) throws IOException { final String datanodes = request.getParameter("candidates"); if (datanodes == null) { return null; } final String[] datanodeStrs = datanodes.split(" "); if (datanodeStrs.length == 0) { return null; }...
[ "private", "DatanodeID", "[", "]", "getDatanodes", "(", "HttpServletRequest", "request", ")", "throws", "IOException", "{", "final", "String", "datanodes", "=", "request", ".", "getParameter", "(", "\"candidates\"", ")", ";", "if", "(", "datanodes", "==", "null"...
Get the datanode candidates from the request
[ "Get", "the", "datanode", "candidates", "from", "the", "request" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/StreamFile.java#L49-L78
117,896
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java
FSEditLogLoader.loadFSEdits
int loadFSEdits(EditLogInputStream edits, long lastAppliedTxId) throws IOException { long startTime = now(); this.lastAppliedTxId = lastAppliedTxId; int numEdits = loadFSEdits(edits, true); FSImage.LOG.info("Edits file " + edits.toString() + " of size: " + edits.length() + ", # of edits: " +...
java
int loadFSEdits(EditLogInputStream edits, long lastAppliedTxId) throws IOException { long startTime = now(); this.lastAppliedTxId = lastAppliedTxId; int numEdits = loadFSEdits(edits, true); FSImage.LOG.info("Edits file " + edits.toString() + " of size: " + edits.length() + ", # of edits: " +...
[ "int", "loadFSEdits", "(", "EditLogInputStream", "edits", ",", "long", "lastAppliedTxId", ")", "throws", "IOException", "{", "long", "startTime", "=", "now", "(", ")", ";", "this", ".", "lastAppliedTxId", "=", "lastAppliedTxId", ";", "int", "numEdits", "=", "l...
Load an edit log, and apply the changes to the in-memory structure This is where we apply edits that we've been writing to disk all along.
[ "Load", "an", "edit", "log", "and", "apply", "the", "changes", "to", "the", "in", "-", "memory", "structure", "This", "is", "where", "we", "apply", "edits", "that", "we", "ve", "been", "writing", "to", "disk", "all", "along", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java#L107-L116
117,897
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java
FSEditLogLoader.checkFail
private void checkFail(String errorMsg) throws IOException { if (fsNamesys.failOnTxIdMismatch()) { FSEditLog.LOG.error(errorMsg); throw new IOException(errorMsg); } MetaRecoveryContext.editLogLoaderPrompt(errorMsg); }
java
private void checkFail(String errorMsg) throws IOException { if (fsNamesys.failOnTxIdMismatch()) { FSEditLog.LOG.error(errorMsg); throw new IOException(errorMsg); } MetaRecoveryContext.editLogLoaderPrompt(errorMsg); }
[ "private", "void", "checkFail", "(", "String", "errorMsg", ")", "throws", "IOException", "{", "if", "(", "fsNamesys", ".", "failOnTxIdMismatch", "(", ")", ")", "{", "FSEditLog", ".", "LOG", ".", "error", "(", "errorMsg", ")", ";", "throw", "new", "IOExcept...
When encountering an error while loading the transaction, we can skip the problematic transaction and continue, first prompting the user. This will only be possible when NN is started with appropriate option.
[ "When", "encountering", "an", "error", "while", "loading", "the", "transaction", "we", "can", "skip", "the", "problematic", "transaction", "and", "continue", "first", "prompting", "the", "user", ".", "This", "will", "only", "be", "possible", "when", "NN", "is"...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java#L484-L490
117,898
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java
FSEditLogLoader.validateEditLog
public static EditLogValidation validateEditLog(EditLogInputStream in) { long lastPos = 0; long firstTxId = HdfsConstants.INVALID_TXID; long lastTxId = HdfsConstants.INVALID_TXID; long numValid = 0; try { FSEditLogOp op = null; while (true) { lastPos = in.getPosition(); t...
java
public static EditLogValidation validateEditLog(EditLogInputStream in) { long lastPos = 0; long firstTxId = HdfsConstants.INVALID_TXID; long lastTxId = HdfsConstants.INVALID_TXID; long numValid = 0; try { FSEditLogOp op = null; while (true) { lastPos = in.getPosition(); t...
[ "public", "static", "EditLogValidation", "validateEditLog", "(", "EditLogInputStream", "in", ")", "{", "long", "lastPos", "=", "0", ";", "long", "firstTxId", "=", "HdfsConstants", ".", "INVALID_TXID", ";", "long", "lastTxId", "=", "HdfsConstants", ".", "INVALID_TX...
Return the number of valid transactions in the stream. If the stream is truncated during the header, returns a value indicating that there are 0 valid transactions. This reads through the stream but does not close it. @throws IOException if the stream cannot be read due to an IO error (eg if the log does not exist)
[ "Return", "the", "number", "of", "valid", "transactions", "in", "the", "stream", ".", "If", "the", "stream", "is", "truncated", "during", "the", "header", "returns", "a", "value", "indicating", "that", "there", "are", "0", "valid", "transactions", ".", "This...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java#L540-L580
117,899
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobInProgress.java
CoronaJobInProgress.initTasks
public void initTasks() throws IOException { // log job info jobHistory.logSubmitted(jobFile.toString(), this.startTime, this.jobTrackerId); // log the job priority JobClient.RawSplit[] splits = null; splits = JobClient.getAndRemoveCachedSplits(jobId); if (splits == null) { FileSystem fs =...
java
public void initTasks() throws IOException { // log job info jobHistory.logSubmitted(jobFile.toString(), this.startTime, this.jobTrackerId); // log the job priority JobClient.RawSplit[] splits = null; splits = JobClient.getAndRemoveCachedSplits(jobId); if (splits == null) { FileSystem fs =...
[ "public", "void", "initTasks", "(", ")", "throws", "IOException", "{", "// log job info", "jobHistory", ".", "logSubmitted", "(", "jobFile", ".", "toString", "(", ")", ",", "this", ".", "startTime", ",", "this", ".", "jobTrackerId", ")", ";", "// log the job p...
Read input splits and create a map per split.
[ "Read", "input", "splits", "and", "create", "a", "map", "per", "split", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobInProgress.java#L520-L540