id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
119,400
facebookarchive/hadoop-20
src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/LoadGenerator.java
LoadGenerator.initFileDirTables
private int initFileDirTables() { try { initFileDirTables(root); } catch (IOException e) { System.err.println(e.getLocalizedMessage()); e.printStackTrace(); return -1; } if (dirs.isEmpty()) { System.err.println("The test space " + root + " is empty"); return -1; }...
java
private int initFileDirTables() { try { initFileDirTables(root); } catch (IOException e) { System.err.println(e.getLocalizedMessage()); e.printStackTrace(); return -1; } if (dirs.isEmpty()) { System.err.println("The test space " + root + " is empty"); return -1; }...
[ "private", "int", "initFileDirTables", "(", ")", "{", "try", "{", "initFileDirTables", "(", "root", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ".", "getLocalizedMessage", "(", ")", ")", ";...
Create a table that contains all directories under root and another table that contains all files under root.
[ "Create", "a", "table", "that", "contains", "all", "directories", "under", "root", "and", "another", "table", "that", "contains", "all", "files", "under", "root", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/LoadGenerator.java#L381-L399
119,401
facebookarchive/hadoop-20
src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/LoadGenerator.java
LoadGenerator.initFileDirTables
private void initFileDirTables(Path path) throws IOException { FileStatus[] stats = fs.listStatus(path); if (stats != null) { for (FileStatus stat : stats) { if (stat.isDir()) { dirs.add(stat.getPath().toString()); initFileDirTables(stat.getPath()); } else { P...
java
private void initFileDirTables(Path path) throws IOException { FileStatus[] stats = fs.listStatus(path); if (stats != null) { for (FileStatus stat : stats) { if (stat.isDir()) { dirs.add(stat.getPath().toString()); initFileDirTables(stat.getPath()); } else { P...
[ "private", "void", "initFileDirTables", "(", "Path", "path", ")", "throws", "IOException", "{", "FileStatus", "[", "]", "stats", "=", "fs", ".", "listStatus", "(", "path", ")", ";", "if", "(", "stats", "!=", "null", ")", "{", "for", "(", "FileStatus", ...
Create a table that contains all directories under the specified path and another table that contains all files under the specified path and whose name starts with "_file_".
[ "Create", "a", "table", "that", "contains", "all", "directories", "under", "the", "specified", "path", "and", "another", "table", "that", "contains", "all", "files", "under", "the", "specified", "path", "and", "whose", "name", "starts", "with", "_file_", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/LoadGenerator.java#L405-L420
119,402
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/JobTrackerTraits.java
JobTrackerTraits.getTaskDiagnosticsImpl
protected String[] getTaskDiagnosticsImpl(TaskAttemptID taskId) throws IOException { List<String> taskDiagnosticInfo = null; JobID jobId = taskId.getJobID(); TaskID tipId = taskId.getTaskID(); JobInProgressTraits job = getJobInProgress(jobId); if (job != null && job.inited()) { TaskInPro...
java
protected String[] getTaskDiagnosticsImpl(TaskAttemptID taskId) throws IOException { List<String> taskDiagnosticInfo = null; JobID jobId = taskId.getJobID(); TaskID tipId = taskId.getTaskID(); JobInProgressTraits job = getJobInProgress(jobId); if (job != null && job.inited()) { TaskInPro...
[ "protected", "String", "[", "]", "getTaskDiagnosticsImpl", "(", "TaskAttemptID", "taskId", ")", "throws", "IOException", "{", "List", "<", "String", ">", "taskDiagnosticInfo", "=", "null", ";", "JobID", "jobId", "=", "taskId", ".", "getJobID", "(", ")", ";", ...
Get the diagnostics for a given task @param taskId the id of the task @return an array of the diagnostic messages
[ "Get", "the", "diagnostics", "for", "a", "given", "task" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTrackerTraits.java#L97-L114
119,403
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/JobTrackerTraits.java
JobTrackerTraits.getTip
public TaskInProgress getTip(TaskID tipid) { JobInProgressTraits job = getJobInProgress(tipid.getJobID()); return (job == null ? null : job.getTaskInProgress(tipid)); }
java
public TaskInProgress getTip(TaskID tipid) { JobInProgressTraits job = getJobInProgress(tipid.getJobID()); return (job == null ? null : job.getTaskInProgress(tipid)); }
[ "public", "TaskInProgress", "getTip", "(", "TaskID", "tipid", ")", "{", "JobInProgressTraits", "job", "=", "getJobInProgress", "(", "tipid", ".", "getJobID", "(", ")", ")", ";", "return", "(", "job", "==", "null", "?", "null", ":", "job", ".", "getTaskInPr...
Returns specified TaskInProgress, or null.
[ "Returns", "specified", "TaskInProgress", "or", "null", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTrackerTraits.java#L119-L122
119,404
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/util/LightWeightLinkedSet.java
LightWeightLinkedSet.pollFirst
public T pollFirst() { if (head == null) { return null; } T first = head.element; this.remove(first); return first; }
java
public T pollFirst() { if (head == null) { return null; } T first = head.element; this.remove(first); return first; }
[ "public", "T", "pollFirst", "(", ")", "{", "if", "(", "head", "==", "null", ")", "{", "return", "null", ";", "}", "T", "first", "=", "head", ".", "element", ";", "this", ".", "remove", "(", "first", ")", ";", "return", "first", ";", "}" ]
Remove and return first element on the linked list of all elements. @return first element
[ "Remove", "and", "return", "first", "element", "on", "the", "linked", "list", "of", "all", "elements", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/util/LightWeightLinkedSet.java#L149-L156
119,405
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/util/LightWeightLinkedSet.java
LightWeightLinkedSet.pollNToList
public void pollNToList(int n, List<T> retList) { if (n >= size) { // if we need to remove all elements then do fast polling pollAllToList(retList); } while (n-- > 0 && head != null) { T curr = head.element; this.removeElem(curr); retList.add(curr); } shrinkIfNecessary(...
java
public void pollNToList(int n, List<T> retList) { if (n >= size) { // if we need to remove all elements then do fast polling pollAllToList(retList); } while (n-- > 0 && head != null) { T curr = head.element; this.removeElem(curr); retList.add(curr); } shrinkIfNecessary(...
[ "public", "void", "pollNToList", "(", "int", "n", ",", "List", "<", "T", ">", "retList", ")", "{", "if", "(", "n", ">=", "size", ")", "{", "// if we need to remove all elements then do fast polling", "pollAllToList", "(", "retList", ")", ";", "}", "while", "...
Remove and return first n elements on the linked list of all elements. Put elements into the given list.
[ "Remove", "and", "return", "first", "n", "elements", "on", "the", "linked", "list", "of", "all", "elements", ".", "Put", "elements", "into", "the", "given", "list", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/util/LightWeightLinkedSet.java#L189-L200
119,406
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/FileOutputFormat.java
FileOutputFormat.getTaskOutputPath
public static Path getTaskOutputPath(JobConf conf, String name) throws IOException { // ${mapred.out.dir} Path outputPath = getOutputPath(conf); if (outputPath == null) { throw new IOException("Undefined job output-path"); } OutputCommitter committer = conf.getOutputCommitter(); Path w...
java
public static Path getTaskOutputPath(JobConf conf, String name) throws IOException { // ${mapred.out.dir} Path outputPath = getOutputPath(conf); if (outputPath == null) { throw new IOException("Undefined job output-path"); } OutputCommitter committer = conf.getOutputCommitter(); Path w...
[ "public", "static", "Path", "getTaskOutputPath", "(", "JobConf", "conf", ",", "String", "name", ")", "throws", "IOException", "{", "// ${mapred.out.dir}", "Path", "outputPath", "=", "getOutputPath", "(", "conf", ")", ";", "if", "(", "outputPath", "==", "null", ...
Helper function to create the task's temporary output directory and return the path to the task's output file. @param conf job-configuration @param name temporary task-output filename @return path to the task's temporary output file @throws IOException
[ "Helper", "function", "to", "create", "the", "task", "s", "temporary", "output", "directory", "and", "return", "the", "path", "to", "the", "task", "s", "output", "file", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/FileOutputFormat.java#L231-L250
119,407
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/FileOutputFormat.java
FileOutputFormat.getUniqueName
public static String getUniqueName(JobConf conf, String name) { int partition = conf.getInt("mapred.task.partition", -1); if (partition == -1) { throw new IllegalArgumentException( "This method can only be called from within a Job"); } String taskType = (conf.getBoolean("mapred.task.is.ma...
java
public static String getUniqueName(JobConf conf, String name) { int partition = conf.getInt("mapred.task.partition", -1); if (partition == -1) { throw new IllegalArgumentException( "This method can only be called from within a Job"); } String taskType = (conf.getBoolean("mapred.task.is.ma...
[ "public", "static", "String", "getUniqueName", "(", "JobConf", "conf", ",", "String", "name", ")", "{", "int", "partition", "=", "conf", ".", "getInt", "(", "\"mapred.task.partition\"", ",", "-", "1", ")", ";", "if", "(", "partition", "==", "-", "1", ")"...
Helper function to generate a name that is unique for the task. <p>The generated name can be used to create custom files from within the different tasks for the job, the names for different tasks will not collide with each other.</p> <p>The given name is postfixed with the task type, 'm' for maps, 'r' for reduces and...
[ "Helper", "function", "to", "generate", "a", "name", "that", "is", "unique", "for", "the", "task", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/FileOutputFormat.java#L268-L282
119,408
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java
DFSInputStream.openInfo
synchronized void openInfo() throws IOException { if (src == null && blocks == null) { throw new IOException("No file provided to open"); } LocatedBlocks newInfo = src != null ? getLocatedBlocks(src, 0, prefetchSize) : blocks; if (newInfo ...
java
synchronized void openInfo() throws IOException { if (src == null && blocks == null) { throw new IOException("No file provided to open"); } LocatedBlocks newInfo = src != null ? getLocatedBlocks(src, 0, prefetchSize) : blocks; if (newInfo ...
[ "synchronized", "void", "openInfo", "(", ")", "throws", "IOException", "{", "if", "(", "src", "==", "null", "&&", "blocks", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"No file provided to open\"", ")", ";", "}", "LocatedBlocks", "newInfo", ...
Grab the open-file info from namenode
[ "Grab", "the", "open", "-", "file", "info", "from", "namenode" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java#L244-L296
119,409
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java
DFSInputStream.getBlockInfo
private Block getBlockInfo(LocatedBlock locatedblock) throws IOException { if (locatedblock == null || locatedblock.getLocations().length == 0) { return null; } int replicaNotFoundCount = locatedblock.getLocations().length; for(DatanodeInfo datanode : locatedblock.getLocations()) { Protocol...
java
private Block getBlockInfo(LocatedBlock locatedblock) throws IOException { if (locatedblock == null || locatedblock.getLocations().length == 0) { return null; } int replicaNotFoundCount = locatedblock.getLocations().length; for(DatanodeInfo datanode : locatedblock.getLocations()) { Protocol...
[ "private", "Block", "getBlockInfo", "(", "LocatedBlock", "locatedblock", ")", "throws", "IOException", "{", "if", "(", "locatedblock", "==", "null", "||", "locatedblock", ".", "getLocations", "(", ")", ".", "length", "==", "0", ")", "{", "return", "null", ";...
Get block info from a datanode
[ "Get", "block", "info", "from", "a", "datanode" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java#L356-L408
119,410
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java
DFSInputStream.getBlockAt
private LocatedBlock getBlockAt(long offset, boolean updatePosition, boolean throwWhenNotFound) throws IOException { assert (locatedBlocks != null) : "locatedBlocks is null"; // search cached blocks first locatedBlocks.blockLocationInfoExpiresIfNeeded(); LocatedBlock blk = locatedBlocks.getB...
java
private LocatedBlock getBlockAt(long offset, boolean updatePosition, boolean throwWhenNotFound) throws IOException { assert (locatedBlocks != null) : "locatedBlocks is null"; // search cached blocks first locatedBlocks.blockLocationInfoExpiresIfNeeded(); LocatedBlock blk = locatedBlocks.getB...
[ "private", "LocatedBlock", "getBlockAt", "(", "long", "offset", ",", "boolean", "updatePosition", ",", "boolean", "throwWhenNotFound", ")", "throws", "IOException", "{", "assert", "(", "locatedBlocks", "!=", "null", ")", ":", "\"locatedBlocks is null\"", ";", "// se...
Get block at the specified position. Fetch it from the namenode if not cached. If updatePosition is true, it is required that the the method is called inside the synchronized block, since the current block information will be updated. @param offset @param updatePosition @param throwWhenNoFound when no block found for...
[ "Get", "block", "at", "the", "specified", "position", ".", "Fetch", "it", "from", "the", "namenode", "if", "not", "cached", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java#L462-L500
119,411
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java
DFSInputStream.getBlockRange
private List<LocatedBlock> getBlockRange(final long offset, final long length) throws IOException { List<LocatedBlock> blockRange = new ArrayList<LocatedBlock>(); // Zero length. Not sure this ever happens in practice. if (length == 0) return blockRange; // A defensive measure to ensure tha...
java
private List<LocatedBlock> getBlockRange(final long offset, final long length) throws IOException { List<LocatedBlock> blockRange = new ArrayList<LocatedBlock>(); // Zero length. Not sure this ever happens in practice. if (length == 0) return blockRange; // A defensive measure to ensure tha...
[ "private", "List", "<", "LocatedBlock", ">", "getBlockRange", "(", "final", "long", "offset", ",", "final", "long", "length", ")", "throws", "IOException", "{", "List", "<", "LocatedBlock", ">", "blockRange", "=", "new", "ArrayList", "<", "LocatedBlock", ">", ...
Get blocks in the specified range. The locations of all blocks overlapping with the given segment of the file are retrieved. Fetch them from the namenode if not cached. @param offset the offset of the segment to read @param length the length of the segment to read @return consequent segment of located blocks @throws I...
[ "Get", "blocks", "in", "the", "specified", "range", ".", "The", "locations", "of", "all", "blocks", "overlapping", "with", "the", "given", "segment", "of", "the", "file", "are", "retrieved", ".", "Fetch", "them", "from", "the", "namenode", "if", "not", "ca...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java#L512-L572
119,412
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java
DFSInputStream.close
@Override public synchronized void close() throws IOException { try { if (closed) { return; } dfsClient.checkOpen(); if (blockReader != null) { closeBlockReader(blockReader, false); blockReader = null; } for (BlockReaderLocalBase brl : localBlockReader...
java
@Override public synchronized void close() throws IOException { try { if (closed) { return; } dfsClient.checkOpen(); if (blockReader != null) { closeBlockReader(blockReader, false); blockReader = null; } for (BlockReaderLocalBase brl : localBlockReader...
[ "@", "Override", "public", "synchronized", "void", "close", "(", ")", "throws", "IOException", "{", "try", "{", "if", "(", "closed", ")", "{", "return", ";", "}", "dfsClient", ".", "checkOpen", "(", ")", ";", "if", "(", "blockReader", "!=", "null", ")"...
Close it down!
[ "Close", "it", "down!" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java#L713-L744
119,413
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java
DFSInputStream.read
@Override public synchronized int read(byte buf[], int off, int len) throws IOException { dfsClient.checkOpen(); if (closed) { dfsClient.incReadExpCntToStats(); throw new IOException("Stream closed"); } DFSClient.dfsInputStreamfailures.set(0); long start = System.currentTimeMillis(); ...
java
@Override public synchronized int read(byte buf[], int off, int len) throws IOException { dfsClient.checkOpen(); if (closed) { dfsClient.incReadExpCntToStats(); throw new IOException("Stream closed"); } DFSClient.dfsInputStreamfailures.set(0); long start = System.currentTimeMillis(); ...
[ "@", "Override", "public", "synchronized", "int", "read", "(", "byte", "buf", "[", "]", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "dfsClient", ".", "checkOpen", "(", ")", ";", "if", "(", "closed", ")", "{", "dfsClient", ...
Read the entire buffer.
[ "Read", "the", "entire", "buffer", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java#L841-L932
119,414
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java
DFSInputStream.closeBlockReader
private void closeBlockReader(BlockReader reader, boolean reuseConnection) throws IOException { if (reader.hasSentStatusCode()) { Socket oldSock = reader.takeSocket(); if (dfsClient.getDataTransferProtocolVersion() < DataTransferProtocol.READ_REUSE_CONNECTION_VERSION || !reus...
java
private void closeBlockReader(BlockReader reader, boolean reuseConnection) throws IOException { if (reader.hasSentStatusCode()) { Socket oldSock = reader.takeSocket(); if (dfsClient.getDataTransferProtocolVersion() < DataTransferProtocol.READ_REUSE_CONNECTION_VERSION || !reus...
[ "private", "void", "closeBlockReader", "(", "BlockReader", "reader", ",", "boolean", "reuseConnection", ")", "throws", "IOException", "{", "if", "(", "reader", ".", "hasSentStatusCode", "(", ")", ")", "{", "Socket", "oldSock", "=", "reader", ".", "takeSocket", ...
Close the given BlockReader and cache its socket.
[ "Close", "the", "given", "BlockReader", "and", "cache", "its", "socket", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java#L1285-L1301
119,415
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java
DFSInputStream.getBlockReader
protected BlockReader getBlockReader(int protocolVersion, int namespaceId, InetSocketAddress dnAddr, String file, long blockId, ...
java
protected BlockReader getBlockReader(int protocolVersion, int namespaceId, InetSocketAddress dnAddr, String file, long blockId, ...
[ "protected", "BlockReader", "getBlockReader", "(", "int", "protocolVersion", ",", "int", "namespaceId", ",", "InetSocketAddress", "dnAddr", ",", "String", "file", ",", "long", "blockId", ",", "long", "generationStamp", ",", "long", "startOffset", ",", "long", "len...
Retrieve a BlockReader suitable for reading. This method will reuse the cached connection to the DN if appropriate. Otherwise, it will create a new connection. @param protocolVersion @param namespaceId @param dnAddr @param file @param blockId @param generationStamp @param startOffset @param len @param bufferSize @para...
[ "Retrieve", "a", "BlockReader", "suitable", "for", "reading", ".", "This", "method", "will", "reuse", "the", "cached", "connection", "to", "the", "DN", "if", "appropriate", ".", "Otherwise", "it", "will", "create", "a", "new", "connection", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java#L1336-L1419
119,416
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java
DFSInputStream.read
public int read(long position, byte[] buffer, int offset, int length, ReadOptions options) throws IOException { // sanity checks dfsClient.checkOpen(); if (closed) { throw new IOException("Stream closed"); } DFSClient.dfsInputStreamfailures.set(0); long start = System.curren...
java
public int read(long position, byte[] buffer, int offset, int length, ReadOptions options) throws IOException { // sanity checks dfsClient.checkOpen(); if (closed) { throw new IOException("Stream closed"); } DFSClient.dfsInputStreamfailures.set(0); long start = System.curren...
[ "public", "int", "read", "(", "long", "position", ",", "byte", "[", "]", "buffer", ",", "int", "offset", ",", "int", "length", ",", "ReadOptions", "options", ")", "throws", "IOException", "{", "// sanity checks", "dfsClient", ".", "checkOpen", "(", ")", ";...
Read bytes starting from the specified position. @param position start read from this position @param buffer read buffer @param offset offset into buffer @param length number of bytes to read @return actual number of bytes read
[ "Read", "bytes", "starting", "from", "the", "specified", "position", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java#L1638-L1704
119,417
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java
DFSInputStream.readFullyScatterGather
@Override public List<ByteBuffer> readFullyScatterGather(long position, int length) throws IOException { // if the server does not support scatter-gather, // then use default implementation from FSDataInputStream. if (dfsClient.dataTransferVersion < DataTransferProtocol.SCATTERGATHER_VERSION) ...
java
@Override public List<ByteBuffer> readFullyScatterGather(long position, int length) throws IOException { // if the server does not support scatter-gather, // then use default implementation from FSDataInputStream. if (dfsClient.dataTransferVersion < DataTransferProtocol.SCATTERGATHER_VERSION) ...
[ "@", "Override", "public", "List", "<", "ByteBuffer", ">", "readFullyScatterGather", "(", "long", "position", ",", "int", "length", ")", "throws", "IOException", "{", "// if the server does not support scatter-gather, ", "// then use default implementation from FSDataInputStrea...
Read bytes starting from the specified position. This is optimized for fast preads from an application with minimum of buffer copies. @param position start read from this position @param length number of bytes to read @return A list of Byte Buffers that represent all the data that was read from the underlying system.
[ "Read", "bytes", "starting", "from", "the", "specified", "position", ".", "This", "is", "optimized", "for", "fast", "preads", "from", "an", "application", "with", "minimum", "of", "buffer", "copies", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java#L1716-L1766
119,418
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java
DFSInputStream.seek
@Override public synchronized void seek(long targetPos) throws IOException { if (targetPos > getFileLength()) { throw new IOException("Cannot seek after EOF"); } boolean done = false; if (pos <= targetPos && targetPos <= blockEnd) { // // If this seek is to a positive position in the...
java
@Override public synchronized void seek(long targetPos) throws IOException { if (targetPos > getFileLength()) { throw new IOException("Cannot seek after EOF"); } boolean done = false; if (pos <= targetPos && targetPos <= blockEnd) { // // If this seek is to a positive position in the...
[ "@", "Override", "public", "synchronized", "void", "seek", "(", "long", "targetPos", ")", "throws", "IOException", "{", "if", "(", "targetPos", ">", "getFileLength", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"Cannot seek after EOF\"", ")", ";",...
Seek to a new arbitrary location
[ "Seek", "to", "a", "new", "arbitrary", "location" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java#L1785-L1823
119,419
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java
DFSInputStream.seekToNewSource
public synchronized boolean seekToNewSource(long targetPos, boolean throwWhenNotFound) throws IOException { boolean markedDead = deadNodes.containsKey(currentNode); addToDeadNodes(currentNode); DatanodeInfo oldNode = currentNode; DatanodeInfo newNode = blockSeekTo(targetPos, throwWhenNotFound); ...
java
public synchronized boolean seekToNewSource(long targetPos, boolean throwWhenNotFound) throws IOException { boolean markedDead = deadNodes.containsKey(currentNode); addToDeadNodes(currentNode); DatanodeInfo oldNode = currentNode; DatanodeInfo newNode = blockSeekTo(targetPos, throwWhenNotFound); ...
[ "public", "synchronized", "boolean", "seekToNewSource", "(", "long", "targetPos", ",", "boolean", "throwWhenNotFound", ")", "throws", "IOException", "{", "boolean", "markedDead", "=", "deadNodes", ".", "containsKey", "(", "currentNode", ")", ";", "addToDeadNodes", "...
Seek to given position on a node other than the current node. If a node other than the current node is found, then returns true. If another node could not be found, then returns false.
[ "Seek", "to", "given", "position", "on", "a", "node", "other", "than", "the", "current", "node", ".", "If", "a", "node", "other", "than", "the", "current", "node", "is", "found", "then", "returns", "true", ".", "If", "another", "node", "could", "not", ...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSInputStream.java#L1850-L1867
119,420
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/TaskTrackerStatus.java
TaskTrackerStatus.isTaskRunning
private boolean isTaskRunning(TaskStatus taskStatus) { TaskStatus.State state = taskStatus.getRunState(); return (state == State.RUNNING || state == State.UNASSIGNED || taskStatus.inTaskCleanupPhase()); }
java
private boolean isTaskRunning(TaskStatus taskStatus) { TaskStatus.State state = taskStatus.getRunState(); return (state == State.RUNNING || state == State.UNASSIGNED || taskStatus.inTaskCleanupPhase()); }
[ "private", "boolean", "isTaskRunning", "(", "TaskStatus", "taskStatus", ")", "{", "TaskStatus", ".", "State", "state", "=", "taskStatus", ".", "getRunState", "(", ")", ";", "return", "(", "state", "==", "State", ".", "RUNNING", "||", "state", "==", "State", ...
Is the given task considered as 'running' ? @param taskStatus @return
[ "Is", "the", "given", "task", "considered", "as", "running", "?" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskTrackerStatus.java#L421-L425
119,421
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/TaskTrackerStatus.java
TaskTrackerStatus.countMapTasks
public int countMapTasks() { int mapCount = 0; for (Iterator<TaskStatus> it = taskReports.iterator(); it.hasNext();) { TaskStatus ts = (TaskStatus) it.next(); if (ts.getIsMap() && isTaskRunning(ts)) { mapCount++; } } return mapCount; }
java
public int countMapTasks() { int mapCount = 0; for (Iterator<TaskStatus> it = taskReports.iterator(); it.hasNext();) { TaskStatus ts = (TaskStatus) it.next(); if (ts.getIsMap() && isTaskRunning(ts)) { mapCount++; } } return mapCount; }
[ "public", "int", "countMapTasks", "(", ")", "{", "int", "mapCount", "=", "0", ";", "for", "(", "Iterator", "<", "TaskStatus", ">", "it", "=", "taskReports", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "TaskStatus", ...
Get the number of running map tasks. @return the number of running map tasks
[ "Get", "the", "number", "of", "running", "map", "tasks", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskTrackerStatus.java#L431-L440
119,422
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/TaskTrackerStatus.java
TaskTrackerStatus.countOccupiedMapSlots
public int countOccupiedMapSlots() { int mapSlotsCount = 0; for (Iterator<TaskStatus> it = taskReports.iterator(); it.hasNext();) { TaskStatus ts = (TaskStatus) it.next(); if (ts.getIsMap() && isTaskRunning(ts)) { mapSlotsCount += ts.getNumSlots(); } } return mapSlotsCount; }
java
public int countOccupiedMapSlots() { int mapSlotsCount = 0; for (Iterator<TaskStatus> it = taskReports.iterator(); it.hasNext();) { TaskStatus ts = (TaskStatus) it.next(); if (ts.getIsMap() && isTaskRunning(ts)) { mapSlotsCount += ts.getNumSlots(); } } return mapSlotsCount; }
[ "public", "int", "countOccupiedMapSlots", "(", ")", "{", "int", "mapSlotsCount", "=", "0", ";", "for", "(", "Iterator", "<", "TaskStatus", ">", "it", "=", "taskReports", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "...
Get the number of occupied map slots. @return the number of occupied map slots
[ "Get", "the", "number", "of", "occupied", "map", "slots", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskTrackerStatus.java#L446-L455
119,423
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/TaskTrackerStatus.java
TaskTrackerStatus.countReduceTasks
public int countReduceTasks() { int reduceCount = 0; for (Iterator<TaskStatus> it = taskReports.iterator(); it.hasNext();) { TaskStatus ts = (TaskStatus) it.next(); if ((!ts.getIsMap()) && isTaskRunning(ts)) { reduceCount++; } } return reduceCount; }
java
public int countReduceTasks() { int reduceCount = 0; for (Iterator<TaskStatus> it = taskReports.iterator(); it.hasNext();) { TaskStatus ts = (TaskStatus) it.next(); if ((!ts.getIsMap()) && isTaskRunning(ts)) { reduceCount++; } } return reduceCount; }
[ "public", "int", "countReduceTasks", "(", ")", "{", "int", "reduceCount", "=", "0", ";", "for", "(", "Iterator", "<", "TaskStatus", ">", "it", "=", "taskReports", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "TaskSta...
Get the number of running reduce tasks. @return the number of running reduce tasks
[ "Get", "the", "number", "of", "running", "reduce", "tasks", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskTrackerStatus.java#L469-L478
119,424
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/TaskTrackerStatus.java
TaskTrackerStatus.countOccupiedReduceSlots
public int countOccupiedReduceSlots() { int reduceSlotsCount = 0; for (Iterator<TaskStatus> it = taskReports.iterator(); it.hasNext();) { TaskStatus ts = (TaskStatus) it.next(); if ((!ts.getIsMap()) && isTaskRunning(ts)) { reduceSlotsCount += ts.getNumSlots(); } } return reduce...
java
public int countOccupiedReduceSlots() { int reduceSlotsCount = 0; for (Iterator<TaskStatus> it = taskReports.iterator(); it.hasNext();) { TaskStatus ts = (TaskStatus) it.next(); if ((!ts.getIsMap()) && isTaskRunning(ts)) { reduceSlotsCount += ts.getNumSlots(); } } return reduce...
[ "public", "int", "countOccupiedReduceSlots", "(", ")", "{", "int", "reduceSlotsCount", "=", "0", ";", "for", "(", "Iterator", "<", "TaskStatus", ">", "it", "=", "taskReports", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{...
Get the number of occupied reduce slots. @return the number of occupied reduce slots
[ "Get", "the", "number", "of", "occupied", "reduce", "slots", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskTrackerStatus.java#L484-L493
119,425
facebookarchive/hadoop-20
src/core/org/apache/hadoop/record/BinaryRecordInput.java
BinaryRecordInput.get
public static BinaryRecordInput get(DataInput inp) { BinaryRecordInput bin = (BinaryRecordInput) bIn.get(); bin.setDataInput(inp); return bin; }
java
public static BinaryRecordInput get(DataInput inp) { BinaryRecordInput bin = (BinaryRecordInput) bIn.get(); bin.setDataInput(inp); return bin; }
[ "public", "static", "BinaryRecordInput", "get", "(", "DataInput", "inp", ")", "{", "BinaryRecordInput", "bin", "=", "(", "BinaryRecordInput", ")", "bIn", ".", "get", "(", ")", ";", "bin", ".", "setDataInput", "(", "inp", ")", ";", "return", "bin", ";", "...
Get a thread-local record input for the supplied DataInput. @param inp data input stream @return binary record input corresponding to the supplied DataInput.
[ "Get", "a", "thread", "-", "local", "record", "input", "for", "the", "supplied", "DataInput", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/record/BinaryRecordInput.java#L62-L66
119,426
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNodeSafeModeInfo.java
NameNodeSafeModeInfo.canLeave
@Override public boolean canLeave() { if (reached == 0) { return false; } if (namesystem.now() - reached < extension) { reportStatus("STATE* Safe mode ON.", false); return false; } return !needEnter(); }
java
@Override public boolean canLeave() { if (reached == 0) { return false; } if (namesystem.now() - reached < extension) { reportStatus("STATE* Safe mode ON.", false); return false; } return !needEnter(); }
[ "@", "Override", "public", "boolean", "canLeave", "(", ")", "{", "if", "(", "reached", "==", "0", ")", "{", "return", "false", ";", "}", "if", "(", "namesystem", ".", "now", "(", ")", "-", "reached", "<", "extension", ")", "{", "reportStatus", "(", ...
Safe mode can be turned off iff the threshold is reached and the extension time have passed. @return true if can leave or false otherwise.
[ "Safe", "mode", "can", "be", "turned", "off", "iff", "the", "threshold", "is", "reached", "and", "the", "extension", "time", "have", "passed", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNodeSafeModeInfo.java#L198-L208
119,427
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNodeSafeModeInfo.java
NameNodeSafeModeInfo.reportStatus
private void reportStatus(String msg, boolean rightNow) { long curTime = FSNamesystem.now(); if (!rightNow && (curTime - lastStatusReport < 20 * 1000)) { return; } FLOG.info(msg + " \n" + getTurnOffTip()); lastStatusReport = curTime; }
java
private void reportStatus(String msg, boolean rightNow) { long curTime = FSNamesystem.now(); if (!rightNow && (curTime - lastStatusReport < 20 * 1000)) { return; } FLOG.info(msg + " \n" + getTurnOffTip()); lastStatusReport = curTime; }
[ "private", "void", "reportStatus", "(", "String", "msg", ",", "boolean", "rightNow", ")", "{", "long", "curTime", "=", "FSNamesystem", ".", "now", "(", ")", ";", "if", "(", "!", "rightNow", "&&", "(", "curTime", "-", "lastStatusReport", "<", "20", "*", ...
Print status every 20 seconds.
[ "Print", "status", "every", "20", "seconds", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNodeSafeModeInfo.java#L319-L326
119,428
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNodeSafeModeInfo.java
NameNodeSafeModeInfo.isConsistent
private boolean isConsistent() { if (this.reached < 0) { return true; // Safemode is off. } if (namesystem.getTotalBlocks() == -1 && namesystem.getSafeBlocks() == -1) { return true; // manual safe mode } long activeBlocks = namesystem.getBlocksTotal() - namesystem.getPendingDeletio...
java
private boolean isConsistent() { if (this.reached < 0) { return true; // Safemode is off. } if (namesystem.getTotalBlocks() == -1 && namesystem.getSafeBlocks() == -1) { return true; // manual safe mode } long activeBlocks = namesystem.getBlocksTotal() - namesystem.getPendingDeletio...
[ "private", "boolean", "isConsistent", "(", ")", "{", "if", "(", "this", ".", "reached", "<", "0", ")", "{", "return", "true", ";", "// Safemode is off.", "}", "if", "(", "namesystem", ".", "getTotalBlocks", "(", ")", "==", "-", "1", "&&", "namesystem", ...
Checks consistency of the class state. This is costly and currently called only in assert.
[ "Checks", "consistency", "of", "the", "class", "state", ".", "This", "is", "costly", "and", "currently", "called", "only", "in", "assert", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNodeSafeModeInfo.java#L348-L360
119,429
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapreduce/ReduceContext.java
ReduceContext.nextKey
public boolean nextKey() throws IOException,InterruptedException { while (hasMore && nextKeyIsSame) { nextKeyValue(); } if (hasMore) { if (inputKeyCounter != null) { inputKeyCounter.increment(1); } return nextKeyValue(); } else { return false; } }
java
public boolean nextKey() throws IOException,InterruptedException { while (hasMore && nextKeyIsSame) { nextKeyValue(); } if (hasMore) { if (inputKeyCounter != null) { inputKeyCounter.increment(1); } return nextKeyValue(); } else { return false; } }
[ "public", "boolean", "nextKey", "(", ")", "throws", "IOException", ",", "InterruptedException", "{", "while", "(", "hasMore", "&&", "nextKeyIsSame", ")", "{", "nextKeyValue", "(", ")", ";", "}", "if", "(", "hasMore", ")", "{", "if", "(", "inputKeyCounter", ...
Start processing next unique key.
[ "Start", "processing", "next", "unique", "key", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/ReduceContext.java#L84-L96
119,430
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImageCompression.java
FSImageCompression.createCompression
static FSImageCompression createCompression(Configuration conf, boolean forceUncompressed) throws IOException { boolean compressImage = (!forceUncompressed) && conf.getBoolean( HdfsConstants.DFS_IMAGE_COMPRESS_KEY, HdfsConstants.DFS_IMAGE_COMPRESS_DEFAULT); if (!compressImage) { return cr...
java
static FSImageCompression createCompression(Configuration conf, boolean forceUncompressed) throws IOException { boolean compressImage = (!forceUncompressed) && conf.getBoolean( HdfsConstants.DFS_IMAGE_COMPRESS_KEY, HdfsConstants.DFS_IMAGE_COMPRESS_DEFAULT); if (!compressImage) { return cr...
[ "static", "FSImageCompression", "createCompression", "(", "Configuration", "conf", ",", "boolean", "forceUncompressed", ")", "throws", "IOException", "{", "boolean", "compressImage", "=", "(", "!", "forceUncompressed", ")", "&&", "conf", ".", "getBoolean", "(", "Hdf...
Create a compression instance based on the user's configuration in the given Configuration object. @throws IOException if the specified codec is not available.
[ "Create", "a", "compression", "instance", "based", "on", "the", "user", "s", "configuration", "in", "the", "given", "Configuration", "object", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImageCompression.java#L72-L86
119,431
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImageCompression.java
FSImageCompression.readCompressionHeader
public static FSImageCompression readCompressionHeader( Configuration conf, DataInputStream dis) throws IOException { boolean isCompressed = dis.readBoolean(); if (!isCompressed) { return createNoopCompression(); } else { String codecClassName = Text.readString(dis); return crea...
java
public static FSImageCompression readCompressionHeader( Configuration conf, DataInputStream dis) throws IOException { boolean isCompressed = dis.readBoolean(); if (!isCompressed) { return createNoopCompression(); } else { String codecClassName = Text.readString(dis); return crea...
[ "public", "static", "FSImageCompression", "readCompressionHeader", "(", "Configuration", "conf", ",", "DataInputStream", "dis", ")", "throws", "IOException", "{", "boolean", "isCompressed", "=", "dis", ".", "readBoolean", "(", ")", ";", "if", "(", "!", "isCompress...
Create a compression instance based on a header read from an input stream. @throws IOException if the specified codec is not available or the underlying IO fails.
[ "Create", "a", "compression", "instance", "based", "on", "a", "header", "read", "from", "an", "input", "stream", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImageCompression.java#L110-L122
119,432
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImageCompression.java
FSImageCompression.unwrapInputStream
public InputStream unwrapInputStream(InputStream is) throws IOException { if (imageCodec != null) { return imageCodec.createInputStream(is); } else { return is; } }
java
public InputStream unwrapInputStream(InputStream is) throws IOException { if (imageCodec != null) { return imageCodec.createInputStream(is); } else { return is; } }
[ "public", "InputStream", "unwrapInputStream", "(", "InputStream", "is", ")", "throws", "IOException", "{", "if", "(", "imageCodec", "!=", "null", ")", "{", "return", "imageCodec", ".", "createInputStream", "(", "is", ")", ";", "}", "else", "{", "return", "is...
Unwrap a compressed input stream by wrapping it with a decompressor based on this codec. If this instance represents no compression, simply return the input stream. @return a stream that provides uncompressed data @throws IOException If the decompressor cannot be instantiated or an IO error occurs.
[ "Unwrap", "a", "compressed", "input", "stream", "by", "wrapping", "it", "with", "a", "decompressor", "based", "on", "this", "codec", ".", "If", "this", "instance", "represents", "no", "compression", "simply", "return", "the", "input", "stream", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImageCompression.java#L132-L138
119,433
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImageCompression.java
FSImageCompression.writeHeaderAndWrapStream
DataOutputStream writeHeaderAndWrapStream(OutputStream os) throws IOException { DataOutputStream dos = new DataOutputStream(os); dos.writeBoolean(imageCodec != null); if (imageCodec != null) { String codecClassName = imageCodec.getClass().getCanonicalName(); Text.writeString(dos, codecClassN...
java
DataOutputStream writeHeaderAndWrapStream(OutputStream os) throws IOException { DataOutputStream dos = new DataOutputStream(os); dos.writeBoolean(imageCodec != null); if (imageCodec != null) { String codecClassName = imageCodec.getClass().getCanonicalName(); Text.writeString(dos, codecClassN...
[ "DataOutputStream", "writeHeaderAndWrapStream", "(", "OutputStream", "os", ")", "throws", "IOException", "{", "DataOutputStream", "dos", "=", "new", "DataOutputStream", "(", "os", ")", ";", "dos", ".", "writeBoolean", "(", "imageCodec", "!=", "null", ")", ";", "...
Write out a header to the given stream that indicates the chosen compression codec, and return the same stream wrapped with that codec. If no codec is specified, simply adds buffering to the stream, so that the returned stream is always buffered. @param os The stream to write header to and wrap. This stream should be ...
[ "Write", "out", "a", "header", "to", "the", "given", "stream", "that", "indicates", "the", "chosen", "compression", "codec", "and", "return", "the", "same", "stream", "wrapped", "with", "that", "codec", ".", "If", "no", "codec", "is", "specified", "simply", ...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImageCompression.java#L153-L168
119,434
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/TaskID.java
TaskID.downgrade
public static TaskID downgrade(org.apache.hadoop.mapreduce.TaskID old) { if (old instanceof TaskID) { return (TaskID) old; } else { return new TaskID(JobID.downgrade(old.getJobID()), old.isMap(), old.getId()); } }
java
public static TaskID downgrade(org.apache.hadoop.mapreduce.TaskID old) { if (old instanceof TaskID) { return (TaskID) old; } else { return new TaskID(JobID.downgrade(old.getJobID()), old.isMap(), old.getId()); } }
[ "public", "static", "TaskID", "downgrade", "(", "org", ".", "apache", ".", "hadoop", ".", "mapreduce", ".", "TaskID", "old", ")", "{", "if", "(", "old", "instanceof", "TaskID", ")", "{", "return", "(", "TaskID", ")", "old", ";", "}", "else", "{", "re...
Downgrade a new TaskID to an old one @param old a new or old TaskID @return either old or a new TaskID build to match old
[ "Downgrade", "a", "new", "TaskID", "to", "an", "old", "one" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskID.java#L79-L86
119,435
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java
Standby.quiesceIngestWithReprocess
private void quiesceIngestWithReprocess() throws IOException { if (ingest != null) { LOG.info("Standby: Quiescing - quiescing ongoing ingest"); quiesceIngest(); reprocessCurrentSegmentIfNeeded(ingest.getIngestStatus()); } }
java
private void quiesceIngestWithReprocess() throws IOException { if (ingest != null) { LOG.info("Standby: Quiescing - quiescing ongoing ingest"); quiesceIngest(); reprocessCurrentSegmentIfNeeded(ingest.getIngestStatus()); } }
[ "private", "void", "quiesceIngestWithReprocess", "(", ")", "throws", "IOException", "{", "if", "(", "ingest", "!=", "null", ")", "{", "LOG", ".", "info", "(", "\"Standby: Quiescing - quiescing ongoing ingest\"", ")", ";", "quiesceIngest", "(", ")", ";", "reprocess...
When ingest consumes the end of segment transaction, it sets the state to not ingesting. This function ensures that the ingest thread exited. @throws IOException
[ "When", "ingest", "consumes", "the", "end", "of", "segment", "transaction", "it", "sets", "the", "state", "to", "not", "ingesting", ".", "This", "function", "ensures", "that", "the", "ingest", "thread", "exited", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java#L407-L413
119,436
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java
Standby.quiesceIngest
private void quiesceIngest() throws IOException { InjectionHandler.processEvent(InjectionEvent.STANDBY_QUIESCE_INGEST); synchronized (ingestStateLock) { assertState(StandbyIngestState.INGESTING_EDITS, StandbyIngestState.NOT_INGESTING); ingest.quiesce(); } try { ingestThread.j...
java
private void quiesceIngest() throws IOException { InjectionHandler.processEvent(InjectionEvent.STANDBY_QUIESCE_INGEST); synchronized (ingestStateLock) { assertState(StandbyIngestState.INGESTING_EDITS, StandbyIngestState.NOT_INGESTING); ingest.quiesce(); } try { ingestThread.j...
[ "private", "void", "quiesceIngest", "(", ")", "throws", "IOException", "{", "InjectionHandler", ".", "processEvent", "(", "InjectionEvent", ".", "STANDBY_QUIESCE_INGEST", ")", ";", "synchronized", "(", "ingestStateLock", ")", "{", "assertState", "(", "StandbyIngestSta...
Quiesces the currently running ingest
[ "Quiesces", "the", "currently", "running", "ingest" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java#L418-L434
119,437
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java
Standby.instantiateIngest
private void instantiateIngest() throws IOException { InjectionHandler.processEvent(InjectionEvent.STANDBY_INSTANTIATE_INGEST); try { synchronized (ingestStateLock) { if (checkIngestState()) { LOG.info("Standby: Ingest for txid: " + currentSegmentTxId + " is already running...
java
private void instantiateIngest() throws IOException { InjectionHandler.processEvent(InjectionEvent.STANDBY_INSTANTIATE_INGEST); try { synchronized (ingestStateLock) { if (checkIngestState()) { LOG.info("Standby: Ingest for txid: " + currentSegmentTxId + " is already running...
[ "private", "void", "instantiateIngest", "(", ")", "throws", "IOException", "{", "InjectionHandler", ".", "processEvent", "(", "InjectionEvent", ".", "STANDBY_INSTANTIATE_INGEST", ")", ";", "try", "{", "synchronized", "(", "ingestStateLock", ")", "{", "if", "(", "c...
Instantiates ingest thread for the current edits segment.
[ "Instantiates", "ingest", "thread", "for", "the", "current", "edits", "segment", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java#L521-L543
119,438
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java
Standby.reprocessCurrentSegmentIfNeeded
private void reprocessCurrentSegmentIfNeeded(boolean status) throws IOException { if (status) { return; } assertState(StandbyIngestState.NOT_INGESTING); LOG.info("Standby: Quiesce - reprocessing edits segment starting at: " + currentSegmentTxId); instantiateIngest(); quiesceI...
java
private void reprocessCurrentSegmentIfNeeded(boolean status) throws IOException { if (status) { return; } assertState(StandbyIngestState.NOT_INGESTING); LOG.info("Standby: Quiesce - reprocessing edits segment starting at: " + currentSegmentTxId); instantiateIngest(); quiesceI...
[ "private", "void", "reprocessCurrentSegmentIfNeeded", "(", "boolean", "status", ")", "throws", "IOException", "{", "if", "(", "status", ")", "{", "return", ";", "}", "assertState", "(", "StandbyIngestState", ".", "NOT_INGESTING", ")", ";", "LOG", ".", "info", ...
Processes previously consumed edits segment if needed @param status of the previous ingest
[ "Processes", "previously", "consumed", "edits", "segment", "if", "needed" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java#L552-L573
119,439
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java
Standby.triggerCheckpoint
void triggerCheckpoint(boolean uncompressed) throws IOException { String pref = "Standby: Checkpoint - "; LOG.info(pref + "triggering checkpoint manually"); // check error conditions if (uncompressed) { throwIOException(pref + " uncompressed option not supported", null); } if (manualCheck...
java
void triggerCheckpoint(boolean uncompressed) throws IOException { String pref = "Standby: Checkpoint - "; LOG.info(pref + "triggering checkpoint manually"); // check error conditions if (uncompressed) { throwIOException(pref + " uncompressed option not supported", null); } if (manualCheck...
[ "void", "triggerCheckpoint", "(", "boolean", "uncompressed", ")", "throws", "IOException", "{", "String", "pref", "=", "\"Standby: Checkpoint - \"", ";", "LOG", ".", "info", "(", "pref", "+", "\"triggering checkpoint manually\"", ")", ";", "// check error conditions", ...
Trigger checkpoint. If there is an ongoing scheduled checkpoint, this call will trigger a checkpoint immediately after. The method blocks until the checkpoint is done.
[ "Trigger", "checkpoint", ".", "If", "there", "is", "an", "ongoing", "scheduled", "checkpoint", "this", "call", "will", "trigger", "a", "checkpoint", "immediately", "after", ".", "The", "method", "blocks", "until", "the", "checkpoint", "is", "done", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java#L780-L807
119,440
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java
Standby.handleCheckpointFailure
private void handleCheckpointFailure() { setCheckpointFailures(checkpointFailures + 1); if (checkpointFailures > MAX_CHECKPOINT_FAILURES) { LOG.fatal("Standby: Checkpointing - standby failed to checkpoint in " + checkpointFailures + " attempts. Aborting"); } else { // We want to give s...
java
private void handleCheckpointFailure() { setCheckpointFailures(checkpointFailures + 1); if (checkpointFailures > MAX_CHECKPOINT_FAILURES) { LOG.fatal("Standby: Checkpointing - standby failed to checkpoint in " + checkpointFailures + " attempts. Aborting"); } else { // We want to give s...
[ "private", "void", "handleCheckpointFailure", "(", ")", "{", "setCheckpointFailures", "(", "checkpointFailures", "+", "1", ")", ";", "if", "(", "checkpointFailures", ">", "MAX_CHECKPOINT_FAILURES", ")", "{", "LOG", ".", "fatal", "(", "\"Standby: Checkpointing - standb...
If checkpoint fails continuously, we want to abort the standby. We want to avoid the situation in which the standby continuously rolls edit log on the primary without finalizing checkpoint.
[ "If", "checkpoint", "fails", "continuously", "we", "want", "to", "abort", "the", "standby", ".", "We", "want", "to", "avoid", "the", "situation", "in", "which", "the", "standby", "continuously", "rolls", "edit", "log", "on", "the", "primary", "without", "fin...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java#L941-L963
119,441
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java
Standby.uploadImage
private void uploadImage(long txid) throws IOException { final long start = AvatarNode.now(); LOG.info("Standby: Checkpointing - Upload fsimage to remote namenode."); checkpointStatus("Image upload started"); imageUploader = new ImageUploader(txid); imageUploader.start(); // wait for t...
java
private void uploadImage(long txid) throws IOException { final long start = AvatarNode.now(); LOG.info("Standby: Checkpointing - Upload fsimage to remote namenode."); checkpointStatus("Image upload started"); imageUploader = new ImageUploader(txid); imageUploader.start(); // wait for t...
[ "private", "void", "uploadImage", "(", "long", "txid", ")", "throws", "IOException", "{", "final", "long", "start", "=", "AvatarNode", ".", "now", "(", ")", ";", "LOG", ".", "info", "(", "\"Standby: Checkpointing - Upload fsimage to remote namenode.\"", ")", ";", ...
Creates image upload thread.
[ "Creates", "image", "upload", "thread", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java#L968-L998
119,442
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java
Standby.putFSImage
private void putFSImage(long txid) throws IOException { TransferFsImage.uploadImageFromStorage(fsName, machineName, infoPort, fsImage.storage, txid); }
java
private void putFSImage(long txid) throws IOException { TransferFsImage.uploadImageFromStorage(fsName, machineName, infoPort, fsImage.storage, txid); }
[ "private", "void", "putFSImage", "(", "long", "txid", ")", "throws", "IOException", "{", "TransferFsImage", ".", "uploadImageFromStorage", "(", "fsName", ",", "machineName", ",", "infoPort", ",", "fsImage", ".", "storage", ",", "txid", ")", ";", "}" ]
Copy the new fsimage into the NameNode
[ "Copy", "the", "new", "fsimage", "into", "the", "NameNode" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java#L1003-L1006
119,443
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java
Standby.checkImageValidation
private void checkImageValidation() throws IOException { try { imageValidator.join(); } catch (InterruptedException ie) { throw (IOException) new InterruptedIOException().initCause(ie); } if (!imageValidator.succeeded) { throw new IOException("Image file validation failed", ...
java
private void checkImageValidation() throws IOException { try { imageValidator.join(); } catch (InterruptedException ie) { throw (IOException) new InterruptedIOException().initCause(ie); } if (!imageValidator.succeeded) { throw new IOException("Image file validation failed", ...
[ "private", "void", "checkImageValidation", "(", ")", "throws", "IOException", "{", "try", "{", "imageValidator", ".", "join", "(", ")", ";", "}", "catch", "(", "InterruptedException", "ie", ")", "{", "throw", "(", "IOException", ")", "new", "InterruptedIOExcep...
Checks the status of image validation during checkpoint. @throws IOException
[ "Checks", "the", "status", "of", "image", "validation", "during", "checkpoint", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java#L1075-L1085
119,444
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java
Standby.createImageValidation
private void createImageValidation(File imageFile) throws IOException { synchronized (imageValidatorLock) { InjectionHandler.processEvent(InjectionEvent.STANDBY_VALIDATE_CREATE); if (!running) { // fails the checkpoint InjectionHandler.processEvent(InjectionEvent.STANDBY_VALIDATE_CREATE_...
java
private void createImageValidation(File imageFile) throws IOException { synchronized (imageValidatorLock) { InjectionHandler.processEvent(InjectionEvent.STANDBY_VALIDATE_CREATE); if (!running) { // fails the checkpoint InjectionHandler.processEvent(InjectionEvent.STANDBY_VALIDATE_CREATE_...
[ "private", "void", "createImageValidation", "(", "File", "imageFile", ")", "throws", "IOException", "{", "synchronized", "(", "imageValidatorLock", ")", "{", "InjectionHandler", ".", "processEvent", "(", "InjectionEvent", ".", "STANDBY_VALIDATE_CREATE", ")", ";", "if"...
Creates image validation thread. @param imageFile @throws IOException on error, or when standby quiesce was invoked
[ "Creates", "image", "validation", "thread", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java#L1092-L1103
119,445
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java
Standby.interruptImageValidation
private void interruptImageValidation() throws IOException { synchronized (imageValidatorLock) { if (imageValidator != null) { imageValidator.interrupt(); try { imageValidator.join(); } catch (InterruptedException e) { throw new InterruptedIOException("Standby: rece...
java
private void interruptImageValidation() throws IOException { synchronized (imageValidatorLock) { if (imageValidator != null) { imageValidator.interrupt(); try { imageValidator.join(); } catch (InterruptedException e) { throw new InterruptedIOException("Standby: rece...
[ "private", "void", "interruptImageValidation", "(", ")", "throws", "IOException", "{", "synchronized", "(", "imageValidatorLock", ")", "{", "if", "(", "imageValidator", "!=", "null", ")", "{", "imageValidator", ".", "interrupt", "(", ")", ";", "try", "{", "ima...
Interrupts and joins ongoing image validation. @throws IOException
[ "Interrupts", "and", "joins", "ongoing", "image", "validation", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java#L1109-L1120
119,446
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java
Standby.initSecondary
void initSecondary(Configuration conf) throws IOException { fsName = AvatarNode.getRemoteNamenodeHttpName(conf, avatarNode.getInstanceId()); // Initialize other scheduling parameters from the configuration checkpointEnabled = conf.getBoolean("fs.checkpoint.enabled", false); checkpointPeriod = ...
java
void initSecondary(Configuration conf) throws IOException { fsName = AvatarNode.getRemoteNamenodeHttpName(conf, avatarNode.getInstanceId()); // Initialize other scheduling parameters from the configuration checkpointEnabled = conf.getBoolean("fs.checkpoint.enabled", false); checkpointPeriod = ...
[ "void", "initSecondary", "(", "Configuration", "conf", ")", "throws", "IOException", "{", "fsName", "=", "AvatarNode", ".", "getRemoteNamenodeHttpName", "(", "conf", ",", "avatarNode", ".", "getInstanceId", "(", ")", ")", ";", "// Initialize other scheduling parameter...
Initialize the webserver so that the primary namenode can fetch transaction logs from standby via http.
[ "Initialize", "the", "webserver", "so", "that", "the", "primary", "namenode", "can", "fetch", "transaction", "logs", "from", "standby", "via", "http", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java#L1128-L1170
119,447
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java
Standby.assertState
private void assertState(StandbyIngestState... expectedStates) throws IOException { for (StandbyIngestState s : expectedStates) { if (currentIngestState == s) return; } throw new IOException("Standby: illegal state - current: " + currentIngestState); }
java
private void assertState(StandbyIngestState... expectedStates) throws IOException { for (StandbyIngestState s : expectedStates) { if (currentIngestState == s) return; } throw new IOException("Standby: illegal state - current: " + currentIngestState); }
[ "private", "void", "assertState", "(", "StandbyIngestState", "...", "expectedStates", ")", "throws", "IOException", "{", "for", "(", "StandbyIngestState", "s", ":", "expectedStates", ")", "{", "if", "(", "currentIngestState", "==", "s", ")", "return", ";", "}", ...
Assert that the standby is in the expected state @param expectedStates expected states to be in
[ "Assert", "that", "the", "standby", "is", "in", "the", "expected", "state" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/Standby.java#L1239-L1247
119,448
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FSInputStream.java
FSInputStream.readFullyScatterGather
public List<ByteBuffer> readFullyScatterGather(long position, int length) throws IOException { byte[] buf = new byte[length]; readFully(position, buf, 0, length); LinkedList<ByteBuffer> results = new LinkedList<ByteBuffer>(); results.add(ByteBuffer.wrap(buf, 0, length)); return results; }
java
public List<ByteBuffer> readFullyScatterGather(long position, int length) throws IOException { byte[] buf = new byte[length]; readFully(position, buf, 0, length); LinkedList<ByteBuffer> results = new LinkedList<ByteBuffer>(); results.add(ByteBuffer.wrap(buf, 0, length)); return results; }
[ "public", "List", "<", "ByteBuffer", ">", "readFullyScatterGather", "(", "long", "position", ",", "int", "length", ")", "throws", "IOException", "{", "byte", "[", "]", "buf", "=", "new", "byte", "[", "length", "]", ";", "readFully", "(", "position", ",", ...
This can be optimized to avoid buffer copies. It allows the underlying system to return a list of ByteBuffers that contain the data. A FileSystem implementation can override this method to make it avoid redundant memory copies.
[ "This", "can", "be", "optimized", "to", "avoid", "buffer", "copies", ".", "It", "allows", "the", "underlying", "system", "to", "return", "a", "list", "of", "ByteBuffers", "that", "contain", "the", "data", ".", "A", "FileSystem", "implementation", "can", "ove...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FSInputStream.java#L89-L96
119,449
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/EditLogOutputStream.java
EditLogOutputStream.flush
public void flush(boolean durable) throws IOException { numSync++; long start = System.nanoTime(); flushAndSync(durable); long time = DFSUtil.getElapsedTimeMicroSeconds(start); totalTimeSync += time; if (sync != null) { sync.inc(time); } }
java
public void flush(boolean durable) throws IOException { numSync++; long start = System.nanoTime(); flushAndSync(durable); long time = DFSUtil.getElapsedTimeMicroSeconds(start); totalTimeSync += time; if (sync != null) { sync.inc(time); } }
[ "public", "void", "flush", "(", "boolean", "durable", ")", "throws", "IOException", "{", "numSync", "++", ";", "long", "start", "=", "System", ".", "nanoTime", "(", ")", ";", "flushAndSync", "(", "durable", ")", ";", "long", "time", "=", "DFSUtil", ".", ...
Flush data to persistent store. Collect sync metrics.
[ "Flush", "data", "to", "persistent", "store", ".", "Collect", "sync", "metrics", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/EditLogOutputStream.java#L112-L121
119,450
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/RawLocalFileSystem.java
RawLocalFileSystem.setOwner
@Override public void setOwner(Path p, String username, String groupname ) throws IOException { if (username == null && groupname == null) { throw new IOException("username == null && groupname == null"); } if (username == null) { execCommand(pathToFile(p), Shell.SET_GROUP_COMMAND, grou...
java
@Override public void setOwner(Path p, String username, String groupname ) throws IOException { if (username == null && groupname == null) { throw new IOException("username == null && groupname == null"); } if (username == null) { execCommand(pathToFile(p), Shell.SET_GROUP_COMMAND, grou...
[ "@", "Override", "public", "void", "setOwner", "(", "Path", "p", ",", "String", "username", ",", "String", "groupname", ")", "throws", "IOException", "{", "if", "(", "username", "==", "null", "&&", "groupname", "==", "null", ")", "{", "throw", "new", "IO...
Use the command chown to set owner.
[ "Use", "the", "command", "chown", "to", "set", "owner", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/RawLocalFileSystem.java#L517-L531
119,451
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/RawLocalFileSystem.java
RawLocalFileSystem.setPermission
@Override public void setPermission(Path p, FsPermission permission ) throws IOException { FsAction user = permission.getUserAction(); FsAction group = permission.getGroupAction(); FsAction other = permission.getOtherAction(); File f = pathToFile(p); // Fork chmod if group and othe...
java
@Override public void setPermission(Path p, FsPermission permission ) throws IOException { FsAction user = permission.getUserAction(); FsAction group = permission.getGroupAction(); FsAction other = permission.getOtherAction(); File f = pathToFile(p); // Fork chmod if group and othe...
[ "@", "Override", "public", "void", "setPermission", "(", "Path", "p", ",", "FsPermission", "permission", ")", "throws", "IOException", "{", "FsAction", "user", "=", "permission", ".", "getUserAction", "(", ")", ";", "FsAction", "group", "=", "permission", ".",...
Use the command chmod to set permission.
[ "Use", "the", "command", "chmod", "to", "set", "permission", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/RawLocalFileSystem.java#L536-L576
119,452
facebookarchive/hadoop-20
src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/OfflineAnonymizer.java
OfflineAnonymizer.anonymize
public void anonymize() throws Exception { EventRecord er = null; SerializedRecord sr = null; BufferedWriter bfw = new BufferedWriter(new FileWriter(logfile.getName() + ".anonymized")); System.out.println("Anonymizing log records..."); while ((er = parser.getNext()) != null) { if (er...
java
public void anonymize() throws Exception { EventRecord er = null; SerializedRecord sr = null; BufferedWriter bfw = new BufferedWriter(new FileWriter(logfile.getName() + ".anonymized")); System.out.println("Anonymizing log records..."); while ((er = parser.getNext()) != null) { if (er...
[ "public", "void", "anonymize", "(", ")", "throws", "Exception", "{", "EventRecord", "er", "=", "null", ";", "SerializedRecord", "sr", "=", "null", ";", "BufferedWriter", "bfw", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "logfile", ".", "get...
Performs anonymization for the log file. Log entries are read one by one and EventRecords are created, which are then anonymized and written to the output.
[ "Performs", "anonymization", "for", "the", "log", "file", ".", "Log", "entries", "are", "read", "one", "by", "one", "and", "EventRecords", "are", "created", "which", "are", "then", "anonymized", "and", "written", "to", "the", "output", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/OfflineAnonymizer.java#L75-L100
119,453
facebookarchive/hadoop-20
src/examples/org/apache/hadoop/examples/dancing/OneSidedPentomino.java
OneSidedPentomino.initializePieces
protected void initializePieces() { pieces.add(new Piece("x", " x /xxx/ x ", false, oneRotation)); pieces.add(new Piece("v", "x /x /xxx", false, fourRotations)); pieces.add(new Piece("t", "xxx/ x / x ", false, fourRotations)); pieces.add(new Piece("w", " x/ xx/xx ", false, fourRotations)); pieces...
java
protected void initializePieces() { pieces.add(new Piece("x", " x /xxx/ x ", false, oneRotation)); pieces.add(new Piece("v", "x /x /xxx", false, fourRotations)); pieces.add(new Piece("t", "xxx/ x / x ", false, fourRotations)); pieces.add(new Piece("w", " x/ xx/xx ", false, fourRotations)); pieces...
[ "protected", "void", "initializePieces", "(", ")", "{", "pieces", ".", "add", "(", "new", "Piece", "(", "\"x\"", ",", "\" x /xxx/ x \"", ",", "false", ",", "oneRotation", ")", ")", ";", "pieces", ".", "add", "(", "new", "Piece", "(", "\"v\"", ",", "\"x...
Define the one sided pieces. The flipped pieces have the same name with a capital letter.
[ "Define", "the", "one", "sided", "pieces", ".", "The", "flipped", "pieces", "have", "the", "same", "name", "with", "a", "capital", "letter", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/OneSidedPentomino.java#L39-L58
119,454
facebookarchive/hadoop-20
src/examples/org/apache/hadoop/examples/dancing/OneSidedPentomino.java
OneSidedPentomino.main
public static void main(String[] args) { Pentomino model = new OneSidedPentomino(3, 30); int solutions = model.solve(); System.out.println(solutions + " solutions found."); }
java
public static void main(String[] args) { Pentomino model = new OneSidedPentomino(3, 30); int solutions = model.solve(); System.out.println(solutions + " solutions found."); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "Pentomino", "model", "=", "new", "OneSidedPentomino", "(", "3", ",", "30", ")", ";", "int", "solutions", "=", "model", ".", "solve", "(", ")", ";", "System", ".", "out", ...
Solve the 3x30 puzzle. @param args
[ "Solve", "the", "3x30", "puzzle", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/OneSidedPentomino.java#L64-L68
119,455
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaStateUpdate.java
CoronaStateUpdate.get
private <T> T get(Class<T> clazz) { try { return clazz.cast(get()); } catch (ClassCastException e) { return null; } }
java
private <T> T get(Class<T> clazz) { try { return clazz.cast(get()); } catch (ClassCastException e) { return null; } }
[ "private", "<", "T", ">", "T", "get", "(", "Class", "<", "T", ">", "clazz", ")", "{", "try", "{", "return", "clazz", ".", "cast", "(", "get", "(", ")", ")", ";", "}", "catch", "(", "ClassCastException", "e", ")", "{", "return", "null", ";", "}"...
Returns enclosed object casted on given class, if enclosed object is not instance of given class returns null. @param clazz class to cast on @return casted object or null
[ "Returns", "enclosed", "object", "casted", "on", "given", "class", "if", "enclosed", "object", "is", "not", "instance", "of", "given", "class", "returns", "null", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaStateUpdate.java#L48-L54
119,456
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaStateUpdate.java
CoronaStateUpdate.getTaskStatus
public TaskStatus getTaskStatus() { TaskStatusUpdate update = get(TaskStatusUpdate.class); if (update == null) { return null; } return update.getStatus(); }
java
public TaskStatus getTaskStatus() { TaskStatusUpdate update = get(TaskStatusUpdate.class); if (update == null) { return null; } return update.getStatus(); }
[ "public", "TaskStatus", "getTaskStatus", "(", ")", "{", "TaskStatusUpdate", "update", "=", "get", "(", "TaskStatusUpdate", ".", "class", ")", ";", "if", "(", "update", "==", "null", ")", "{", "return", "null", ";", "}", "return", "update", ".", "getStatus"...
Returns TaskStatus if this update carries one, null otherwise
[ "Returns", "TaskStatus", "if", "this", "update", "carries", "one", "null", "otherwise" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaStateUpdate.java#L57-L63
119,457
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/lib/aggregate/UniqValueCount.java
UniqValueCount.setMaxItems
public long setMaxItems(long n) { if (n >= numItems) { this.maxNumItems = n; } else if (this.maxNumItems >= this.numItems) { this.maxNumItems = this.numItems; } return this.maxNumItems; }
java
public long setMaxItems(long n) { if (n >= numItems) { this.maxNumItems = n; } else if (this.maxNumItems >= this.numItems) { this.maxNumItems = this.numItems; } return this.maxNumItems; }
[ "public", "long", "setMaxItems", "(", "long", "n", ")", "{", "if", "(", "n", ">=", "numItems", ")", "{", "this", ".", "maxNumItems", "=", "n", ";", "}", "else", "if", "(", "this", ".", "maxNumItems", ">=", "this", ".", "numItems", ")", "{", "this",...
Set the limit on the number of unique values @param n the desired limit on the number of unique values @return the new limit on the number of unique values
[ "Set", "the", "limit", "on", "the", "number", "of", "unique", "values" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/aggregate/UniqValueCount.java#L65-L72
119,458
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/PendingReplicationBlocks.java
PendingReplicationBlocks.add
void add(BlockInfo block, int numReplicas) { synchronized (pendingReplications) { PendingBlockInfo found = pendingReplications.get(block); if (found == null) { pendingReplications.put(block, new PendingBlockInfo(numReplicas)); } else { found.incrementReplicas(numReplicas); ...
java
void add(BlockInfo block, int numReplicas) { synchronized (pendingReplications) { PendingBlockInfo found = pendingReplications.get(block); if (found == null) { pendingReplications.put(block, new PendingBlockInfo(numReplicas)); } else { found.incrementReplicas(numReplicas); ...
[ "void", "add", "(", "BlockInfo", "block", ",", "int", "numReplicas", ")", "{", "synchronized", "(", "pendingReplications", ")", "{", "PendingBlockInfo", "found", "=", "pendingReplications", ".", "get", "(", "block", ")", ";", "if", "(", "found", "==", "null"...
Add a block to the list of pending Replications
[ "Add", "a", "block", "to", "the", "list", "of", "pending", "Replications" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/PendingReplicationBlocks.java#L89-L99
119,459
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/PendingReplicationBlocks.java
PendingReplicationBlocks.remove
void remove(Block block) { synchronized (pendingReplications) { PendingBlockInfo found = pendingReplications.get(block); if (found != null) { if (FSNamesystem.LOG.isDebugEnabled()) { FSNamesystem.LOG.debug( "Removing pending replication for block" + block); } ...
java
void remove(Block block) { synchronized (pendingReplications) { PendingBlockInfo found = pendingReplications.get(block); if (found != null) { if (FSNamesystem.LOG.isDebugEnabled()) { FSNamesystem.LOG.debug( "Removing pending replication for block" + block); } ...
[ "void", "remove", "(", "Block", "block", ")", "{", "synchronized", "(", "pendingReplications", ")", "{", "PendingBlockInfo", "found", "=", "pendingReplications", ".", "get", "(", "block", ")", ";", "if", "(", "found", "!=", "null", ")", "{", "if", "(", "...
One replication request for this block has finished. Decrement the number of pending replication requests for this block.
[ "One", "replication", "request", "for", "this", "block", "has", "finished", ".", "Decrement", "the", "number", "of", "pending", "replication", "requests", "for", "this", "block", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/PendingReplicationBlocks.java#L106-L120
119,460
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/PendingReplicationBlocks.java
PendingReplicationBlocks.getNumReplicas
int getNumReplicas(Block block) { synchronized (pendingReplications) { PendingBlockInfo found = pendingReplications.get(block); if (found != null) { return found.getNumReplicas(); } } return 0; }
java
int getNumReplicas(Block block) { synchronized (pendingReplications) { PendingBlockInfo found = pendingReplications.get(block); if (found != null) { return found.getNumReplicas(); } } return 0; }
[ "int", "getNumReplicas", "(", "Block", "block", ")", "{", "synchronized", "(", "pendingReplications", ")", "{", "PendingBlockInfo", "found", "=", "pendingReplications", ".", "get", "(", "block", ")", ";", "if", "(", "found", "!=", "null", ")", "{", "return",...
How many copies of this block is pending replication?
[ "How", "many", "copies", "of", "this", "block", "is", "pending", "replication?" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/PendingReplicationBlocks.java#L132-L140
119,461
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/PendingReplicationBlocks.java
PendingReplicationBlocks.getTimedOutBlocks
BlockInfo[] getTimedOutBlocks() { synchronized (timedOutItems) { if (timedOutItems.size() <= 0) { return null; } BlockInfo[] blockList = timedOutItems.toArray( new BlockInfo[timedOutItems.size()]); timedOutItems.clear(); return blockList; } }
java
BlockInfo[] getTimedOutBlocks() { synchronized (timedOutItems) { if (timedOutItems.size() <= 0) { return null; } BlockInfo[] blockList = timedOutItems.toArray( new BlockInfo[timedOutItems.size()]); timedOutItems.clear(); return blockList; } }
[ "BlockInfo", "[", "]", "getTimedOutBlocks", "(", ")", "{", "synchronized", "(", "timedOutItems", ")", "{", "if", "(", "timedOutItems", ".", "size", "(", ")", "<=", "0", ")", "{", "return", "null", ";", "}", "BlockInfo", "[", "]", "blockList", "=", "tim...
Returns a list of blocks that have timed out their replication requests. Returns null if no blocks have timed out.
[ "Returns", "a", "list", "of", "blocks", "that", "have", "timed", "out", "their", "replication", "requests", ".", "Returns", "null", "if", "no", "blocks", "have", "timed", "out", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/PendingReplicationBlocks.java#L147-L157
119,462
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/ReadaheadPool.java
ReadaheadPool.getInstance
public static ReadaheadPool getInstance() { synchronized (ReadaheadPool.class) { if (instance == null && NativeIO.isAvailable()) { instance = new ReadaheadPool(); } return instance; } }
java
public static ReadaheadPool getInstance() { synchronized (ReadaheadPool.class) { if (instance == null && NativeIO.isAvailable()) { instance = new ReadaheadPool(); } return instance; } }
[ "public", "static", "ReadaheadPool", "getInstance", "(", ")", "{", "synchronized", "(", "ReadaheadPool", ".", "class", ")", "{", "if", "(", "instance", "==", "null", "&&", "NativeIO", ".", "isAvailable", "(", ")", ")", "{", "instance", "=", "new", "Readahe...
Return the singleton instance for the current process.
[ "Return", "the", "singleton", "instance", "for", "the", "current", "process", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/ReadaheadPool.java#L48-L55
119,463
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/ReadaheadPool.java
ReadaheadPool.readaheadStream
public ReadaheadRequest readaheadStream( String identifier, FileDescriptor fd, long curPos, long readaheadLength, long maxOffsetToRead, ReadaheadRequest lastReadahead) { Preconditions.checkArgument(curPos <= maxOffsetToRead, "Readahead position %s higher than maxOffs...
java
public ReadaheadRequest readaheadStream( String identifier, FileDescriptor fd, long curPos, long readaheadLength, long maxOffsetToRead, ReadaheadRequest lastReadahead) { Preconditions.checkArgument(curPos <= maxOffsetToRead, "Readahead position %s higher than maxOffs...
[ "public", "ReadaheadRequest", "readaheadStream", "(", "String", "identifier", ",", "FileDescriptor", "fd", ",", "long", "curPos", ",", "long", "readaheadLength", ",", "long", "maxOffsetToRead", ",", "ReadaheadRequest", "lastReadahead", ")", "{", "Preconditions", ".", ...
Issue a request to readahead on the given file descriptor. @param identifier a textual identifier that will be used in error messages (e.g. the file name) @param fd the file descriptor to read ahead @param curPos the current offset at which reads are being issued @param readaheadLength the configured length to read ah...
[ "Issue", "a", "request", "to", "readahead", "on", "the", "given", "file", "descriptor", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/ReadaheadPool.java#L85-L132
119,464
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/ReadaheadPool.java
ReadaheadPool.submitReadahead
public ReadaheadRequest submitReadahead( String identifier, FileDescriptor fd, long off, long len) { ReadaheadRequestImpl req = new ReadaheadRequestImpl( identifier, fd, off, len); pool.execute(req); if (LOG.isTraceEnabled()) { LOG.trace("submit readahead: " + req); } return req;...
java
public ReadaheadRequest submitReadahead( String identifier, FileDescriptor fd, long off, long len) { ReadaheadRequestImpl req = new ReadaheadRequestImpl( identifier, fd, off, len); pool.execute(req); if (LOG.isTraceEnabled()) { LOG.trace("submit readahead: " + req); } return req;...
[ "public", "ReadaheadRequest", "submitReadahead", "(", "String", "identifier", ",", "FileDescriptor", "fd", ",", "long", "off", ",", "long", "len", ")", "{", "ReadaheadRequestImpl", "req", "=", "new", "ReadaheadRequestImpl", "(", "identifier", ",", "fd", ",", "of...
Submit a request to readahead on the given file descriptor. @param identifier a textual identifier used in error messages, etc. @param fd the file descriptor to readahead @param off the offset at which to start the readahead @param len the number of bytes to read @return an object representing this pending request
[ "Submit", "a", "request", "to", "readahead", "on", "the", "given", "file", "descriptor", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/ReadaheadPool.java#L142-L151
119,465
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/StatisticsCollector.java
StatisticsCollector.getSaving
public long getSaving() { if (lastRaidStatistics == null) { return -1; } long saving = 0; for (Codec codec : Codec.getCodecs()) { String code = codec.id; long s = lastRaidStatistics.get(code).getSaving(conf); if (s == -1) { return -1; } saving += s; } ...
java
public long getSaving() { if (lastRaidStatistics == null) { return -1; } long saving = 0; for (Codec codec : Codec.getCodecs()) { String code = codec.id; long s = lastRaidStatistics.get(code).getSaving(conf); if (s == -1) { return -1; } saving += s; } ...
[ "public", "long", "getSaving", "(", ")", "{", "if", "(", "lastRaidStatistics", "==", "null", ")", "{", "return", "-", "1", ";", "}", "long", "saving", "=", "0", ";", "for", "(", "Codec", "codec", ":", "Codec", ".", "getCodecs", "(", ")", ")", "{", ...
Get the total RAID saving in bytes @return Number of bytes saved due to RAID
[ "Get", "the", "total", "RAID", "saving", "in", "bytes" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/StatisticsCollector.java#L203-L217
119,466
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/StatisticsCollector.java
StatisticsCollector.populateSaving
public void populateSaving(RaidNodeMetrics metrics) { if (lastRaidStatistics == null) { return; } long saving = 0; for (Codec codec : Codec.getCodecs()) { String code = codec.id; long s = lastRaidStatistics.get(code).getSaving(conf); if (s > 0) { metrics.savingForCode.get...
java
public void populateSaving(RaidNodeMetrics metrics) { if (lastRaidStatistics == null) { return; } long saving = 0; for (Codec codec : Codec.getCodecs()) { String code = codec.id; long s = lastRaidStatistics.get(code).getSaving(conf); if (s > 0) { metrics.savingForCode.get...
[ "public", "void", "populateSaving", "(", "RaidNodeMetrics", "metrics", ")", "{", "if", "(", "lastRaidStatistics", "==", "null", ")", "{", "return", ";", "}", "long", "saving", "=", "0", ";", "for", "(", "Codec", "codec", ":", "Codec", ".", "getCodecs", "...
Populate RAID savings by code and total. @return Number of bytes saved due to RAID
[ "Populate", "RAID", "savings", "by", "code", "and", "total", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/StatisticsCollector.java#L223-L239
119,467
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/StatisticsCollector.java
StatisticsCollector.sortPathByDepth
private void sortPathByDepth(Path[] paths) { Arrays.sort(paths, new Comparator<Path> (){ @Override public int compare(Path o1, Path o2) { return ((Integer)o1.depth()).compareTo(o2.depth()); }}); }
java
private void sortPathByDepth(Path[] paths) { Arrays.sort(paths, new Comparator<Path> (){ @Override public int compare(Path o1, Path o2) { return ((Integer)o1.depth()).compareTo(o2.depth()); }}); }
[ "private", "void", "sortPathByDepth", "(", "Path", "[", "]", "paths", ")", "{", "Arrays", ".", "sort", "(", "paths", ",", "new", "Comparator", "<", "Path", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "Path", "o1", ",", "Path...
Sort the path array by depth @param paths
[ "Sort", "the", "path", "array", "by", "depth" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/StatisticsCollector.java#L385-L391
119,468
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/StatisticsCollector.java
StatisticsCollector.mergeRoots
private List<Path> mergeRoots(Path[] dupRoots) { sortPathByDepth(dupRoots); List<Path> roots = new ArrayList<Path>(); for (Path candidate : dupRoots) { boolean shouldAdd = true; for (Path root : roots) { if (isAncestorPath(root.toUri().getPath(), candidate.toUri().getPa...
java
private List<Path> mergeRoots(Path[] dupRoots) { sortPathByDepth(dupRoots); List<Path> roots = new ArrayList<Path>(); for (Path candidate : dupRoots) { boolean shouldAdd = true; for (Path root : roots) { if (isAncestorPath(root.toUri().getPath(), candidate.toUri().getPa...
[ "private", "List", "<", "Path", ">", "mergeRoots", "(", "Path", "[", "]", "dupRoots", ")", "{", "sortPathByDepth", "(", "dupRoots", ")", ";", "List", "<", "Path", ">", "roots", "=", "new", "ArrayList", "<", "Path", ">", "(", ")", ";", "for", "(", "...
merge the roots, get the top ones. @param dupRoots @return
[ "merge", "the", "roots", "get", "the", "top", "ones", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/StatisticsCollector.java#L398-L417
119,469
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/StatisticsCollector.java
StatisticsCollector.submitRaidJobsWhenPossible
private List<FileStatus> submitRaidJobsWhenPossible(PolicyInfo info, List<FileStatus> filesToRaid, boolean submitAll) { if (!submitRaidJobs || !info.getShouldRaid()) { return filesToRaid; } try { int maxFilesPerJob = configManager.getMaxFilesPerJob(); int maxJobs = configManager.getM...
java
private List<FileStatus> submitRaidJobsWhenPossible(PolicyInfo info, List<FileStatus> filesToRaid, boolean submitAll) { if (!submitRaidJobs || !info.getShouldRaid()) { return filesToRaid; } try { int maxFilesPerJob = configManager.getMaxFilesPerJob(); int maxJobs = configManager.getM...
[ "private", "List", "<", "FileStatus", ">", "submitRaidJobsWhenPossible", "(", "PolicyInfo", "info", ",", "List", "<", "FileStatus", ">", "filesToRaid", ",", "boolean", "submitAll", ")", "{", "if", "(", "!", "submitRaidJobs", "||", "!", "info", ".", "getShouldR...
Raiding a given list of files @param info The Raid policy @param filesToRaid The list of files to raid @param submitAll Should submit the whole list? @return The remaining files to raid
[ "Raiding", "a", "given", "list", "of", "files" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/StatisticsCollector.java#L514-L536
119,470
facebookarchive/hadoop-20
src/core/org/apache/hadoop/security/authorize/ServiceAuthorizationManager.java
ServiceAuthorizationManager.authorize
public static void authorize(Subject user, Class<?> protocol) throws AuthorizationException { Permission permission = protocolToPermissionMap.get(protocol); if (permission == null) { permission = new ConnectionPermission(protocol); protocolToPermissionMap.put(protocol, permission); } ...
java
public static void authorize(Subject user, Class<?> protocol) throws AuthorizationException { Permission permission = protocolToPermissionMap.get(protocol); if (permission == null) { permission = new ConnectionPermission(protocol); protocolToPermissionMap.put(protocol, permission); } ...
[ "public", "static", "void", "authorize", "(", "Subject", "user", ",", "Class", "<", "?", ">", "protocol", ")", "throws", "AuthorizationException", "{", "Permission", "permission", "=", "protocolToPermissionMap", ".", "get", "(", "protocol", ")", ";", "if", "("...
Authorize the user to access the protocol being used. @param user user accessing the service @param protocol service being accessed @throws AuthorizationException on authorization failure
[ "Authorize", "the", "user", "to", "access", "the", "protocol", "being", "used", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/security/authorize/ServiceAuthorizationManager.java#L60-L69
119,471
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.getFinalizedBlockLength
public long getFinalizedBlockLength(int namespaceId, Block b) throws IOException { DatanodeBlockInfo info = volumeMap.get(namespaceId, b); if (info == null) { throw new IOException("Can't find block " + b + " in volumeMap"); } return info.getFinalizedSize(); }
java
public long getFinalizedBlockLength(int namespaceId, Block b) throws IOException { DatanodeBlockInfo info = volumeMap.get(namespaceId, b); if (info == null) { throw new IOException("Can't find block " + b + " in volumeMap"); } return info.getFinalizedSize(); }
[ "public", "long", "getFinalizedBlockLength", "(", "int", "namespaceId", ",", "Block", "b", ")", "throws", "IOException", "{", "DatanodeBlockInfo", "info", "=", "volumeMap", ".", "get", "(", "namespaceId", ",", "b", ")", ";", "if", "(", "info", "==", "null", ...
Find the block's on-disk length
[ "Find", "the", "block", "s", "on", "-", "disk", "length" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L1791-L1797
119,472
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.getBlockFile
public File getBlockFile(int namespaceId, Block b) throws IOException { File f = validateBlockFile(namespaceId, b); if (f == null) { if (InterDatanodeProtocol.LOG.isDebugEnabled()) { InterDatanodeProtocol.LOG .debug("b=" + b + ", volumeMap=" + volumeMap); } throw new IOExce...
java
public File getBlockFile(int namespaceId, Block b) throws IOException { File f = validateBlockFile(namespaceId, b); if (f == null) { if (InterDatanodeProtocol.LOG.isDebugEnabled()) { InterDatanodeProtocol.LOG .debug("b=" + b + ", volumeMap=" + volumeMap); } throw new IOExce...
[ "public", "File", "getBlockFile", "(", "int", "namespaceId", ",", "Block", "b", ")", "throws", "IOException", "{", "File", "f", "=", "validateBlockFile", "(", "namespaceId", ",", "b", ")", ";", "if", "(", "f", "==", "null", ")", "{", "if", "(", "InterD...
Get File name for a given block.
[ "Get", "File", "name", "for", "a", "given", "block", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L1822-L1833
119,473
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.detachBlock
public boolean detachBlock(int namespaceId, Block block, int numLinks) throws IOException { DatanodeBlockInfo info = null; lock.readLock().lock(); try { info = volumeMap.get(namespaceId, block); } finally { lock.readLock().unlock(); } return info.detachBlock(namespaceId, block,...
java
public boolean detachBlock(int namespaceId, Block block, int numLinks) throws IOException { DatanodeBlockInfo info = null; lock.readLock().lock(); try { info = volumeMap.get(namespaceId, block); } finally { lock.readLock().unlock(); } return info.detachBlock(namespaceId, block,...
[ "public", "boolean", "detachBlock", "(", "int", "namespaceId", ",", "Block", "block", ",", "int", "numLinks", ")", "throws", "IOException", "{", "DatanodeBlockInfo", "info", "=", "null", ";", "lock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", ...
Make a copy of the block if this block is linked to an existing snapshot. This ensures that modifying this block does not modify data in any existing snapshots. @param block Block @param numLinks Detach if the number of links exceed this value @throws IOException @return - true if the specified block was detached
[ "Make", "a", "copy", "of", "the", "block", "if", "this", "block", "is", "linked", "to", "an", "existing", "snapshot", ".", "This", "ensures", "that", "modifying", "this", "block", "does", "not", "modify", "data", "in", "any", "existing", "snapshots", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L1844-L1855
119,474
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.interruptAndJoinThreads
private boolean interruptAndJoinThreads(List<Thread> threads) { // interrupt and wait for all ongoing create threads for(Thread t : threads) { t.interrupt(); } for(Thread t : threads) { try { t.join(); } catch (InterruptedException e) { DataNode.LOG.warn("interruptOngoi...
java
private boolean interruptAndJoinThreads(List<Thread> threads) { // interrupt and wait for all ongoing create threads for(Thread t : threads) { t.interrupt(); } for(Thread t : threads) { try { t.join(); } catch (InterruptedException e) { DataNode.LOG.warn("interruptOngoi...
[ "private", "boolean", "interruptAndJoinThreads", "(", "List", "<", "Thread", ">", "threads", ")", "{", "// interrupt and wait for all ongoing create threads", "for", "(", "Thread", "t", ":", "threads", ")", "{", "t", ".", "interrupt", "(", ")", ";", "}", "for", ...
Try to interrupt all of the given threads, and join on them. If interrupted, returns false, indicating some threads may still be running.
[ "Try", "to", "interrupt", "all", "of", "the", "given", "threads", "and", "join", "on", "them", ".", "If", "interrupted", "returns", "false", "indicating", "some", "threads", "may", "still", "be", "running", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L1897-L1911
119,475
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.getActiveThreads
private ArrayList<Thread> getActiveThreads(int namespaceId, Block block) { lock.writeLock().lock(); try { //check ongoing create threads final ActiveFile activefile = volumeMap.getOngoingCreates(namespaceId, block); if (activefile != null && !activefile.threads.isEmpty()) { //remove de...
java
private ArrayList<Thread> getActiveThreads(int namespaceId, Block block) { lock.writeLock().lock(); try { //check ongoing create threads final ActiveFile activefile = volumeMap.getOngoingCreates(namespaceId, block); if (activefile != null && !activefile.threads.isEmpty()) { //remove de...
[ "private", "ArrayList", "<", "Thread", ">", "getActiveThreads", "(", "int", "namespaceId", ",", "Block", "block", ")", "{", "lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "//check ongoing create threads", "final", "ActiveFile", "...
Return a list of active writer threads for the given block. @return null if there are no such threads or the file is not being created
[ "Return", "a", "list", "of", "active", "writer", "threads", "for", "the", "given", "block", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L1919-L1942
119,476
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.isBlockFinalizedWithLock
private boolean isBlockFinalizedWithLock(int namespaceId, Block b) { lock.readLock().lock(); try { return isBlockFinalizedInternal(namespaceId, b, true); } finally { lock.readLock().unlock(); } }
java
private boolean isBlockFinalizedWithLock(int namespaceId, Block b) { lock.readLock().lock(); try { return isBlockFinalizedInternal(namespaceId, b, true); } finally { lock.readLock().unlock(); } }
[ "private", "boolean", "isBlockFinalizedWithLock", "(", "int", "namespaceId", ",", "Block", "b", ")", "{", "lock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "return", "isBlockFinalizedInternal", "(", "namespaceId", ",", "b", ",", "t...
is this block finalized? Returns true if the block is already finalized, otherwise returns false.
[ "is", "this", "block", "finalized?", "Returns", "true", "if", "the", "block", "is", "already", "finalized", "otherwise", "returns", "false", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L2418-L2425
119,477
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.delBlockFromDisk
private boolean delBlockFromDisk(File blockFile, File metaFile, Block b) { if (blockFile == null) { DataNode.LOG.warn("No file exists for block: " + b); return true; } if (!blockFile.delete()) { DataNode.LOG.warn("Not able to delete the block file: " + blockFile); return false; ...
java
private boolean delBlockFromDisk(File blockFile, File metaFile, Block b) { if (blockFile == null) { DataNode.LOG.warn("No file exists for block: " + b); return true; } if (!blockFile.delete()) { DataNode.LOG.warn("Not able to delete the block file: " + blockFile); return false; ...
[ "private", "boolean", "delBlockFromDisk", "(", "File", "blockFile", ",", "File", "metaFile", ",", "Block", "b", ")", "{", "if", "(", "blockFile", "==", "null", ")", "{", "DataNode", ".", "LOG", ".", "warn", "(", "\"No file exists for block: \"", "+", "b", ...
Remove a block from disk @param blockFile block file @param metaFile block meta file @param b a block @return true if on-disk files are deleted; false otherwise
[ "Remove", "a", "block", "from", "disk" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L2461-L2478
119,478
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.getBlocksBeingWrittenReport
public Block[] getBlocksBeingWrittenReport(int namespaceId) throws IOException { LightWeightHashSet<Block> blockSet = new LightWeightHashSet<Block>(); volumes.getBlocksBeingWrittenInfo(namespaceId, blockSet); Block blockTable[] = new Block[blockSet.size()]; int i = 0; for (Iterator<Block> it = blo...
java
public Block[] getBlocksBeingWrittenReport(int namespaceId) throws IOException { LightWeightHashSet<Block> blockSet = new LightWeightHashSet<Block>(); volumes.getBlocksBeingWrittenInfo(namespaceId, blockSet); Block blockTable[] = new Block[blockSet.size()]; int i = 0; for (Iterator<Block> it = blo...
[ "public", "Block", "[", "]", "getBlocksBeingWrittenReport", "(", "int", "namespaceId", ")", "throws", "IOException", "{", "LightWeightHashSet", "<", "Block", ">", "blockSet", "=", "new", "LightWeightHashSet", "<", "Block", ">", "(", ")", ";", "volumes", ".", "...
Return a table of blocks being written data @throws IOException
[ "Return", "a", "table", "of", "blocks", "being", "written", "data" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L2484-L2493
119,479
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.getBlockReport
public Block[] getBlockReport(int namespaceId) throws IOException { ArrayList<Block> ret = new ArrayList<Block>(); org.apache.hadoop.hdfs.server.datanode.NamespaceMap nm = volumeMap .getNamespaceMap(namespaceId); if (nm == null) { return new Block[0]; } int n = nm.getNumBucket(); f...
java
public Block[] getBlockReport(int namespaceId) throws IOException { ArrayList<Block> ret = new ArrayList<Block>(); org.apache.hadoop.hdfs.server.datanode.NamespaceMap nm = volumeMap .getNamespaceMap(namespaceId); if (nm == null) { return new Block[0]; } int n = nm.getNumBucket(); f...
[ "public", "Block", "[", "]", "getBlockReport", "(", "int", "namespaceId", ")", "throws", "IOException", "{", "ArrayList", "<", "Block", ">", "ret", "=", "new", "ArrayList", "<", "Block", ">", "(", ")", ";", "org", ".", "apache", ".", "hadoop", ".", "hd...
Get the list of finalized blocks from in-memory blockmap for a block pool.
[ "Get", "the", "list", "of", "finalized", "blocks", "from", "in", "-", "memory", "blockmap", "for", "a", "block", "pool", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L2498-L2511
119,480
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.isValidBlock
public boolean isValidBlock(int namespaceId, Block b, boolean checkSize) throws IOException { File f = null; ; try { f = getValidateBlockFile(namespaceId, b, checkSize); } catch (IOException e) { DataNode.LOG.warn("Block " + b + " is not valid:", e); } return ((f != null) ? is...
java
public boolean isValidBlock(int namespaceId, Block b, boolean checkSize) throws IOException { File f = null; ; try { f = getValidateBlockFile(namespaceId, b, checkSize); } catch (IOException e) { DataNode.LOG.warn("Block " + b + " is not valid:", e); } return ((f != null) ? is...
[ "public", "boolean", "isValidBlock", "(", "int", "namespaceId", ",", "Block", "b", ",", "boolean", "checkSize", ")", "throws", "IOException", "{", "File", "f", "=", "null", ";", ";", "try", "{", "f", "=", "getValidateBlockFile", "(", "namespaceId", ",", "b...
Check whether the given block is a valid one.
[ "Check", "whether", "the", "given", "block", "is", "a", "valid", "one", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L2516-L2527
119,481
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.getFile
public File getFile(int namespaceId, Block b) { lock.readLock().lock(); try { DatanodeBlockInfo info = volumeMap.get(namespaceId, b); if (info != null) { return info.getDataFileToRead(); } return null; } finally { lock.readLock().unlock(); } }
java
public File getFile(int namespaceId, Block b) { lock.readLock().lock(); try { DatanodeBlockInfo info = volumeMap.get(namespaceId, b); if (info != null) { return info.getDataFileToRead(); } return null; } finally { lock.readLock().unlock(); } }
[ "public", "File", "getFile", "(", "int", "namespaceId", ",", "Block", "b", ")", "{", "lock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "DatanodeBlockInfo", "info", "=", "volumeMap", ".", "get", "(", "namespaceId", ",", "b", "...
Turn the block identifier into a filename.
[ "Turn", "the", "block", "identifier", "into", "a", "filename", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L2791-L2802
119,482
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.checkDataDir
public void checkDataDir() throws DiskErrorException { long total_blocks=0, removed_blocks=0; List<FSVolume> failed_vols = null; failed_vols = volumes.checkDirs(); //if there no failed volumes return if(failed_vols == null) return; // else // remove related blocks long mls...
java
public void checkDataDir() throws DiskErrorException { long total_blocks=0, removed_blocks=0; List<FSVolume> failed_vols = null; failed_vols = volumes.checkDirs(); //if there no failed volumes return if(failed_vols == null) return; // else // remove related blocks long mls...
[ "public", "void", "checkDataDir", "(", ")", "throws", "DiskErrorException", "{", "long", "total_blocks", "=", "0", ",", "removed_blocks", "=", "0", ";", "List", "<", "FSVolume", ">", "failed_vols", "=", "null", ";", "failed_vols", "=", "volumes", ".", "check...
check if a data directory is healthy if some volumes failed - make sure to remove all the blocks that belong to these volumes @throws DiskErrorException
[ "check", "if", "a", "data", "directory", "is", "healthy", "if", "some", "volumes", "failed", "-", "make", "sure", "to", "remove", "all", "the", "blocks", "that", "belong", "to", "these", "volumes" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L2835-L2866
119,483
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.removeVolumes
public void removeVolumes(Configuration conf, List<File> directories) throws Exception { if (directories == null || directories.isEmpty()) { DataNode.LOG.warn("There were no directories to remove. Exiting "); return; } List<FSVolume> volArray = null; lock.readLock().lock(); try { ...
java
public void removeVolumes(Configuration conf, List<File> directories) throws Exception { if (directories == null || directories.isEmpty()) { DataNode.LOG.warn("There were no directories to remove. Exiting "); return; } List<FSVolume> volArray = null; lock.readLock().lock(); try { ...
[ "public", "void", "removeVolumes", "(", "Configuration", "conf", ",", "List", "<", "File", ">", "directories", ")", "throws", "Exception", "{", "if", "(", "directories", "==", "null", "||", "directories", ".", "isEmpty", "(", ")", ")", "{", "DataNode", "."...
remove directories that are given from the list of volumes to use. This function also makes sure to remove all the blocks that belong to these volumes.
[ "remove", "directories", "that", "are", "given", "from", "the", "list", "of", "volumes", "to", "use", ".", "This", "function", "also", "makes", "sure", "to", "remove", "all", "the", "blocks", "that", "belong", "to", "these", "volumes", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L2873-L2902
119,484
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.copyFile
public void copyFile(File src, File dst, boolean hardlink) throws IOException { if (src == null || dst == null) { throw new IOException("src/dst file is null"); } try { if (hardlink && shouldHardLinkBlockCopy) { // Remove destination before hard linking, since this file might already ...
java
public void copyFile(File src, File dst, boolean hardlink) throws IOException { if (src == null || dst == null) { throw new IOException("src/dst file is null"); } try { if (hardlink && shouldHardLinkBlockCopy) { // Remove destination before hard linking, since this file might already ...
[ "public", "void", "copyFile", "(", "File", "src", ",", "File", "dst", ",", "boolean", "hardlink", ")", "throws", "IOException", "{", "if", "(", "src", "==", "null", "||", "dst", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"src/dst file ...
Copies a file as fast as possible. Tries to do a hardlink instead of a copy if the hardlink parameter is specified. @param src the source file for copying @param dst the destination file for copying @param hardlink whether or not to attempt a hardlink @throws IOException
[ "Copies", "a", "file", "as", "fast", "as", "possible", ".", "Tries", "to", "do", "a", "hardlink", "instead", "of", "a", "copy", "if", "the", "hardlink", "parameter", "is", "specified", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L3134-L3187
119,485
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.findVolumeForHardLink
private FSVolume findVolumeForHardLink(String srcFileSystem, int srcNamespaceId, Block srcBlock, File srcBlockFile) throws IOException { FSVolume dstVol = null; if (srcBlockFile == null || !srcBlockFile.exists()) { throw new IOException("File " + srcBlockFile + " is not valid or does n...
java
private FSVolume findVolumeForHardLink(String srcFileSystem, int srcNamespaceId, Block srcBlock, File srcBlockFile) throws IOException { FSVolume dstVol = null; if (srcBlockFile == null || !srcBlockFile.exists()) { throw new IOException("File " + srcBlockFile + " is not valid or does n...
[ "private", "FSVolume", "findVolumeForHardLink", "(", "String", "srcFileSystem", ",", "int", "srcNamespaceId", ",", "Block", "srcBlock", ",", "File", "srcBlockFile", ")", "throws", "IOException", "{", "FSVolume", "dstVol", "=", "null", ";", "if", "(", "srcBlockFile...
Find a volume on the datanode for the destination block to be placed on. It tries to place the destination block on the same volume as the source block since hardlinks can be performed only between two files on the same disk @param srcFileSystem the file system for srcBlockFile @param srcNamespaceId the namespace id f...
[ "Find", "a", "volume", "on", "the", "datanode", "for", "the", "destination", "block", "to", "be", "placed", "on", ".", "It", "tries", "to", "place", "the", "destination", "block", "on", "the", "same", "volume", "as", "the", "source", "block", "since", "h...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L3207-L3233
119,486
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.copyBlockLocalAdd
private boolean copyBlockLocalAdd(String srcFileSystem, File srcBlockFile, int srcNamespaceId, Block srcBlock, int dstNamespaceId, Block dstBlock) throws IOException { boolean hardlink = true; File dstBlockFile = null; lock.writeLock().lock(); try { if (isValidBlock(dstNamespaceId, dst...
java
private boolean copyBlockLocalAdd(String srcFileSystem, File srcBlockFile, int srcNamespaceId, Block srcBlock, int dstNamespaceId, Block dstBlock) throws IOException { boolean hardlink = true; File dstBlockFile = null; lock.writeLock().lock(); try { if (isValidBlock(dstNamespaceId, dst...
[ "private", "boolean", "copyBlockLocalAdd", "(", "String", "srcFileSystem", ",", "File", "srcBlockFile", ",", "int", "srcNamespaceId", ",", "Block", "srcBlock", ",", "int", "dstNamespaceId", ",", "Block", "dstBlock", ")", "throws", "IOException", "{", "boolean", "h...
Finds a volume for the dstBlock and adds the new block to the FSDataset data structures to indicate we are going to start writing to the block. @param srcFileSystem the file system for srcBlockFile @param srcBlockFile the block file for the srcBlock @param srcNamespaceId the namespace id for source block @param srcBlo...
[ "Finds", "a", "volume", "for", "the", "dstBlock", "and", "adds", "the", "new", "block", "to", "the", "FSDataset", "data", "structures", "to", "indicate", "we", "are", "going", "to", "start", "writing", "to", "the", "block", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L3255-L3318
119,487
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.copyBlockLocalFinalize
private void copyBlockLocalFinalize(int dstNamespaceId, Block dstBlock, File dstBlockFile) throws IOException { boolean inlineChecksum = Block.isInlineChecksumBlockFilename(dstBlockFile .getName()); long blkSize = 0; long fileSize = dstBlockFile.length(); lock.writeLock().lock(); t...
java
private void copyBlockLocalFinalize(int dstNamespaceId, Block dstBlock, File dstBlockFile) throws IOException { boolean inlineChecksum = Block.isInlineChecksumBlockFilename(dstBlockFile .getName()); long blkSize = 0; long fileSize = dstBlockFile.length(); lock.writeLock().lock(); t...
[ "private", "void", "copyBlockLocalFinalize", "(", "int", "dstNamespaceId", ",", "Block", "dstBlock", ",", "File", "dstBlockFile", ")", "throws", "IOException", "{", "boolean", "inlineChecksum", "=", "Block", ".", "isInlineChecksumBlockFilename", "(", "dstBlockFile", "...
Finalize the block in FSDataset. @param dstNamespaceId the namespace id for dstBlock @param dstBlock the block that needs to be finalized @param dstBlockFile the block file for the block that has to be finalized @throws IOException
[ "Finalize", "the", "block", "in", "FSDataset", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L3331-L3363
119,488
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java
DFSUtil.byteArray2String
public static String byteArray2String(byte[][] pathComponents) { if (pathComponents.length == 0) return ""; if (pathComponents.length == 1 && pathComponents[0].length == 0) { return Path.SEPARATOR; } StringBuilder result = new StringBuilder(); for (int i = 0; i < pathComponents.length; ...
java
public static String byteArray2String(byte[][] pathComponents) { if (pathComponents.length == 0) return ""; if (pathComponents.length == 1 && pathComponents[0].length == 0) { return Path.SEPARATOR; } StringBuilder result = new StringBuilder(); for (int i = 0; i < pathComponents.length; ...
[ "public", "static", "String", "byteArray2String", "(", "byte", "[", "]", "[", "]", "pathComponents", ")", "{", "if", "(", "pathComponents", ".", "length", "==", "0", ")", "return", "\"\"", ";", "if", "(", "pathComponents", ".", "length", "==", "1", "&&",...
Given a list of path components returns a path as a UTF8 String
[ "Given", "a", "list", "of", "path", "components", "returns", "a", "path", "as", "a", "UTF8", "String" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L98-L116
119,489
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java
DFSUtil.bytes2String
public static String bytes2String(byte[] bytes) { try { final int len = bytes.length; char[] charArray = UTF8.getCharArray(len); for (int i = 0; i < bytes.length; i++) { if (bytes[i] < UTF8.MIN_ASCII_CODE) { // non-ASCII codepoints' higher bytes // are of the form (10xx...
java
public static String bytes2String(byte[] bytes) { try { final int len = bytes.length; char[] charArray = UTF8.getCharArray(len); for (int i = 0; i < bytes.length; i++) { if (bytes[i] < UTF8.MIN_ASCII_CODE) { // non-ASCII codepoints' higher bytes // are of the form (10xx...
[ "public", "static", "String", "bytes2String", "(", "byte", "[", "]", "bytes", ")", "{", "try", "{", "final", "int", "len", "=", "bytes", ".", "length", ";", "char", "[", "]", "charArray", "=", "UTF8", ".", "getCharArray", "(", "len", ")", ";", "for",...
Converts a byte array to a string using UTF8 encoding.
[ "Converts", "a", "byte", "array", "to", "a", "string", "using", "UTF8", "encoding", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L133-L155
119,490
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java
DFSUtil.string2Bytes
public static byte[] string2Bytes(String str) { try { final int len = str.length(); // if we can, we will use it to return the bytes byte[] rawBytes = new byte[len]; // get all chars of the given string char[] charArray = UTF8.getCharArray(len); str.getChars(0, len, charAr...
java
public static byte[] string2Bytes(String str) { try { final int len = str.length(); // if we can, we will use it to return the bytes byte[] rawBytes = new byte[len]; // get all chars of the given string char[] charArray = UTF8.getCharArray(len); str.getChars(0, len, charAr...
[ "public", "static", "byte", "[", "]", "string2Bytes", "(", "String", "str", ")", "{", "try", "{", "final", "int", "len", "=", "str", ".", "length", "(", ")", ";", "// if we can, we will use it to return the bytes", "byte", "[", "]", "rawBytes", "=", "new", ...
Converts a string to a byte array using UTF8 encoding.
[ "Converts", "a", "string", "to", "a", "byte", "array", "using", "UTF8", "encoding", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L160-L185
119,491
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java
DFSUtil.bytes2byteArray
public static byte[][] bytes2byteArray(byte[] bytes, int len, byte separator) { assert len <= bytes.length; int splits = 0; if (len == 0) { return new byte[][] { null }; } // Count the splits. Omit multiple separators and the last one for (int i = 0; i < len; i++) { if (bytes[i] == s...
java
public static byte[][] bytes2byteArray(byte[] bytes, int len, byte separator) { assert len <= bytes.length; int splits = 0; if (len == 0) { return new byte[][] { null }; } // Count the splits. Omit multiple separators and the last one for (int i = 0; i < len; i++) { if (bytes[i] == s...
[ "public", "static", "byte", "[", "]", "[", "]", "bytes2byteArray", "(", "byte", "[", "]", "bytes", ",", "int", "len", ",", "byte", "separator", ")", "{", "assert", "len", "<=", "bytes", ".", "length", ";", "int", "splits", "=", "0", ";", "if", "(",...
Splits first len bytes in bytes to array of arrays of bytes on byte separator @param bytes the byte array to split @param len the number of bytes to split @param separator the delimiting byte
[ "Splits", "first", "len", "bytes", "in", "bytes", "to", "array", "of", "arrays", "of", "bytes", "on", "byte", "separator" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L198-L235
119,492
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java
DFSUtil.extractBytes
private static byte[] extractBytes( String str, int startIndex, int endIndex, char[] charArray, boolean canFastConvert) throws UnsupportedEncodingException { if (canFastConvert) { // fast conversion, just copy the raw bytes final int len = endIndex - startIndex; by...
java
private static byte[] extractBytes( String str, int startIndex, int endIndex, char[] charArray, boolean canFastConvert) throws UnsupportedEncodingException { if (canFastConvert) { // fast conversion, just copy the raw bytes final int len = endIndex - startIndex; by...
[ "private", "static", "byte", "[", "]", "extractBytes", "(", "String", "str", ",", "int", "startIndex", ",", "int", "endIndex", ",", "char", "[", "]", "charArray", ",", "boolean", "canFastConvert", ")", "throws", "UnsupportedEncodingException", "{", "if", "(", ...
Helper for extracting bytes either from "str" or from the array of chars "charArray", depending if fast conversion is possible, specified by "canFastConvert"
[ "Helper", "for", "extracting", "bytes", "either", "from", "str", "or", "from", "the", "array", "of", "chars", "charArray", "depending", "if", "fast", "conversion", "is", "possible", "specified", "by", "canFastConvert" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L317-L334
119,493
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java
DFSUtil.getConfValue
private static String getConfValue(String defaultValue, String keySuffix, Configuration conf, String... keys) { String value = null; for (String key : keys) { if (keySuffix != null) { key += "." + keySuffix; } value = conf.get(key); if (value != null) { break; ...
java
private static String getConfValue(String defaultValue, String keySuffix, Configuration conf, String... keys) { String value = null; for (String key : keys) { if (keySuffix != null) { key += "." + keySuffix; } value = conf.get(key); if (value != null) { break; ...
[ "private", "static", "String", "getConfValue", "(", "String", "defaultValue", ",", "String", "keySuffix", ",", "Configuration", "conf", ",", "String", "...", "keys", ")", "{", "String", "value", "=", "null", ";", "for", "(", "String", "key", ":", "keys", "...
Given a list of keys in the order of preference, returns a value for the key in the given order from the configuration. @param defaultValue default value to return, when key was not found @param keySuffix suffix to add to the key, if it is not null @param conf Configuration @param keys list of keys in the order of pref...
[ "Given", "a", "list", "of", "keys", "in", "the", "order", "of", "preference", "returns", "a", "value", "for", "the", "key", "in", "the", "given", "order", "from", "the", "configuration", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L466-L482
119,494
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java
DFSUtil.getAddresses
public static List<InetSocketAddress> getAddresses(Configuration conf, String defaultAddress, String... keys) { return getAddresses(conf, getNameServiceIds(conf), defaultAddress, keys); }
java
public static List<InetSocketAddress> getAddresses(Configuration conf, String defaultAddress, String... keys) { return getAddresses(conf, getNameServiceIds(conf), defaultAddress, keys); }
[ "public", "static", "List", "<", "InetSocketAddress", ">", "getAddresses", "(", "Configuration", "conf", ",", "String", "defaultAddress", ",", "String", "...", "keys", ")", "{", "return", "getAddresses", "(", "conf", ",", "getNameServiceIds", "(", "conf", ")", ...
Returns list of InetSocketAddress for a given set of keys. @param conf configuration @param defaultAddress default address to return in case key is not found @param keys Set of keys to look for in the order of preference @return list of InetSocketAddress corresponding to the key
[ "Returns", "list", "of", "InetSocketAddress", "for", "a", "given", "set", "of", "keys", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L491-L494
119,495
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java
DFSUtil.getRPCAddresses
public static List<InetSocketAddress> getRPCAddresses(String suffix, Configuration conf, Collection<String> serviceIds, String... keys) throws IOException { // Use default address as fall back String defaultAddress = null; try { defaultAddress = conf.get(FileSystem.FS_DEFAULT_NAME_KEY...
java
public static List<InetSocketAddress> getRPCAddresses(String suffix, Configuration conf, Collection<String> serviceIds, String... keys) throws IOException { // Use default address as fall back String defaultAddress = null; try { defaultAddress = conf.get(FileSystem.FS_DEFAULT_NAME_KEY...
[ "public", "static", "List", "<", "InetSocketAddress", ">", "getRPCAddresses", "(", "String", "suffix", ",", "Configuration", "conf", ",", "Collection", "<", "String", ">", "serviceIds", ",", "String", "...", "keys", ")", "throws", "IOException", "{", "// Use def...
Returns list of InetSocketAddresses corresponding to namenodes from the configuration. @param suffix 0 or 1 indicating if this is AN0 or AN1 @param conf configuration @param keys Set of keys @return list of InetSocketAddress @throws IOException on error
[ "Returns", "list", "of", "InetSocketAddresses", "corresponding", "to", "namenodes", "from", "the", "configuration", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L505-L536
119,496
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java
DFSUtil.setGenericConf
public static String[] setGenericConf(String[] argv, Configuration conf) { String[] serviceId = new String[1]; serviceId[0] = ""; String[] filteredArgv = getServiceName(argv, serviceId); if (!serviceId[0].equals("")) { if (!NameNode.validateServiceName(conf, serviceId[0])) { throw new Ille...
java
public static String[] setGenericConf(String[] argv, Configuration conf) { String[] serviceId = new String[1]; serviceId[0] = ""; String[] filteredArgv = getServiceName(argv, serviceId); if (!serviceId[0].equals("")) { if (!NameNode.validateServiceName(conf, serviceId[0])) { throw new Ille...
[ "public", "static", "String", "[", "]", "setGenericConf", "(", "String", "[", "]", "argv", ",", "Configuration", "conf", ")", "{", "String", "[", "]", "serviceId", "=", "new", "String", "[", "1", "]", ";", "serviceId", "[", "0", "]", "=", "\"\"", ";"...
Set the configuration based on the service id given in the argv @param argv argument list @param conf configuration @return argument list without service name argument
[ "Set", "the", "configuration", "based", "on", "the", "service", "id", "given", "in", "the", "argv" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L544-L556
119,497
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java
DFSUtil.getServiceName
public static String[] getServiceName(String[] argv, String[] serviceId) throws IllegalArgumentException { ArrayList<String> newArgvList = new ArrayList<String>(); for (int i = 0; i < argv.length; i++) { if ("-service".equals(argv[i])) { if (i+1 == argv.length ) { throw new Illega...
java
public static String[] getServiceName(String[] argv, String[] serviceId) throws IllegalArgumentException { ArrayList<String> newArgvList = new ArrayList<String>(); for (int i = 0; i < argv.length; i++) { if ("-service".equals(argv[i])) { if (i+1 == argv.length ) { throw new Illega...
[ "public", "static", "String", "[", "]", "getServiceName", "(", "String", "[", "]", "argv", ",", "String", "[", "]", "serviceId", ")", "throws", "IllegalArgumentException", "{", "ArrayList", "<", "String", ">", "newArgvList", "=", "new", "ArrayList", "<", "St...
Get the service name arguments and return the filtered argument list @param argv argument list @param serviceId[0] is the service id if it's given in the argv, "" otherwise @return argument list without service name argument
[ "Get", "the", "service", "name", "arguments", "and", "return", "the", "filtered", "argument", "list" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L564-L580
119,498
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java
DFSUtil.getAddresses
public static List<InetSocketAddress> getAddresses(Configuration conf, Collection<String> serviceIds, String defaultAddress, String... keys) { Collection<String> nameserviceIds = getNameServiceIds(conf); List<InetSocketAddress> isas = new ArrayList<InetSocketAddress>(); // Configuration with a single...
java
public static List<InetSocketAddress> getAddresses(Configuration conf, Collection<String> serviceIds, String defaultAddress, String... keys) { Collection<String> nameserviceIds = getNameServiceIds(conf); List<InetSocketAddress> isas = new ArrayList<InetSocketAddress>(); // Configuration with a single...
[ "public", "static", "List", "<", "InetSocketAddress", ">", "getAddresses", "(", "Configuration", "conf", ",", "Collection", "<", "String", ">", "serviceIds", ",", "String", "defaultAddress", ",", "String", "...", "keys", ")", "{", "Collection", "<", "String", ...
Return list of InetSocketAddress for a given set of services @param conf configuration @param serviceIds services ids @param defaultAddress default address @param keys set of keys @return list of InetSocketAddress
[ "Return", "list", "of", "InetSocketAddress", "for", "a", "given", "set", "of", "services" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L591-L614
119,499
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java
DFSUtil.getClientRpcAddresses
public static List<InetSocketAddress> getClientRpcAddresses( Configuration conf, Collection<String> suffixes) throws IOException { List<InetSocketAddress> addressList; if(suffixes != null && !suffixes.isEmpty()){ addressList = new ArrayList<InetSocketAddress>(); for (String s : suffixes) { ...
java
public static List<InetSocketAddress> getClientRpcAddresses( Configuration conf, Collection<String> suffixes) throws IOException { List<InetSocketAddress> addressList; if(suffixes != null && !suffixes.isEmpty()){ addressList = new ArrayList<InetSocketAddress>(); for (String s : suffixes) { ...
[ "public", "static", "List", "<", "InetSocketAddress", ">", "getClientRpcAddresses", "(", "Configuration", "conf", ",", "Collection", "<", "String", ">", "suffixes", ")", "throws", "IOException", "{", "List", "<", "InetSocketAddress", ">", "addressList", ";", "if",...
Returns list of InetSocketAddresses corresponding to namenodes from the configuration. Note this is to be used by clients to get the list of namenode addresses to talk to. Returns namenode address specifically configured for clients (using service ports) @param conf configuration @return list of InetSocketAddress @th...
[ "Returns", "list", "of", "InetSocketAddresses", "corresponding", "to", "namenodes", "from", "the", "configuration", ".", "Note", "this", "is", "to", "be", "used", "by", "clients", "to", "get", "the", "list", "of", "namenode", "addresses", "to", "talk", "to", ...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L628-L655