id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
118,400
facebookarchive/hadoop-20
src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java
PoolManager.getMinSharePreemptionTimeout
public long getMinSharePreemptionTimeout(String pool) { if (minSharePreemptionTimeouts.containsKey(pool)) { return minSharePreemptionTimeouts.get(pool); } else { return defaultMinSharePreemptionTimeout; } }
java
public long getMinSharePreemptionTimeout(String pool) { if (minSharePreemptionTimeouts.containsKey(pool)) { return minSharePreemptionTimeouts.get(pool); } else { return defaultMinSharePreemptionTimeout; } }
[ "public", "long", "getMinSharePreemptionTimeout", "(", "String", "pool", ")", "{", "if", "(", "minSharePreemptionTimeouts", ".", "containsKey", "(", "pool", ")", ")", "{", "return", "minSharePreemptionTimeouts", ".", "get", "(", "pool", ")", ";", "}", "else", ...
Get a pool's min share preemption timeout, in milliseconds. This is the time after which jobs in the pool may kill other pools' tasks if they are below their min share.
[ "Get", "a", "pool", "s", "min", "share", "preemption", "timeout", "in", "milliseconds", ".", "This", "is", "the", "time", "after", "which", "jobs", "in", "the", "pool", "may", "kill", "other", "pools", "tasks", "if", "they", "are", "below", "their", "min...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L672-L678
118,401
facebookarchive/hadoop-20
src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java
PoolManager.getMaxSlots
int getMaxSlots(String poolName, TaskType taskType) { Map<String, Integer> maxMap = (taskType == TaskType.MAP ? poolMaxMaps : poolMaxReduces); if (maxMap.containsKey(poolName)) { return maxMap.get(poolName); } else { return Integer.MAX_VALUE; } }
java
int getMaxSlots(String poolName, TaskType taskType) { Map<String, Integer> maxMap = (taskType == TaskType.MAP ? poolMaxMaps : poolMaxReduces); if (maxMap.containsKey(poolName)) { return maxMap.get(poolName); } else { return Integer.MAX_VALUE; } }
[ "int", "getMaxSlots", "(", "String", "poolName", ",", "TaskType", "taskType", ")", "{", "Map", "<", "String", ",", "Integer", ">", "maxMap", "=", "(", "taskType", "==", "TaskType", ".", "MAP", "?", "poolMaxMaps", ":", "poolMaxReduces", ")", ";", "if", "(...
Get the maximum map or reduce slots for the given pool. @return the cap set on this pool, or Integer.MAX_VALUE if not set.
[ "Get", "the", "maximum", "map", "or", "reduce", "slots", "for", "the", "given", "pool", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L693-L701
118,402
facebookarchive/hadoop-20
src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java
PoolManager.resetRunningTasks
public void resetRunningTasks(TaskType type) { Map<String, Integer> runningMap = (type == TaskType.MAP ? poolRunningMaps : poolRunningReduces); for (String poolName : runningMap.keySet()) { runningMap.put(poolName, 0); } }
java
public void resetRunningTasks(TaskType type) { Map<String, Integer> runningMap = (type == TaskType.MAP ? poolRunningMaps : poolRunningReduces); for (String poolName : runningMap.keySet()) { runningMap.put(poolName, 0); } }
[ "public", "void", "resetRunningTasks", "(", "TaskType", "type", ")", "{", "Map", "<", "String", ",", "Integer", ">", "runningMap", "=", "(", "type", "==", "TaskType", ".", "MAP", "?", "poolRunningMaps", ":", "poolRunningReduces", ")", ";", "for", "(", "Str...
Set the number of running tasks in all pools to zero @param type type of task to be set
[ "Set", "the", "number", "of", "running", "tasks", "in", "all", "pools", "to", "zero" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L711-L717
118,403
facebookarchive/hadoop-20
src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java
PoolManager.incRunningTasks
public void incRunningTasks(String poolName, TaskType type, int inc) { Map<String, Integer> runningMap = (type == TaskType.MAP ? poolRunningMaps : poolRunningReduces); if (!runningMap.containsKey(poolName)) { runningMap.put(poolName, 0); } int runningTasks = ...
java
public void incRunningTasks(String poolName, TaskType type, int inc) { Map<String, Integer> runningMap = (type == TaskType.MAP ? poolRunningMaps : poolRunningReduces); if (!runningMap.containsKey(poolName)) { runningMap.put(poolName, 0); } int runningTasks = ...
[ "public", "void", "incRunningTasks", "(", "String", "poolName", ",", "TaskType", "type", ",", "int", "inc", ")", "{", "Map", "<", "String", ",", "Integer", ">", "runningMap", "=", "(", "type", "==", "TaskType", ".", "MAP", "?", "poolRunningMaps", ":", "p...
Set the number of running tasks in a pool @param poolName name of the pool @param type type of task to be set @param runningTasks number of current running tasks
[ "Set", "the", "number", "of", "running", "tasks", "in", "a", "pool" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L725-L733
118,404
facebookarchive/hadoop-20
src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java
PoolManager.getRunningTasks
public int getRunningTasks(String poolName, TaskType type) { Map<String, Integer> runningMap = (type == TaskType.MAP ? poolRunningMaps : poolRunningReduces); return (runningMap.containsKey(poolName) ? runningMap.get(poolName) : 0); }
java
public int getRunningTasks(String poolName, TaskType type) { Map<String, Integer> runningMap = (type == TaskType.MAP ? poolRunningMaps : poolRunningReduces); return (runningMap.containsKey(poolName) ? runningMap.get(poolName) : 0); }
[ "public", "int", "getRunningTasks", "(", "String", "poolName", ",", "TaskType", "type", ")", "{", "Map", "<", "String", ",", "Integer", ">", "runningMap", "=", "(", "type", "==", "TaskType", ".", "MAP", "?", "poolRunningMaps", ":", "poolRunningReduces", ")",...
Get the number of running tasks in a pool @param poolName name of the pool @param type type of task to be set @return number of running tasks
[ "Get", "the", "number", "of", "running", "tasks", "in", "a", "pool" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L741-L746
118,405
facebookarchive/hadoop-20
src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java
PoolManager.isMaxTasks
public boolean isMaxTasks(String poolName, TaskType type) { return getRunningTasks(poolName, type ) >= getMaxSlots(poolName, type); }
java
public boolean isMaxTasks(String poolName, TaskType type) { return getRunningTasks(poolName, type ) >= getMaxSlots(poolName, type); }
[ "public", "boolean", "isMaxTasks", "(", "String", "poolName", ",", "TaskType", "type", ")", "{", "return", "getRunningTasks", "(", "poolName", ",", "type", ")", ">=", "getMaxSlots", "(", "poolName", ",", "type", ")", ";", "}" ]
Is the pool task limit exceeded? @param poolName name of the pool @param type type of the task to be check @return true if the limit is exceeded
[ "Is", "the", "pool", "task", "limit", "exceeded?" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L754-L756
118,406
facebookarchive/hadoop-20
src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java
PoolManager.checkMinimumSlotsAvailable
public boolean checkMinimumSlotsAvailable( ClusterStatus clusterStatus, TaskType type) { Map<String, Integer> poolToMinSlots = (type == TaskType.MAP) ? mapAllocs : reduceAllocs; int totalSlots = (type == TaskType.MAP) ? clusterStatus.getMaxMapTasks() : clusterStatus.getMaxReduceTasks(); ...
java
public boolean checkMinimumSlotsAvailable( ClusterStatus clusterStatus, TaskType type) { Map<String, Integer> poolToMinSlots = (type == TaskType.MAP) ? mapAllocs : reduceAllocs; int totalSlots = (type == TaskType.MAP) ? clusterStatus.getMaxMapTasks() : clusterStatus.getMaxReduceTasks(); ...
[ "public", "boolean", "checkMinimumSlotsAvailable", "(", "ClusterStatus", "clusterStatus", ",", "TaskType", "type", ")", "{", "Map", "<", "String", ",", "Integer", ">", "poolToMinSlots", "=", "(", "type", "==", "TaskType", ".", "MAP", ")", "?", "mapAllocs", ":"...
Check if the minimum slots set in the configuration is feasible @param clusterStatus The current status of the JobTracker @param type The type of the task to check @return true if the check is passed
[ "Check", "if", "the", "minimum", "slots", "set", "in", "the", "configuration", "is", "feasible" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L764-L784
118,407
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/HttpImageUploadChannel.java
HttpImageUploadChannel.start
public void start() { try { if (init) { setErrorStatus("Cannot initialize multiple times", null); return; } init = true; HttpPost postRequest = setupRequest(new ByteArrayOutputStream(0)); UploadImageParam.setHeaders(postRequest, journalId, namespaceInfoString, ...
java
public void start() { try { if (init) { setErrorStatus("Cannot initialize multiple times", null); return; } init = true; HttpPost postRequest = setupRequest(new ByteArrayOutputStream(0)); UploadImageParam.setHeaders(postRequest, journalId, namespaceInfoString, ...
[ "public", "void", "start", "(", ")", "{", "try", "{", "if", "(", "init", ")", "{", "setErrorStatus", "(", "\"Cannot initialize multiple times\"", ",", "null", ")", ";", "return", ";", "}", "init", "=", "true", ";", "HttpPost", "postRequest", "=", "setupReq...
Create an image upload channel, based on image txid and other metadata.
[ "Create", "an", "image", "upload", "channel", "based", "on", "image", "txid", "and", "other", "metadata", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/HttpImageUploadChannel.java#L110-L143
118,408
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/HttpImageUploadChannel.java
HttpImageUploadChannel.send
public void send(ByteArrayOutputStream bos) { try { if (this.isDisabled) { return; } if (available.tryAcquire(WAIT_NEXT_BUFFER_TIME_OUT_SECONDS, TimeUnit.SECONDS)) { tasks.add(sendExecutor.submit(new SendWorker(bos, segmentId++, false))); } else { setErrorStatus("Numb...
java
public void send(ByteArrayOutputStream bos) { try { if (this.isDisabled) { return; } if (available.tryAcquire(WAIT_NEXT_BUFFER_TIME_OUT_SECONDS, TimeUnit.SECONDS)) { tasks.add(sendExecutor.submit(new SendWorker(bos, segmentId++, false))); } else { setErrorStatus("Numb...
[ "public", "void", "send", "(", "ByteArrayOutputStream", "bos", ")", "{", "try", "{", "if", "(", "this", ".", "isDisabled", ")", "{", "return", ";", "}", "if", "(", "available", ".", "tryAcquire", "(", "WAIT_NEXT_BUFFER_TIME_OUT_SECONDS", ",", "TimeUnit", "."...
Send a chunk of data.
[ "Send", "a", "chunk", "of", "data", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/HttpImageUploadChannel.java#L148-L162
118,409
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/HttpImageUploadChannel.java
HttpImageUploadChannel.close
public void close() { if (this.isDisabled || this.closed) { // parent stream needs to check for success explicitly return; } closed = true; try { // send close request tasks.add(sendExecutor.submit(new SendWorker( new ByteArrayOutputStream(0), segmentId++, true))); ...
java
public void close() { if (this.isDisabled || this.closed) { // parent stream needs to check for success explicitly return; } closed = true; try { // send close request tasks.add(sendExecutor.submit(new SendWorker( new ByteArrayOutputStream(0), segmentId++, true))); ...
[ "public", "void", "close", "(", ")", "{", "if", "(", "this", ".", "isDisabled", "||", "this", ".", "closed", ")", "{", "// parent stream needs to check for success explicitly", "return", ";", "}", "closed", "=", "true", ";", "try", "{", "// send close request", ...
Close the upload
[ "Close", "the", "upload" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/HttpImageUploadChannel.java#L167-L190
118,410
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/HttpImageUploadChannel.java
HttpImageUploadChannel.setupRequest
private HttpPost setupRequest(ByteArrayOutputStream bos) { ContentBody cb = new ByteArrayBody(bos.toByteArray(), "image"); HttpPost postRequest = new HttpPost(uri + "/uploadImage"); MultipartEntity reqEntity = new MultipartEntity( HttpMultipartMode.BROWSER_COMPATIBLE); // add a single part to t...
java
private HttpPost setupRequest(ByteArrayOutputStream bos) { ContentBody cb = new ByteArrayBody(bos.toByteArray(), "image"); HttpPost postRequest = new HttpPost(uri + "/uploadImage"); MultipartEntity reqEntity = new MultipartEntity( HttpMultipartMode.BROWSER_COMPATIBLE); // add a single part to t...
[ "private", "HttpPost", "setupRequest", "(", "ByteArrayOutputStream", "bos", ")", "{", "ContentBody", "cb", "=", "new", "ByteArrayBody", "(", "bos", ".", "toByteArray", "(", ")", ",", "\"image\"", ")", ";", "HttpPost", "postRequest", "=", "new", "HttpPost", "("...
Create a post request encapsulating bytes from the given ByteArrayOutputStream.
[ "Create", "a", "post", "request", "encapsulating", "bytes", "from", "the", "given", "ByteArrayOutputStream", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/HttpImageUploadChannel.java#L248-L259
118,411
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/HttpImageUploadChannel.java
HttpImageUploadChannel.setErrorStatus
void setErrorStatus(String msg, Exception e) { this.e = new IOException(msg + " " + (e == null ? "" : e.toString())); // no more writes will be accepted this.isDisabled = true; // close the executor sendExecutor.shutdown(); LOG.error(msg, e); }
java
void setErrorStatus(String msg, Exception e) { this.e = new IOException(msg + " " + (e == null ? "" : e.toString())); // no more writes will be accepted this.isDisabled = true; // close the executor sendExecutor.shutdown(); LOG.error(msg, e); }
[ "void", "setErrorStatus", "(", "String", "msg", ",", "Exception", "e", ")", "{", "this", ".", "e", "=", "new", "IOException", "(", "msg", "+", "\" \"", "+", "(", "e", "==", "null", "?", "\"\"", ":", "e", ".", "toString", "(", ")", ")", ")", ";", ...
If any operation for this channel fail, the error status is set. Parent output stream, based on this information, decides whether the upload can be still continued with remaining channels.
[ "If", "any", "operation", "for", "this", "channel", "fail", "the", "error", "status", "is", "set", ".", "Parent", "output", "stream", "based", "on", "this", "information", "decides", "whether", "the", "upload", "can", "be", "still", "continued", "with", "rem...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/HttpImageUploadChannel.java#L271-L280
118,412
facebookarchive/hadoop-20
src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerAdmissionControlServlet.java
FairSchedulerAdmissionControlServlet.showJobsNotAdmitted
private void showJobsNotAdmitted( PrintWriter out, Set<String> userFilterSet, Set<String> poolFilterSet) { out.print("<h2>Not Admitted Jobs</h2>\n"); out.print("<b>Filter</b> " + "<input type=\"text\" onkeyup=\"filterTables(this.value)\" " + "id=\"NotAdmittedJobsTableFilter\">" + "...
java
private void showJobsNotAdmitted( PrintWriter out, Set<String> userFilterSet, Set<String> poolFilterSet) { out.print("<h2>Not Admitted Jobs</h2>\n"); out.print("<b>Filter</b> " + "<input type=\"text\" onkeyup=\"filterTables(this.value)\" " + "id=\"NotAdmittedJobsTableFilter\">" + "...
[ "private", "void", "showJobsNotAdmitted", "(", "PrintWriter", "out", ",", "Set", "<", "String", ">", "userFilterSet", ",", "Set", "<", "String", ">", "poolFilterSet", ")", "{", "out", ".", "print", "(", "\"<h2>Not Admitted Jobs</h2>\\n\"", ")", ";", "out", "."...
Print a view of not admitted jobs to the given output writer. @param out Where to dump the oiutput @param userFilterSet Only show jobs from these users if not null @param poolFilterSet Only show jobs from these pools if not null
[ "Print", "a", "view", "of", "not", "admitted", "jobs", "to", "the", "given", "output", "writer", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerAdmissionControlServlet.java#L196-L253
118,413
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/Statistics.java
Statistics.addSourceFile
public boolean addSourceFile(FileSystem fs, PolicyInfo info, FileStatus src, RaidState.Checker checker, long now, int targetReplication) throws IOException { RaidState state = checker.check(info, src, now, false); Counters counters = stateToSourceCounters.get(state); counters.inc(src); if (s...
java
public boolean addSourceFile(FileSystem fs, PolicyInfo info, FileStatus src, RaidState.Checker checker, long now, int targetReplication) throws IOException { RaidState state = checker.check(info, src, now, false); Counters counters = stateToSourceCounters.get(state); counters.inc(src); if (s...
[ "public", "boolean", "addSourceFile", "(", "FileSystem", "fs", ",", "PolicyInfo", "info", ",", "FileStatus", "src", ",", "RaidState", ".", "Checker", "checker", ",", "long", "now", ",", "int", "targetReplication", ")", "throws", "IOException", "{", "RaidState", ...
Collect the statistics of a source file. Return true if the file should be raided but not.
[ "Collect", "the", "statistics", "of", "a", "source", "file", ".", "Return", "true", "if", "the", "file", "should", "be", "raided", "but", "not", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/Statistics.java#L158-L178
118,414
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/Statistics.java
Statistics.getSaving
public long getSaving(Configuration conf) { try { DFSClient dfs = ((DistributedFileSystem)FileSystem.get(conf)).getClient(); Counters raidedCounters = stateToSourceCounters.get(RaidState.RAIDED); long physical = raidedCounters.getNumBytes() + parityCounters.getNumBytes(); long logi...
java
public long getSaving(Configuration conf) { try { DFSClient dfs = ((DistributedFileSystem)FileSystem.get(conf)).getClient(); Counters raidedCounters = stateToSourceCounters.get(RaidState.RAIDED); long physical = raidedCounters.getNumBytes() + parityCounters.getNumBytes(); long logi...
[ "public", "long", "getSaving", "(", "Configuration", "conf", ")", "{", "try", "{", "DFSClient", "dfs", "=", "(", "(", "DistributedFileSystem", ")", "FileSystem", ".", "get", "(", "conf", ")", ")", ".", "getClient", "(", ")", ";", "Counters", "raidedCounter...
Get the saving of this code in bytes @return The saving in bytes
[ "Get", "the", "saving", "of", "this", "code", "in", "bytes" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/Statistics.java#L237-L248
118,415
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/Statistics.java
Statistics.getDoneSaving
public long getDoneSaving(Configuration conf) { try { DFSClient dfs = ((DistributedFileSystem)FileSystem.get(conf)).getClient(); Counters raidedCounters = stateToSourceCounters.get(RaidState.RAIDED); Counters shouldRaidCounters = stateToSourceCounters.get(RaidState.NOT_RAIDED_BUT_SHOULD)...
java
public long getDoneSaving(Configuration conf) { try { DFSClient dfs = ((DistributedFileSystem)FileSystem.get(conf)).getClient(); Counters raidedCounters = stateToSourceCounters.get(RaidState.RAIDED); Counters shouldRaidCounters = stateToSourceCounters.get(RaidState.NOT_RAIDED_BUT_SHOULD)...
[ "public", "long", "getDoneSaving", "(", "Configuration", "conf", ")", "{", "try", "{", "DFSClient", "dfs", "=", "(", "(", "DistributedFileSystem", ")", "FileSystem", ".", "get", "(", "conf", ")", ")", ".", "getClient", "(", ")", ";", "Counters", "raidedCou...
Get the estimated saving of this code in bytes when RAIDing is done @return The saving in bytes
[ "Get", "the", "estimated", "saving", "of", "this", "code", "in", "bytes", "when", "RAIDing", "is", "done" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/Statistics.java#L254-L267
118,416
facebookarchive/hadoop-20
src/core/org/apache/hadoop/conf/Configuration.java
Configuration.removeDefaultResource
public static synchronized void removeDefaultResource(String name) { if(defaultResources.contains(name)) { defaultResources.remove(name); for(Configuration conf : REGISTRY.keySet()) { if(conf.loadDefaults) { conf.reloadConfiguration(); } } } }
java
public static synchronized void removeDefaultResource(String name) { if(defaultResources.contains(name)) { defaultResources.remove(name); for(Configuration conf : REGISTRY.keySet()) { if(conf.loadDefaults) { conf.reloadConfiguration(); } } } }
[ "public", "static", "synchronized", "void", "removeDefaultResource", "(", "String", "name", ")", "{", "if", "(", "defaultResources", ".", "contains", "(", "name", ")", ")", "{", "defaultResources", ".", "remove", "(", "name", ")", ";", "for", "(", "Configura...
Remove default resource
[ "Remove", "default", "resource" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/conf/Configuration.java#L324-L333
118,417
facebookarchive/hadoop-20
src/core/org/apache/hadoop/conf/Configuration.java
Configuration.loadEntireJsonObject
private void loadEntireJsonObject(JSONObject json) throws JSONException { Iterator<?> it = json.keys(); while (it.hasNext()) { // This key is something like core-site.xml or hdfs-site.xml Object obj = it.next(); if (!(obj instanceof String)) { LOG.warn("Object not instance of string : ...
java
private void loadEntireJsonObject(JSONObject json) throws JSONException { Iterator<?> it = json.keys(); while (it.hasNext()) { // This key is something like core-site.xml or hdfs-site.xml Object obj = it.next(); if (!(obj instanceof String)) { LOG.warn("Object not instance of string : ...
[ "private", "void", "loadEntireJsonObject", "(", "JSONObject", "json", ")", "throws", "JSONException", "{", "Iterator", "<", "?", ">", "it", "=", "json", ".", "keys", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "// This key is s...
Loads an entire json configuration object which would mostly contain many sub-sections like "core-site.xml" and "hdfs-site.xml" @param json the json object to load @throws JSONException on error
[ "Loads", "an", "entire", "json", "configuration", "object", "which", "would", "mostly", "contain", "many", "sub", "-", "sections", "like", "core", "-", "site", ".", "xml", "and", "hdfs", "-", "site", ".", "xml" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/conf/Configuration.java#L1127-L1140
118,418
facebookarchive/hadoop-20
src/core/org/apache/hadoop/conf/Configuration.java
Configuration.xmlToThrift
public String xmlToThrift(String name) { name = name.replace("-custom.xml", ""); name = name.replace(".xml", ""); name = name.replace("-", "_"); return name; }
java
public String xmlToThrift(String name) { name = name.replace("-custom.xml", ""); name = name.replace(".xml", ""); name = name.replace("-", "_"); return name; }
[ "public", "String", "xmlToThrift", "(", "String", "name", ")", "{", "name", "=", "name", ".", "replace", "(", "\"-custom.xml\"", ",", "\"\"", ")", ";", "name", "=", "name", ".", "replace", "(", "\".xml\"", ",", "\"\"", ")", ";", "name", "=", "name", ...
Maps xml configs to their respective key names in the file config.materialized_JSON
[ "Maps", "xml", "configs", "to", "their", "respective", "key", "names", "in", "the", "file", "config", ".", "materialized_JSON" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/conf/Configuration.java#L1348-L1353
118,419
facebookarchive/hadoop-20
src/core/org/apache/hadoop/conf/Configuration.java
Configuration.instantiateJsonObject
public JSONObject instantiateJsonObject(InputStream in) throws IOException, JSONException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuffer contents = new StringBuffer(); String text = null; while ((text ...
java
public JSONObject instantiateJsonObject(InputStream in) throws IOException, JSONException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuffer contents = new StringBuffer(); String text = null; while ((text ...
[ "public", "JSONObject", "instantiateJsonObject", "(", "InputStream", "in", ")", "throws", "IOException", ",", "JSONException", "{", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "in", ")", ")", ";", "StringBuffer", ...
Given an input stream, read in the contents of the file and instantiate a JSON object if it exists.
[ "Given", "an", "input", "stream", "read", "in", "the", "contents", "of", "the", "file", "and", "instantiate", "a", "JSON", "object", "if", "it", "exists", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/conf/Configuration.java#L1359-L1370
118,420
facebookarchive/hadoop-20
src/core/org/apache/hadoop/conf/Configuration.java
Configuration.getJsonConfig
public JSONObject getJsonConfig(String name) throws IOException, JSONException { if (name.endsWith(".xml")) { URL url = getResource(MATERIALIZEDJSON); if (url != null) { InputStream in = url.openStream(); if (in != null) { ...
java
public JSONObject getJsonConfig(String name) throws IOException, JSONException { if (name.endsWith(".xml")) { URL url = getResource(MATERIALIZEDJSON); if (url != null) { InputStream in = url.openStream(); if (in != null) { ...
[ "public", "JSONObject", "getJsonConfig", "(", "String", "name", ")", "throws", "IOException", ",", "JSONException", "{", "if", "(", "name", ".", "endsWith", "(", "\".xml\"", ")", ")", "{", "URL", "url", "=", "getResource", "(", "MATERIALIZEDJSON", ")", ";", ...
Given a xml config file specified as a string, return the corresponding json object if it exists.
[ "Given", "a", "xml", "config", "file", "specified", "as", "a", "string", "return", "the", "corresponding", "json", "object", "if", "it", "exists", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/conf/Configuration.java#L1376-L1391
118,421
facebookarchive/hadoop-20
src/core/org/apache/hadoop/conf/Configuration.java
Configuration.getJsonConfig
public JSONObject getJsonConfig(Path name) throws IOException, JSONException { String pathString = name.toUri().getPath(); String xml = new Path(pathString).getName(); File jsonFile = new File(pathString.replace(xml, MATERIALIZEDJSON)) .getAbsoluteFile(); if (jsonFile.exists()) { Inp...
java
public JSONObject getJsonConfig(Path name) throws IOException, JSONException { String pathString = name.toUri().getPath(); String xml = new Path(pathString).getName(); File jsonFile = new File(pathString.replace(xml, MATERIALIZEDJSON)) .getAbsoluteFile(); if (jsonFile.exists()) { Inp...
[ "public", "JSONObject", "getJsonConfig", "(", "Path", "name", ")", "throws", "IOException", ",", "JSONException", "{", "String", "pathString", "=", "name", ".", "toUri", "(", ")", ".", "getPath", "(", ")", ";", "String", "xml", "=", "new", "Path", "(", "...
Given a xml config file specified by a path, return the corresponding json object if it exists.
[ "Given", "a", "xml", "config", "file", "specified", "by", "a", "path", "return", "the", "corresponding", "json", "object", "if", "it", "exists", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/conf/Configuration.java#L1397-L1414
118,422
facebookarchive/hadoop-20
src/core/org/apache/hadoop/conf/Configuration.java
Configuration.convertFile
private Object convertFile(Object name) throws IOException, JSONException{ if (name instanceof String) { String file = (String) name; JSONObject json = getJsonConfig(file); if (json!=null) { return json; } } else if (name instanceof Path) { Path file = (Path)name; ...
java
private Object convertFile(Object name) throws IOException, JSONException{ if (name instanceof String) { String file = (String) name; JSONObject json = getJsonConfig(file); if (json!=null) { return json; } } else if (name instanceof Path) { Path file = (Path)name; ...
[ "private", "Object", "convertFile", "(", "Object", "name", ")", "throws", "IOException", ",", "JSONException", "{", "if", "(", "name", "instanceof", "String", ")", "{", "String", "file", "=", "(", "String", ")", "name", ";", "JSONObject", "json", "=", "get...
Given a xml config file, return the corresponding json object if it exists.
[ "Given", "a", "xml", "config", "file", "return", "the", "corresponding", "json", "object", "if", "it", "exists", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/conf/Configuration.java#L1420-L1435
118,423
facebookarchive/hadoop-20
src/core/org/apache/hadoop/conf/Configuration.java
Configuration.loadJsonResource
private void loadJsonResource(JSONObject json, Properties properties, Object name) throws JSONException { Iterator<?> keys = json.keys(); while (keys.hasNext()) { Object obj = keys.next(); if (!(obj instanceof String)) { LOG.warn("Object not instance of string...
java
private void loadJsonResource(JSONObject json, Properties properties, Object name) throws JSONException { Iterator<?> keys = json.keys(); while (keys.hasNext()) { Object obj = keys.next(); if (!(obj instanceof String)) { LOG.warn("Object not instance of string...
[ "private", "void", "loadJsonResource", "(", "JSONObject", "json", ",", "Properties", "properties", ",", "Object", "name", ")", "throws", "JSONException", "{", "Iterator", "<", "?", ">", "keys", "=", "json", ".", "keys", "(", ")", ";", "while", "(", "keys",...
Helper function to loadResource that adds resources to the properties parameter by parsing through a json object.
[ "Helper", "function", "to", "loadResource", "that", "adds", "resources", "to", "the", "properties", "parameter", "by", "parsing", "through", "a", "json", "object", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/conf/Configuration.java#L1441-L1483
118,424
facebookarchive/hadoop-20
src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/DataSegmentWriter.java
DataSegmentWriter.writeTo
void writeTo(DataOutputStream out) throws IOException { // We do the UTF8 conversion ourselves instead of relying on DataOutput // to ensure we strictly follow UTF-8 standard, as well as better performance, // and save the code to count the UTF-8 bytes (we need that to calculate // the total length. ...
java
void writeTo(DataOutputStream out) throws IOException { // We do the UTF8 conversion ourselves instead of relying on DataOutput // to ensure we strictly follow UTF-8 standard, as well as better performance, // and save the code to count the UTF-8 bytes (we need that to calculate // the total length. ...
[ "void", "writeTo", "(", "DataOutputStream", "out", ")", "throws", "IOException", "{", "// We do the UTF8 conversion ourselves instead of relying on DataOutput", "// to ensure we strictly follow UTF-8 standard, as well as better performance,", "// and save the code to count the UTF-8 bytes (we ...
Write this data segment into an OutputStream.
[ "Write", "this", "data", "segment", "into", "an", "OutputStream", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/DataSegmentWriter.java#L88-L103
118,425
facebookarchive/hadoop-20
src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/DataSegmentWriter.java
DataSegmentWriter.getCodecNameUTF8
static byte[] getCodecNameUTF8(String compressionCodecName) { byte[] codecNameBytes = CODEC_NAME_CACHE.get(compressionCodecName); if (codecNameBytes == null) { try { codecNameBytes = compressionCodecName.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeE...
java
static byte[] getCodecNameUTF8(String compressionCodecName) { byte[] codecNameBytes = CODEC_NAME_CACHE.get(compressionCodecName); if (codecNameBytes == null) { try { codecNameBytes = compressionCodecName.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeE...
[ "static", "byte", "[", "]", "getCodecNameUTF8", "(", "String", "compressionCodecName", ")", "{", "byte", "[", "]", "codecNameBytes", "=", "CODEC_NAME_CACHE", ".", "get", "(", "compressionCodecName", ")", ";", "if", "(", "codecNameBytes", "==", "null", ")", "{"...
Convert from String to UTF8 byte array.
[ "Convert", "from", "String", "to", "UTF8", "byte", "array", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/DataSegmentWriter.java#L113-L124
118,426
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java
BlockSender.sendChunks
private int sendChunks(ByteBuffer pkt, int maxChunks, OutputStream out) throws IOException { // Sends multiple chunks in one packet with a single write(). int len = (int) Math.min(endOffset - offset, (((long) bytesPerChecksum) * ((long) maxChunks))); /...
java
private int sendChunks(ByteBuffer pkt, int maxChunks, OutputStream out) throws IOException { // Sends multiple chunks in one packet with a single write(). int len = (int) Math.min(endOffset - offset, (((long) bytesPerChecksum) * ((long) maxChunks))); /...
[ "private", "int", "sendChunks", "(", "ByteBuffer", "pkt", ",", "int", "maxChunks", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "// Sends multiple chunks in one packet with a single write().", "int", "len", "=", "(", "int", ")", "Math", ".", "min",...
Sends upto maxChunks chunks of data. When blockInPosition is >= 0, assumes 'out' is a {@link SocketOutputStream} and tries {@link SocketOutputStream#transferToFully(FileChannel, long, int)} to send data (and updates blockInPosition).
[ "Sends", "upto", "maxChunks", "chunks", "of", "data", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java#L256-L307
118,427
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/InitialReportWorker.java
InitialReportWorker.insertCurrentStoredBlockIntoList
private void insertCurrentStoredBlockIntoList() { // index < 0 - block is already in the DN's list if (currentStoredBlock == null || currentStoredBlockIndex < 0) return; if (head == null) { // local list is empty, // make head and tail point to the input block head = currentStoredBl...
java
private void insertCurrentStoredBlockIntoList() { // index < 0 - block is already in the DN's list if (currentStoredBlock == null || currentStoredBlockIndex < 0) return; if (head == null) { // local list is empty, // make head and tail point to the input block head = currentStoredBl...
[ "private", "void", "insertCurrentStoredBlockIntoList", "(", ")", "{", "// index < 0 - block is already in the DN's list", "if", "(", "currentStoredBlock", "==", "null", "||", "currentStoredBlockIndex", "<", "0", ")", "return", ";", "if", "(", "head", "==", "null", ")"...
Insert the current stored block into the local list of blocks belonging to the datanode descriptor.
[ "Insert", "the", "current", "stored", "block", "into", "the", "local", "list", "of", "blocks", "belonging", "to", "the", "datanode", "descriptor", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/InitialReportWorker.java#L159-L190
118,428
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/InitialReportWorker.java
InitialReportWorker.processReport
static void processReport(FSNamesystem namesystem, Collection<Block> toRetry, BlockListAsLongs newReport, DatanodeDescriptor node, ExecutorService initialBlockReportExecutor) throws IOException { // spawn one thread for blocksPerShardBR blocks int numShards = Math .min( namesyste...
java
static void processReport(FSNamesystem namesystem, Collection<Block> toRetry, BlockListAsLongs newReport, DatanodeDescriptor node, ExecutorService initialBlockReportExecutor) throws IOException { // spawn one thread for blocksPerShardBR blocks int numShards = Math .min( namesyste...
[ "static", "void", "processReport", "(", "FSNamesystem", "namesystem", ",", "Collection", "<", "Block", ">", "toRetry", ",", "BlockListAsLongs", "newReport", ",", "DatanodeDescriptor", "node", ",", "ExecutorService", "initialBlockReportExecutor", ")", "throws", "IOExcept...
Processes a single initial block reports, by spawning multiple threads to handle insertion to the blocks map. Each thread stores the inserted blocks in a local list, and at the end, the list are concatenated for a single datanode descriptor.
[ "Processes", "a", "single", "initial", "block", "reports", "by", "spawning", "multiple", "threads", "to", "handle", "insertion", "to", "the", "blocks", "map", ".", "Each", "thread", "stores", "the", "inserted", "blocks", "in", "a", "local", "list", "and", "a...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/InitialReportWorker.java#L207-L241
118,429
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/LeaseRenewal.java
LeaseRenewal.computeRenewalPeriod
private long computeRenewalPeriod() { long hardLeaseLimit = conf.getLong( FSConstants.DFS_HARD_LEASE_KEY, FSConstants.LEASE_HARDLIMIT_PERIOD); long softLeaseLimit = conf.getLong( FSConstants.DFS_SOFT_LEASE_KEY, FSConstants.LEASE_SOFTLIMIT_PERIOD); long renewal = Math.min(hardLeaseLimit, soft...
java
private long computeRenewalPeriod() { long hardLeaseLimit = conf.getLong( FSConstants.DFS_HARD_LEASE_KEY, FSConstants.LEASE_HARDLIMIT_PERIOD); long softLeaseLimit = conf.getLong( FSConstants.DFS_SOFT_LEASE_KEY, FSConstants.LEASE_SOFTLIMIT_PERIOD); long renewal = Math.min(hardLeaseLimit, soft...
[ "private", "long", "computeRenewalPeriod", "(", ")", "{", "long", "hardLeaseLimit", "=", "conf", ".", "getLong", "(", "FSConstants", ".", "DFS_HARD_LEASE_KEY", ",", "FSConstants", ".", "LEASE_HARDLIMIT_PERIOD", ")", ";", "long", "softLeaseLimit", "=", "conf", ".",...
Computes the renewal period for the lease. @return the renewal period in ms
[ "Computes", "the", "renewal", "period", "for", "the", "lease", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/LeaseRenewal.java#L58-L69
118,430
facebookarchive/hadoop-20
src/core/org/apache/hadoop/net/InetSocketAddressFactory.java
InetSocketAddressFactory.createWithResolveRetry
public static InetSocketAddress createWithResolveRetry( String hostname, int port ) { return createWithResolveRetry( hostname, port, DEFAULT_DELAY_MILLIS, DEFAULT_MAX_ATTEMPTS ); }
java
public static InetSocketAddress createWithResolveRetry( String hostname, int port ) { return createWithResolveRetry( hostname, port, DEFAULT_DELAY_MILLIS, DEFAULT_MAX_ATTEMPTS ); }
[ "public", "static", "InetSocketAddress", "createWithResolveRetry", "(", "String", "hostname", ",", "int", "port", ")", "{", "return", "createWithResolveRetry", "(", "hostname", ",", "port", ",", "DEFAULT_DELAY_MILLIS", ",", "DEFAULT_MAX_ATTEMPTS", ")", ";", "}" ]
Utility function to create an InetSocketAddress that has been resolved. Retries once and sleeps 100ms between the failure and the retry @param hostname @param port @return InetSocketAddress, may be unresolved if both attempts fail
[ "Utility", "function", "to", "create", "an", "InetSocketAddress", "that", "has", "been", "resolved", ".", "Retries", "once", "and", "sleeps", "100ms", "between", "the", "failure", "and", "the", "retry" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/InetSocketAddressFactory.java#L21-L31
118,431
facebookarchive/hadoop-20
src/core/org/apache/hadoop/net/InetSocketAddressFactory.java
InetSocketAddressFactory.createWithResolveRetry
public static InetSocketAddress createWithResolveRetry( String hostname, int port, int delayMillis, int maxAttempt ) { InetSocketAddress socketAddress; int attempts = 0; do { socketAddress = new InetSocketAddress(hostname, port); // if dns failed, try one more time if (s...
java
public static InetSocketAddress createWithResolveRetry( String hostname, int port, int delayMillis, int maxAttempt ) { InetSocketAddress socketAddress; int attempts = 0; do { socketAddress = new InetSocketAddress(hostname, port); // if dns failed, try one more time if (s...
[ "public", "static", "InetSocketAddress", "createWithResolveRetry", "(", "String", "hostname", ",", "int", "port", ",", "int", "delayMillis", ",", "int", "maxAttempt", ")", "{", "InetSocketAddress", "socketAddress", ";", "int", "attempts", "=", "0", ";", "do", "{...
Utility function to create an InetSocketAddress that has been resolved. Retries with a small sleep in between @param hostname - host @param port - port @param delayMillis - millis to sleep between attempts @param maxAttempt - max total attempts to retry @return InetSocketAddress, may be unresolved if all attempts fail
[ "Utility", "function", "to", "create", "an", "InetSocketAddress", "that", "has", "been", "resolved", ".", "Retries", "with", "a", "small", "sleep", "in", "between" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/InetSocketAddressFactory.java#L43-L76
118,432
facebookarchive/hadoop-20
src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/StructureGenerator.java
StructureGenerator.run
public int run(String[] args) throws Exception { int exitCode = 0; exitCode = init(args); if (exitCode != 0) { return exitCode; } genDirStructure(); output(new File(outDir, DIR_STRUCTURE_FILE_NAME)); genFileStructure(); outputFiles(new File(outDir, FILE_STRUCTURE_FILE_NAME)); r...
java
public int run(String[] args) throws Exception { int exitCode = 0; exitCode = init(args); if (exitCode != 0) { return exitCode; } genDirStructure(); output(new File(outDir, DIR_STRUCTURE_FILE_NAME)); genFileStructure(); outputFiles(new File(outDir, FILE_STRUCTURE_FILE_NAME)); r...
[ "public", "int", "run", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "int", "exitCode", "=", "0", ";", "exitCode", "=", "init", "(", "args", ")", ";", "if", "(", "exitCode", "!=", "0", ")", "{", "return", "exitCode", ";", "}", ...
The main function first parses the command line arguments, then generates in-memory directory structure and outputs to a file, last generates in-memory files and outputs them to a file.
[ "The", "main", "function", "first", "parses", "the", "command", "line", "arguments", "then", "generates", "in", "-", "memory", "directory", "structure", "and", "outputs", "to", "a", "file", "last", "generates", "in", "-", "memory", "files", "and", "outputs", ...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/StructureGenerator.java#L86-L97
118,433
facebookarchive/hadoop-20
src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/StructureGenerator.java
StructureGenerator.getLeaves
private List<INode> getLeaves() { List<INode> leaveDirs = new ArrayList<INode>(); root.getLeaves(leaveDirs); return leaveDirs; }
java
private List<INode> getLeaves() { List<INode> leaveDirs = new ArrayList<INode>(); root.getLeaves(leaveDirs); return leaveDirs; }
[ "private", "List", "<", "INode", ">", "getLeaves", "(", ")", "{", "List", "<", "INode", ">", "leaveDirs", "=", "new", "ArrayList", "<", "INode", ">", "(", ")", ";", "root", ".", "getLeaves", "(", "leaveDirs", ")", ";", "return", "leaveDirs", ";", "}"...
Collects leaf nodes in the tree
[ "Collects", "leaf", "nodes", "in", "the", "tree" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/StructureGenerator.java#L255-L259
118,434
facebookarchive/hadoop-20
src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/StructureGenerator.java
StructureGenerator.genFileStructure
private void genFileStructure() { List<INode> leaves = getLeaves(); int totalLeaves = leaves.size(); for (int i=0; i<numOfFiles; i++) { int leaveNum = r.nextInt(totalLeaves); double fileSize; do { fileSize = r.nextGaussian()+avgFileSize; } while (fileSize<0); leaves.get...
java
private void genFileStructure() { List<INode> leaves = getLeaves(); int totalLeaves = leaves.size(); for (int i=0; i<numOfFiles; i++) { int leaveNum = r.nextInt(totalLeaves); double fileSize; do { fileSize = r.nextGaussian()+avgFileSize; } while (fileSize<0); leaves.get...
[ "private", "void", "genFileStructure", "(", ")", "{", "List", "<", "INode", ">", "leaves", "=", "getLeaves", "(", ")", ";", "int", "totalLeaves", "=", "leaves", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numOfFile...
Decides where to place all the files and its length. It first collects all empty directories in the tree. For each file, it randomly chooses an empty directory to place the file. The file's length is generated using Gaussian distribution.
[ "Decides", "where", "to", "place", "all", "the", "files", "and", "its", "length", ".", "It", "first", "collects", "all", "empty", "directories", "in", "the", "tree", ".", "For", "each", "file", "it", "randomly", "chooses", "an", "empty", "directory", "to",...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/StructureGenerator.java#L266-L278
118,435
facebookarchive/hadoop-20
src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/StructureGenerator.java
StructureGenerator.output
private void output(File outFile) throws FileNotFoundException { System.out.println("Printing to " + outFile.toString()); PrintStream out = new PrintStream(outFile); root.output(out, null); out.close(); }
java
private void output(File outFile) throws FileNotFoundException { System.out.println("Printing to " + outFile.toString()); PrintStream out = new PrintStream(outFile); root.output(out, null); out.close(); }
[ "private", "void", "output", "(", "File", "outFile", ")", "throws", "FileNotFoundException", "{", "System", ".", "out", ".", "println", "(", "\"Printing to \"", "+", "outFile", ".", "toString", "(", ")", ")", ";", "PrintStream", "out", "=", "new", "PrintStre...
Output directory structure to a file, each line of the file contains the directory name. Only empty directory names are printed.
[ "Output", "directory", "structure", "to", "a", "file", "each", "line", "of", "the", "file", "contains", "the", "directory", "name", ".", "Only", "empty", "directory", "names", "are", "printed", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/StructureGenerator.java#L282-L287
118,436
facebookarchive/hadoop-20
src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/NotAdmittedJobInfo.java
NotAdmittedJobInfo.getReasoning
public static String getReasoning(final BlockedAdmissionReason reason, final int reasonLimit, final int reasonActualValue, final int hardAdmissionPosition, JobAdmissionWaitInfo jobAdmissionWaitInfo) { if (reason == BlockedAdmissionReason.HARD_CLUSTER_WIDE_MAX_TASKS_EXCEEDED) { if (jobAdmissi...
java
public static String getReasoning(final BlockedAdmissionReason reason, final int reasonLimit, final int reasonActualValue, final int hardAdmissionPosition, JobAdmissionWaitInfo jobAdmissionWaitInfo) { if (reason == BlockedAdmissionReason.HARD_CLUSTER_WIDE_MAX_TASKS_EXCEEDED) { if (jobAdmissi...
[ "public", "static", "String", "getReasoning", "(", "final", "BlockedAdmissionReason", "reason", ",", "final", "int", "reasonLimit", ",", "final", "int", "reasonActualValue", ",", "final", "int", "hardAdmissionPosition", ",", "JobAdmissionWaitInfo", "jobAdmissionWaitInfo",...
Compose the reason message. @param reason Reason why not admitted @param reasonLimit Limit exceeded @param reasonActualValue Actual value that exceed limit @param hardAdmissionPosition If in hard admission control, position in the queue @return String explaining the issue
[ "Compose", "the", "reason", "message", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/NotAdmittedJobInfo.java#L65-L98
118,437
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/pipes/PipesPartitioner.java
PipesPartitioner.getPartition
public int getPartition(K key, V value, int numPartitions) { Integer result = cache.get(); if (result == null) { return part.getPartition(key, value, numPartitions); } else { return result; } }
java
public int getPartition(K key, V value, int numPartitions) { Integer result = cache.get(); if (result == null) { return part.getPartition(key, value, numPartitions); } else { return result; } }
[ "public", "int", "getPartition", "(", "K", "key", ",", "V", "value", ",", "int", "numPartitions", ")", "{", "Integer", "result", "=", "cache", ".", "get", "(", ")", ";", "if", "(", "result", "==", "null", ")", "{", "return", "part", ".", "getPartitio...
If a partition result was set manually, return it. Otherwise, we call the Java partitioner. @param key the key to partition @param value the value to partition @param numPartitions the number of reduces
[ "If", "a", "partition", "result", "was", "set", "manually", "return", "it", ".", "Otherwise", "we", "call", "the", "Java", "partitioner", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/pipes/PipesPartitioner.java#L59-L67
118,438
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java
BlockReconstructor.isParityFile
boolean isParityFile(Path p, Codec c) { return isParityFile(p.toUri().getPath(), c); }
java
boolean isParityFile(Path p, Codec c) { return isParityFile(p.toUri().getPath(), c); }
[ "boolean", "isParityFile", "(", "Path", "p", ",", "Codec", "c", ")", "{", "return", "isParityFile", "(", "p", ".", "toUri", "(", ")", ".", "getPath", "(", ")", ",", "c", ")", ";", "}" ]
Is the path a parity file of a given Codec?
[ "Is", "the", "path", "a", "parity", "file", "of", "a", "given", "Codec?" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java#L81-L83
118,439
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java
BlockReconstructor.reconstructFile
boolean reconstructFile(Path srcPath, Context context) throws IOException, InterruptedException { Progressable progress = context; if (progress == null) { progress = RaidUtils.NULL_PROGRESSABLE; } FileSystem fs = srcPath.getFileSystem(getConf()); FileStatus srcStat = null; try {...
java
boolean reconstructFile(Path srcPath, Context context) throws IOException, InterruptedException { Progressable progress = context; if (progress == null) { progress = RaidUtils.NULL_PROGRESSABLE; } FileSystem fs = srcPath.getFileSystem(getConf()); FileStatus srcStat = null; try {...
[ "boolean", "reconstructFile", "(", "Path", "srcPath", ",", "Context", "context", ")", "throws", "IOException", ",", "InterruptedException", "{", "Progressable", "progress", "=", "context", ";", "if", "(", "progress", "==", "null", ")", "{", "progress", "=", "R...
Fix a file, report progess. @return true if file was reconstructed, false if no reconstruction was necessary or possible.
[ "Fix", "a", "file", "report", "progess", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java#L98-L157
118,440
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java
BlockReconstructor.sortLostFiles
void sortLostFiles(List<String> files) { // TODO: We should first fix the files that lose more blocks Comparator<String> comp = new Comparator<String>() { public int compare(String p1, String p2) { Codec c1 = null; Codec c2 = null; for (Codec codec : Codec.getCodecs()) { ...
java
void sortLostFiles(List<String> files) { // TODO: We should first fix the files that lose more blocks Comparator<String> comp = new Comparator<String>() { public int compare(String p1, String p2) { Codec c1 = null; Codec c2 = null; for (Codec codec : Codec.getCodecs()) { ...
[ "void", "sortLostFiles", "(", "List", "<", "String", ">", "files", ")", "{", "// TODO: We should first fix the files that lose more blocks", "Comparator", "<", "String", ">", "comp", "=", "new", "Comparator", "<", "String", ">", "(", ")", "{", "public", "int", "...
Sorts source files ahead of parity files.
[ "Sorts", "source", "files", "ahead", "of", "parity", "files", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java#L162-L188
118,441
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java
BlockReconstructor.getDFS
protected DistributedFileSystem getDFS(Path p) throws IOException { FileSystem fs = p.getFileSystem(getConf()); DistributedFileSystem dfs = null; if (fs instanceof DistributedFileSystem) { dfs = (DistributedFileSystem) fs; } else if (fs instanceof FilterFileSystem) { FilterFileSystem ffs = (...
java
protected DistributedFileSystem getDFS(Path p) throws IOException { FileSystem fs = p.getFileSystem(getConf()); DistributedFileSystem dfs = null; if (fs instanceof DistributedFileSystem) { dfs = (DistributedFileSystem) fs; } else if (fs instanceof FilterFileSystem) { FilterFileSystem ffs = (...
[ "protected", "DistributedFileSystem", "getDFS", "(", "Path", "p", ")", "throws", "IOException", "{", "FileSystem", "fs", "=", "p", ".", "getFileSystem", "(", "getConf", "(", ")", ")", ";", "DistributedFileSystem", "dfs", "=", "null", ";", "if", "(", "fs", ...
Returns a DistributedFileSystem hosting the path supplied.
[ "Returns", "a", "DistributedFileSystem", "hosting", "the", "path", "supplied", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java#L193-L205
118,442
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java
BlockReconstructor.checkLostBlocks
void checkLostBlocks(List<Block> blocksLostChecksum, List<Block> blocksLostStripe, Path p, Codec codec) throws IOException { StringBuilder message = new StringBuilder(); if (blocksLostChecksum.size() > 0) { message.append("Lost " + blocksLostChecksum.size() + " checksums in blocks:")...
java
void checkLostBlocks(List<Block> blocksLostChecksum, List<Block> blocksLostStripe, Path p, Codec codec) throws IOException { StringBuilder message = new StringBuilder(); if (blocksLostChecksum.size() > 0) { message.append("Lost " + blocksLostChecksum.size() + " checksums in blocks:")...
[ "void", "checkLostBlocks", "(", "List", "<", "Block", ">", "blocksLostChecksum", ",", "List", "<", "Block", ">", "blocksLostStripe", ",", "Path", "p", ",", "Codec", "codec", ")", "throws", "IOException", "{", "StringBuilder", "message", "=", "new", "StringBuil...
Throw exceptions for blocks with lost checksums or stripes
[ "Throw", "exceptions", "for", "blocks", "with", "lost", "checksums", "or", "stripes" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java#L210-L234
118,443
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java
BlockReconstructor.processParityHarPartFile
boolean processParityHarPartFile(Path partFile, Progressable progress) throws IOException { LOG.info("Processing parity HAR file " + partFile); // Get some basic information. DistributedFileSystem dfs = getDFS(partFile); FileStatus partFileStat = dfs.getFileStatus(partFile); long partFileBlo...
java
boolean processParityHarPartFile(Path partFile, Progressable progress) throws IOException { LOG.info("Processing parity HAR file " + partFile); // Get some basic information. DistributedFileSystem dfs = getDFS(partFile); FileStatus partFileStat = dfs.getFileStatus(partFile); long partFileBlo...
[ "boolean", "processParityHarPartFile", "(", "Path", "partFile", ",", "Progressable", "progress", ")", "throws", "IOException", "{", "LOG", ".", "info", "(", "\"Processing parity HAR file \"", "+", "partFile", ")", ";", "// Get some basic information.", "DistributedFileSys...
Reads through a parity HAR part file, reconstructing lost blocks on the way. A HAR block can contain many file blocks, as long as the HAR part file block size is a multiple of the file block size. @return true if file was reconstructed, false if no reconstruction was necessary or possible.
[ "Reads", "through", "a", "parity", "HAR", "part", "file", "reconstructing", "lost", "blocks", "on", "the", "way", ".", "A", "HAR", "block", "can", "contain", "many", "file", "blocks", "as", "long", "as", "the", "HAR", "part", "file", "block", "size", "is...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java#L469-L523
118,444
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java
BlockReconstructor.processParityHarPartBlock
private void processParityHarPartBlock(FileSystem dfs, Path partFile, long blockOffset, FileStatus partFileStat, HarIndex harIndex, File localBlockFile, Progressable progress) throws IOException { String partName = partFile.toUri().getPath(); // Temporarily. partName = partName.s...
java
private void processParityHarPartBlock(FileSystem dfs, Path partFile, long blockOffset, FileStatus partFileStat, HarIndex harIndex, File localBlockFile, Progressable progress) throws IOException { String partName = partFile.toUri().getPath(); // Temporarily. partName = partName.s...
[ "private", "void", "processParityHarPartBlock", "(", "FileSystem", "dfs", ",", "Path", "partFile", ",", "long", "blockOffset", ",", "FileStatus", "partFileStat", ",", "HarIndex", "harIndex", ",", "File", "localBlockFile", ",", "Progressable", "progress", ")", "throw...
This reconstructs a single part file block by recovering in sequence each parity block in the part file block.
[ "This", "reconstructs", "a", "single", "part", "file", "block", "by", "recovering", "in", "sequence", "each", "parity", "block", "in", "the", "part", "file", "block", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java#L529-L603
118,445
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java
BlockReconstructor.computeMetadata
DataInputStream computeMetadata(Configuration conf, InputStream dataStream) throws IOException { ByteArrayOutputStream mdOutBase = new ByteArrayOutputStream(1024*1024); DataOutputStream mdOut = new DataOutputStream(mdOutBase); // First, write out the version. mdOut.writeShort(FSDataset.FORMAT_VERSION...
java
DataInputStream computeMetadata(Configuration conf, InputStream dataStream) throws IOException { ByteArrayOutputStream mdOutBase = new ByteArrayOutputStream(1024*1024); DataOutputStream mdOut = new DataOutputStream(mdOutBase); // First, write out the version. mdOut.writeShort(FSDataset.FORMAT_VERSION...
[ "DataInputStream", "computeMetadata", "(", "Configuration", "conf", ",", "InputStream", "dataStream", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "mdOutBase", "=", "new", "ByteArrayOutputStream", "(", "1024", "*", "1024", ")", ";", "DataOutputStream", ...
Reads data from the data stream provided and computes metadata.
[ "Reads", "data", "from", "the", "data", "stream", "provided", "and", "computes", "metadata", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java#L649-L701
118,446
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java
BlockReconstructor.sendReconstructedBlock
private void sendReconstructedBlock(String datanode, final FileInputStream blockContents, final DataInputStream metadataIn, Block block, long blockSize, int dataTransferVersion, int namespaceId, Progressable progress) throws IOException { InetSocketAddress target = NetUtils.createSo...
java
private void sendReconstructedBlock(String datanode, final FileInputStream blockContents, final DataInputStream metadataIn, Block block, long blockSize, int dataTransferVersion, int namespaceId, Progressable progress) throws IOException { InetSocketAddress target = NetUtils.createSo...
[ "private", "void", "sendReconstructedBlock", "(", "String", "datanode", ",", "final", "FileInputStream", "blockContents", ",", "final", "DataInputStream", "metadataIn", ",", "Block", "block", ",", "long", "blockSize", ",", "int", "dataTransferVersion", ",", "int", "...
Send a generated block to a datanode. @param datanode Chosen datanode name in host:port form. @param blockContents Stream with the block contents. @param block Block object identifying the block to be sent. @param blockSize size of the block. @param dataTransferVersion the data transfer version @param namespaceId names...
[ "Send", "a", "generated", "block", "to", "a", "datanode", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java#L773-L846
118,447
facebookarchive/hadoop-20
src/core/org/apache/hadoop/security/UserGroupInformation.java
UserGroupInformation.login
public static UserGroupInformation login(Configuration conf ) throws LoginException { if (LOGIN_UGI == null) { LOGIN_UGI = UnixUserGroupInformation.login(conf); } return LOGIN_UGI; }
java
public static UserGroupInformation login(Configuration conf ) throws LoginException { if (LOGIN_UGI == null) { LOGIN_UGI = UnixUserGroupInformation.login(conf); } return LOGIN_UGI; }
[ "public", "static", "UserGroupInformation", "login", "(", "Configuration", "conf", ")", "throws", "LoginException", "{", "if", "(", "LOGIN_UGI", "==", "null", ")", "{", "LOGIN_UGI", "=", "UnixUserGroupInformation", ".", "login", "(", "conf", ")", ";", "}", "re...
Login and return a UserGroupInformation object.
[ "Login", "and", "return", "a", "UserGroupInformation", "object", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/security/UserGroupInformation.java#L115-L121
118,448
facebookarchive/hadoop-20
src/core/org/apache/hadoop/security/UserGroupInformation.java
UserGroupInformation.getUGI
public static UserGroupInformation getUGI(Configuration conf) throws LoginException { UserGroupInformation ugi = null; if (conf.getBoolean(UGI_SOURCE, true)) { // get the ugi from configuration ugi = UnixUserGroupInformation.readFromConf(conf, UnixUserGroupInformation.UGI_PROPERTY_NAME); ...
java
public static UserGroupInformation getUGI(Configuration conf) throws LoginException { UserGroupInformation ugi = null; if (conf.getBoolean(UGI_SOURCE, true)) { // get the ugi from configuration ugi = UnixUserGroupInformation.readFromConf(conf, UnixUserGroupInformation.UGI_PROPERTY_NAME); ...
[ "public", "static", "UserGroupInformation", "getUGI", "(", "Configuration", "conf", ")", "throws", "LoginException", "{", "UserGroupInformation", "ugi", "=", "null", ";", "if", "(", "conf", ".", "getBoolean", "(", "UGI_SOURCE", ",", "true", ")", ")", "{", "// ...
get the current user id
[ "get", "the", "current", "user", "id" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/security/UserGroupInformation.java#L135-L154
118,449
facebookarchive/hadoop-20
src/core/org/apache/hadoop/security/UserGroupInformation.java
UserGroupInformation.doAs
public <T> T doAs(PrivilegedAction<T> action) { return Subject.doAs(null, action); }
java
public <T> T doAs(PrivilegedAction<T> action) { return Subject.doAs(null, action); }
[ "public", "<", "T", ">", "T", "doAs", "(", "PrivilegedAction", "<", "T", ">", "action", ")", "{", "return", "Subject", ".", "doAs", "(", "null", ",", "action", ")", ";", "}" ]
Run the given action as the user. @param <T> the return type of the run method @param action the method to execute @return the value from the run method
[ "Run", "the", "given", "action", "as", "the", "user", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/security/UserGroupInformation.java#L162-L164
118,450
facebookarchive/hadoop-20
src/core/org/apache/hadoop/security/UserGroupInformation.java
UserGroupInformation.doAs
public <T> T doAs(PrivilegedExceptionAction<T> action ) throws IOException, InterruptedException { try { return Subject.doAs(null, action); } catch (PrivilegedActionException pae) { Throwable cause = pae.getCause(); LOG.error("PriviledgedActionException as:"+this+" cause:"+cause); if (...
java
public <T> T doAs(PrivilegedExceptionAction<T> action ) throws IOException, InterruptedException { try { return Subject.doAs(null, action); } catch (PrivilegedActionException pae) { Throwable cause = pae.getCause(); LOG.error("PriviledgedActionException as:"+this+" cause:"+cause); if (...
[ "public", "<", "T", ">", "T", "doAs", "(", "PrivilegedExceptionAction", "<", "T", ">", "action", ")", "throws", "IOException", ",", "InterruptedException", "{", "try", "{", "return", "Subject", ".", "doAs", "(", "null", ",", "action", ")", ";", "}", "cat...
Run the given action as the user, potentially throwing an exception. @param <T> the return type of the run method @param action the method to execute @return the value from the run method @throws IOException if the action throws an IOException @throws Error if the action throws an Error @throws RuntimeException if the ...
[ "Run", "the", "given", "action", "as", "the", "user", "potentially", "throwing", "an", "exception", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/security/UserGroupInformation.java#L177-L196
118,451
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorReducer.java
ValueAggregatorReducer.map
public void map(K1 arg0, V1 arg1, OutputCollector<Text, Text> arg2, Reporter arg3) throws IOException { throw new IOException ("should not be called\n"); }
java
public void map(K1 arg0, V1 arg1, OutputCollector<Text, Text> arg2, Reporter arg3) throws IOException { throw new IOException ("should not be called\n"); }
[ "public", "void", "map", "(", "K1", "arg0", ",", "V1", "arg1", ",", "OutputCollector", "<", "Text", ",", "Text", ">", "arg2", ",", "Reporter", "arg3", ")", "throws", "IOException", "{", "throw", "new", "IOException", "(", "\"should not be called\\n\"", ")", ...
Do nothing. Should not be called
[ "Do", "nothing", ".", "Should", "not", "be", "called" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorReducer.java#L70-L73
118,452
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/RaidUtils.java
RaidUtils.getFileRaidInfo
public static RaidInfo getFileRaidInfo(final FileStatus stat, Configuration conf, boolean skipHarChecking) throws IOException { // now look for the parity file ParityFilePair ppair = null; for (Codec c : Codec.getCodecs()) { ppair = ParityFilePair.getParityFile(c, stat, conf, skipHarCheckin...
java
public static RaidInfo getFileRaidInfo(final FileStatus stat, Configuration conf, boolean skipHarChecking) throws IOException { // now look for the parity file ParityFilePair ppair = null; for (Codec c : Codec.getCodecs()) { ppair = ParityFilePair.getParityFile(c, stat, conf, skipHarCheckin...
[ "public", "static", "RaidInfo", "getFileRaidInfo", "(", "final", "FileStatus", "stat", ",", "Configuration", "conf", ",", "boolean", "skipHarChecking", ")", "throws", "IOException", "{", "// now look for the parity file", "ParityFilePair", "ppair", "=", "null", ";", "...
returns the raid for a given file
[ "returns", "the", "raid", "for", "a", "given", "file" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/RaidUtils.java#L112-L124
118,453
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/RaidUtils.java
RaidUtils.getParityBlocks
private static BlockLocation[] getParityBlocks(final Path filePath, final long blockSize, final long numStripes, final RaidInfo raidInfo) throws IOException { FileSystem parityFS = raid...
java
private static BlockLocation[] getParityBlocks(final Path filePath, final long blockSize, final long numStripes, final RaidInfo raidInfo) throws IOException { FileSystem parityFS = raid...
[ "private", "static", "BlockLocation", "[", "]", "getParityBlocks", "(", "final", "Path", "filePath", ",", "final", "long", "blockSize", ",", "final", "long", "numStripes", ",", "final", "RaidInfo", "raidInfo", ")", "throws", "IOException", "{", "FileSystem", "pa...
gets the parity blocks corresponding to file returns the parity blocks in case of DFS and the part blocks containing parity blocks in case of HAR FS
[ "gets", "the", "parity", "blocks", "corresponding", "to", "file", "returns", "the", "parity", "blocks", "in", "case", "of", "DFS", "and", "the", "part", "blocks", "containing", "parity", "blocks", "in", "case", "of", "HAR", "FS" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/RaidUtils.java#L232-L270
118,454
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/RaidUtils.java
RaidUtils.checkParityBlocks
private static void checkParityBlocks(final Path filePath, final Map<Integer, Integer> corruptBlocksPerStripe, final long blockSize, final long startStripeIdx, ...
java
private static void checkParityBlocks(final Path filePath, final Map<Integer, Integer> corruptBlocksPerStripe, final long blockSize, final long startStripeIdx, ...
[ "private", "static", "void", "checkParityBlocks", "(", "final", "Path", "filePath", ",", "final", "Map", "<", "Integer", ",", "Integer", ">", "corruptBlocksPerStripe", ",", "final", "long", "blockSize", ",", "final", "long", "startStripeIdx", ",", "final", "long...
checks the parity blocks for a given file and modifies corruptBlocksPerStripe accordingly
[ "checks", "the", "parity", "blocks", "for", "a", "given", "file", "and", "modifies", "corruptBlocksPerStripe", "accordingly" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/RaidUtils.java#L277-L351
118,455
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/RaidUtils.java
RaidUtils.sourcePathFromParityPath
public static Path sourcePathFromParityPath(Path parityPath, FileSystem fs) throws IOException { String parityPathStr = parityPath.toUri().getPath(); for (Codec codec : Codec.getCodecs()) { String prefix = codec.getParityPrefix(); if (parityPathStr.startsWith(prefix)) { // Remove th...
java
public static Path sourcePathFromParityPath(Path parityPath, FileSystem fs) throws IOException { String parityPathStr = parityPath.toUri().getPath(); for (Codec codec : Codec.getCodecs()) { String prefix = codec.getParityPrefix(); if (parityPathStr.startsWith(prefix)) { // Remove th...
[ "public", "static", "Path", "sourcePathFromParityPath", "(", "Path", "parityPath", ",", "FileSystem", "fs", ")", "throws", "IOException", "{", "String", "parityPathStr", "=", "parityPath", ".", "toUri", "(", ")", ".", "getPath", "(", ")", ";", "for", "(", "C...
returns the source file corresponding to a parity file @throws IOException
[ "returns", "the", "source", "file", "corresponding", "to", "a", "parity", "file" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/RaidUtils.java#L375-L390
118,456
facebookarchive/hadoop-20
src/core/org/apache/hadoop/util/ChecksumUtil.java
ChecksumUtil.updateChunkChecksum
public static void updateChunkChecksum( byte[] buf, int checksumOff, int dataOff, int dataLen, DataChecksum checksum ) throws IOException { int bytesPerChecksum = checksum.getBytesPerChecksum(); int checksumSize = checksum.getChecksumSize(); int curChecksumOff = checksumOff; int c...
java
public static void updateChunkChecksum( byte[] buf, int checksumOff, int dataOff, int dataLen, DataChecksum checksum ) throws IOException { int bytesPerChecksum = checksum.getBytesPerChecksum(); int checksumSize = checksum.getChecksumSize(); int curChecksumOff = checksumOff; int c...
[ "public", "static", "void", "updateChunkChecksum", "(", "byte", "[", "]", "buf", ",", "int", "checksumOff", ",", "int", "dataOff", ",", "int", "dataLen", ",", "DataChecksum", "checksum", ")", "throws", "IOException", "{", "int", "bytesPerChecksum", "=", "check...
updates the checksum for a buffer @param buf - buffer to update the checksum in @param chunkOff - offset in the buffer where the checksum is to update @param dataOff - offset in the buffer of the data @param dataLen - length of data to compute checksum on
[ "updates", "the", "checksum", "for", "a", "buffer" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ChecksumUtil.java#L14-L39
118,457
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/IOUtils.java
IOUtils.copyBytesAndGenerateCRC
public static long copyBytesAndGenerateCRC(InputStream in, OutputStream out, int buffSize, boolean close, IOThrottler throttler) throws IOException { PrintStream ps = out instanceof PrintStream ? (PrintStream)out : null; byte buf[] = new byte[buffSize]; Checksum sum = new NativeCrc32(); ...
java
public static long copyBytesAndGenerateCRC(InputStream in, OutputStream out, int buffSize, boolean close, IOThrottler throttler) throws IOException { PrintStream ps = out instanceof PrintStream ? (PrintStream)out : null; byte buf[] = new byte[buffSize]; Checksum sum = new NativeCrc32(); ...
[ "public", "static", "long", "copyBytesAndGenerateCRC", "(", "InputStream", "in", ",", "OutputStream", "out", ",", "int", "buffSize", ",", "boolean", "close", ",", "IOThrottler", "throttler", ")", "throws", "IOException", "{", "PrintStream", "ps", "=", "out", "in...
Copies from one stream to another and generate CRC checksum. @param in InputStrem to read from @param out OutputStream to write to @param buffSize the size of the buffer @param close whether or not close the InputStream and @param throttler IO Throttler OutputStream at the end. The streams are closed in the finally cla...
[ "Copies", "from", "one", "stream", "to", "another", "and", "generate", "CRC", "checksum", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/IOUtils.java#L100-L131
118,458
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/IOUtils.java
IOUtils.writeFully
public static void writeFully(FileChannel fc, ByteBuffer buf, long offset) throws IOException { do { offset += fc.write(buf, offset); } while (buf.remaining() > 0); }
java
public static void writeFully(FileChannel fc, ByteBuffer buf, long offset) throws IOException { do { offset += fc.write(buf, offset); } while (buf.remaining() > 0); }
[ "public", "static", "void", "writeFully", "(", "FileChannel", "fc", ",", "ByteBuffer", "buf", ",", "long", "offset", ")", "throws", "IOException", "{", "do", "{", "offset", "+=", "fc", ".", "write", "(", "buf", ",", "offset", ")", ";", "}", "while", "(...
Write a ByteBuffer to a FileChannel at a given offset, handling short writes. @param fc The FileChannel to write to @param buf The input buffer @param offset The offset in the file to start writing at @throws IOException On I/O error
[ "Write", "a", "ByteBuffer", "to", "a", "FileChannel", "at", "a", "given", "offset", "handling", "short", "writes", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/IOUtils.java#L355-L360
118,459
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/WritableUtils.java
WritableUtils.cloneInto
@Deprecated public static void cloneInto(Writable dst, Writable src) throws IOException { ReflectionUtils.cloneWritableInto(dst, src); }
java
@Deprecated public static void cloneInto(Writable dst, Writable src) throws IOException { ReflectionUtils.cloneWritableInto(dst, src); }
[ "@", "Deprecated", "public", "static", "void", "cloneInto", "(", "Writable", "dst", ",", "Writable", "src", ")", "throws", "IOException", "{", "ReflectionUtils", ".", "cloneWritableInto", "(", "dst", ",", "src", ")", ";", "}" ]
Make a copy of the writable object using serialiation to a buffer @param dst the object to copy from @param src the object to copy into, which is destroyed @throws IOException @deprecated use ReflectionUtils.cloneInto instead.
[ "Make", "a", "copy", "of", "the", "writable", "object", "using", "serialiation", "to", "a", "buffer" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/WritableUtils.java#L224-L227
118,460
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/WritableUtils.java
WritableUtils.readStringSafely
public static String readStringSafely( DataInput in, int maxLength) throws IOException, IllegalArgumentException { int length = readVInt(in); if (length < 0 || length > maxLength) { throw new IllegalArgumentException( "Encoded byte size for String was " + length + ", which ...
java
public static String readStringSafely( DataInput in, int maxLength) throws IOException, IllegalArgumentException { int length = readVInt(in); if (length < 0 || length > maxLength) { throw new IllegalArgumentException( "Encoded byte size for String was " + length + ", which ...
[ "public", "static", "String", "readStringSafely", "(", "DataInput", "in", ",", "int", "maxLength", ")", "throws", "IOException", ",", "IllegalArgumentException", "{", "int", "length", "=", "readVInt", "(", "in", ")", ";", "if", "(", "length", "<", "0", "||",...
Read a string, but check it for sanity. The format consists of a vint followed by the given number of bytes. @param in the stream to read from @param maxLength the largest acceptable length of the encoded string @return the bytes as a string @throws IOException if reading from the DataInput fails @throws IllegalArgumen...
[ "Read", "a", "string", "but", "check", "it", "for", "sanity", ".", "The", "format", "consists", "of", "a", "vint", "followed", "by", "the", "given", "number", "of", "bytes", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/WritableUtils.java#L431-L444
118,461
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/BookKeeperEditLogOutputStream.java
BookKeeperEditLogOutputStream.flushAndSync
@Override protected void flushAndSync(boolean durable) throws IOException { if (outputStream == null) { throw new IOException("Trying to use aborted output stream!"); } if (doubleBuf.isFlushed()) { return; } // Under the covers, this invokes a method that does not return until // w...
java
@Override protected void flushAndSync(boolean durable) throws IOException { if (outputStream == null) { throw new IOException("Trying to use aborted output stream!"); } if (doubleBuf.isFlushed()) { return; } // Under the covers, this invokes a method that does not return until // w...
[ "@", "Override", "protected", "void", "flushAndSync", "(", "boolean", "durable", ")", "throws", "IOException", "{", "if", "(", "outputStream", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Trying to use aborted output stream!\"", ")", ";", "}", ...
Flush the contents of the "ready" buffer to a durable BookKeeper ledger BookKeeper ledger. After this method returns, we are guaranteed to have persisted the log records stored in the ready buffer to a quorum of bookies that store the underlying ledger.
[ "Flush", "the", "contents", "of", "the", "ready", "buffer", "to", "a", "durable", "BookKeeper", "ledger", "BookKeeper", "ledger", ".", "After", "this", "method", "returns", "we", "are", "guaranteed", "to", "have", "persisted", "the", "log", "records", "stored"...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/BookKeeperEditLogOutputStream.java#L162-L173
118,462
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java
AvatarNode.waitForRestart
public void waitForRestart() { if (standbyThread != null) { try { // if this is the standby avatarnode, then wait for the Standby to exit standbyThread.join(); } catch (InterruptedException ie) { //eat it up } standbyThread = null; LOG.info("waitForRestart: Stan...
java
public void waitForRestart() { if (standbyThread != null) { try { // if this is the standby avatarnode, then wait for the Standby to exit standbyThread.join(); } catch (InterruptedException ie) { //eat it up } standbyThread = null; LOG.info("waitForRestart: Stan...
[ "public", "void", "waitForRestart", "(", ")", "{", "if", "(", "standbyThread", "!=", "null", ")", "{", "try", "{", "// if this is the standby avatarnode, then wait for the Standby to exit", "standbyThread", ".", "join", "(", ")", ";", "}", "catch", "(", "Interrupted...
Wait for the StandbyNode to exit. If it does, then stop the underlying namenode.
[ "Wait", "for", "the", "StandbyNode", "to", "exit", ".", "If", "it", "does", "then", "stop", "the", "underlying", "namenode", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L282-L318
118,463
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java
AvatarNode.getProtocolVersion
public long getProtocolVersion(String protocol, long clientVersion) throws IOException { if (protocol.equals(AvatarProtocol.class.getName())) { return AvatarProtocol.versionID; } else { return super.getProtocolVersion(protocol, clientVersion); } }
java
public long getProtocolVersion(String protocol, long clientVersion) throws IOException { if (protocol.equals(AvatarProtocol.class.getName())) { return AvatarProtocol.versionID; } else { return super.getProtocolVersion(protocol, clientVersion); } }
[ "public", "long", "getProtocolVersion", "(", "String", "protocol", ",", "long", "clientVersion", ")", "throws", "IOException", "{", "if", "(", "protocol", ".", "equals", "(", "AvatarProtocol", ".", "class", ".", "getName", "(", ")", ")", ")", "{", "return", ...
If the specified protocol is AvatarProtocol, then return the AvatarProtocol version id, otherwise delegate to the underlying namenode.
[ "If", "the", "specified", "protocol", "is", "AvatarProtocol", "then", "return", "the", "AvatarProtocol", "version", "id", "otherwise", "delegate", "to", "the", "underlying", "namenode", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L379-L386
118,464
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java
AvatarNode.verifyEditStreams
private void verifyEditStreams() throws IOException { // we check if the shared stream is still available if (getFSImage().getEditLog().isSharedJournalAvailable() && InjectionHandler .trueCondition(InjectionEvent.AVATARNODE_CHECKEDITSTREAMS)) { return; } // for sanity check if...
java
private void verifyEditStreams() throws IOException { // we check if the shared stream is still available if (getFSImage().getEditLog().isSharedJournalAvailable() && InjectionHandler .trueCondition(InjectionEvent.AVATARNODE_CHECKEDITSTREAMS)) { return; } // for sanity check if...
[ "private", "void", "verifyEditStreams", "(", ")", "throws", "IOException", "{", "// we check if the shared stream is still available", "if", "(", "getFSImage", "(", ")", ".", "getEditLog", "(", ")", ".", "isSharedJournalAvailable", "(", ")", "&&", "InjectionHandler", ...
Return true if the shared journal is active, or if the number of active journals is equal to the number of configured journals. Throw IOException otherwise.
[ "Return", "true", "if", "the", "shared", "journal", "is", "active", "or", "if", "the", "number", "of", "active", "journals", "is", "equal", "to", "the", "number", "of", "configured", "journals", ".", "Throw", "IOException", "otherwise", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L526-L551
118,465
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java
AvatarNode.shutdown
public synchronized void shutdown(boolean synchronous) throws IOException { LOG.info("Failover: Asynchronous shutdown for: " + currentAvatar); // check permissions before any other actions super.namesystem.checkSuperuserPrivilege(); if (runInfo.shutdown) { LOG.info("Failover: Node alread...
java
public synchronized void shutdown(boolean synchronous) throws IOException { LOG.info("Failover: Asynchronous shutdown for: " + currentAvatar); // check permissions before any other actions super.namesystem.checkSuperuserPrivilege(); if (runInfo.shutdown) { LOG.info("Failover: Node alread...
[ "public", "synchronized", "void", "shutdown", "(", "boolean", "synchronous", ")", "throws", "IOException", "{", "LOG", ".", "info", "(", "\"Failover: Asynchronous shutdown for: \"", "+", "currentAvatar", ")", ";", "// check permissions before any other actions", "super", ...
Shuts down the avatar node @param synchronous - should the function wait for the shutdown to complete @throws IOException
[ "Shuts", "down", "the", "avatar", "node" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L558-L588
118,466
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java
AvatarNode.stopRPC
protected void stopRPC(boolean interruptClientHandlers) throws IOException { try { // stop avatardatanode server stopRPCInternal(server, "avatardatanode", interruptClientHandlers); // stop namenode rpc (client, datanode) super.stopRPC(interruptClientHandlers); // wait for ...
java
protected void stopRPC(boolean interruptClientHandlers) throws IOException { try { // stop avatardatanode server stopRPCInternal(server, "avatardatanode", interruptClientHandlers); // stop namenode rpc (client, datanode) super.stopRPC(interruptClientHandlers); // wait for ...
[ "protected", "void", "stopRPC", "(", "boolean", "interruptClientHandlers", ")", "throws", "IOException", "{", "try", "{", "// stop avatardatanode server", "stopRPCInternal", "(", "server", ",", "\"avatardatanode\"", ",", "interruptClientHandlers", ")", ";", "// stop namen...
Stops all RPC threads and ensures that all RPC handlers have exited. Stops all communication to the namenode.
[ "Stops", "all", "RPC", "threads", "and", "ensures", "that", "all", "RPC", "handlers", "have", "exited", ".", "Stops", "all", "communication", "to", "the", "namenode", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L651-L664
118,467
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java
AvatarNode.printUsage
private static void printUsage() { System.err.println( "Usage: java AvatarNode [" + StartupOption.STANDBY.getName() + "] | [" + StartupOption.NODEZERO.getName() + "] | [" + StartupOption.NODEONE.getName() + "] | [" + StartupOption.FORMAT.getName() + "] | [" + StartupOption.UPGRAD...
java
private static void printUsage() { System.err.println( "Usage: java AvatarNode [" + StartupOption.STANDBY.getName() + "] | [" + StartupOption.NODEZERO.getName() + "] | [" + StartupOption.NODEONE.getName() + "] | [" + StartupOption.FORMAT.getName() + "] | [" + StartupOption.UPGRAD...
[ "private", "static", "void", "printUsage", "(", ")", "{", "System", ".", "err", ".", "println", "(", "\"Usage: java AvatarNode [\"", "+", "StartupOption", ".", "STANDBY", ".", "getName", "(", ")", "+", "\"] | [\"", "+", "StartupOption", ".", "NODEZERO", ".", ...
Help message for a user
[ "Help", "message", "for", "a", "user" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L1424-L1435
118,468
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java
AvatarNode.validateStartupOptions
static void validateStartupOptions(StartupInfo startInfo) throws IOException { // sync cannot be specified along with format or finalize if (startInfo.isStandby) { if (startInfo.startOpt == StartupOption.FORMAT || startInfo.startOpt == StartupOption.FINALIZE || startInfo.startOpt == St...
java
static void validateStartupOptions(StartupInfo startInfo) throws IOException { // sync cannot be specified along with format or finalize if (startInfo.isStandby) { if (startInfo.startOpt == StartupOption.FORMAT || startInfo.startOpt == StartupOption.FINALIZE || startInfo.startOpt == St...
[ "static", "void", "validateStartupOptions", "(", "StartupInfo", "startInfo", ")", "throws", "IOException", "{", "// sync cannot be specified along with format or finalize", "if", "(", "startInfo", ".", "isStandby", ")", "{", "if", "(", "startInfo", ".", "startOpt", "=="...
validates command line arguments
[ "validates", "command", "line", "arguments" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L1440-L1451
118,469
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java
AvatarNode.parseArguments
private static StartupInfo parseArguments(String args[]) { InstanceId instance = InstanceId.NODEZERO; StartupOption startOpt = StartupOption.REGULAR; boolean isStandby= false; String serviceName = null; boolean force = false; int argsLen = (args == null) ? 0 : args.length; for (int i=0; i < ...
java
private static StartupInfo parseArguments(String args[]) { InstanceId instance = InstanceId.NODEZERO; StartupOption startOpt = StartupOption.REGULAR; boolean isStandby= false; String serviceName = null; boolean force = false; int argsLen = (args == null) ? 0 : args.length; for (int i=0; i < ...
[ "private", "static", "StartupInfo", "parseArguments", "(", "String", "args", "[", "]", ")", "{", "InstanceId", "instance", "=", "InstanceId", ".", "NODEZERO", ";", "StartupOption", "startOpt", "=", "StartupOption", ".", "REGULAR", ";", "boolean", "isStandby", "=...
Analyze the command line options
[ "Analyze", "the", "command", "line", "options" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L1473-L1515
118,470
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java
AvatarNode.initializeGenericKeys
public static void initializeGenericKeys(Configuration conf, String serviceKey) { if ((serviceKey == null) || serviceKey.isEmpty()) { return; } NameNode.initializeGenericKeys(conf, serviceKey); DFSUtil.setGenericConf(conf, serviceKey, AVATARSERVICE_SPECIFIC...
java
public static void initializeGenericKeys(Configuration conf, String serviceKey) { if ((serviceKey == null) || serviceKey.isEmpty()) { return; } NameNode.initializeGenericKeys(conf, serviceKey); DFSUtil.setGenericConf(conf, serviceKey, AVATARSERVICE_SPECIFIC...
[ "public", "static", "void", "initializeGenericKeys", "(", "Configuration", "conf", ",", "String", "serviceKey", ")", "{", "if", "(", "(", "serviceKey", "==", "null", ")", "||", "serviceKey", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "NameNode...
In federation configuration is set for a set of avartanodes, namenodes etc, which are grouped under a logical nameservice ID. The configuration keys specific to them have suffix set to configured nameserviceId. This method copies the value from specific key of format key.nameserviceId to key, to set up the generic con...
[ "In", "federation", "configuration", "is", "set", "for", "a", "set", "of", "avartanodes", "namenodes", "etc", "which", "are", "grouped", "under", "a", "logical", "nameservice", "ID", ".", "The", "configuration", "keys", "specific", "to", "them", "have", "suffi...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L1581-L1591
118,471
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java
AvatarNode.adjustMetaDirectoryNames
public static void adjustMetaDirectoryNames(Configuration conf, String serviceKey) { adjustMetaDirectoryName(conf, DFS_SHARED_NAME_DIR0_KEY, serviceKey); adjustMetaDirectoryName(conf, DFS_SHARED_NAME_DIR1_KEY, serviceKey); adjustMetaDirectoryName(conf, DFS_SHARED_EDITS_DIR0_KEY, serviceKey); adjustMetaD...
java
public static void adjustMetaDirectoryNames(Configuration conf, String serviceKey) { adjustMetaDirectoryName(conf, DFS_SHARED_NAME_DIR0_KEY, serviceKey); adjustMetaDirectoryName(conf, DFS_SHARED_NAME_DIR1_KEY, serviceKey); adjustMetaDirectoryName(conf, DFS_SHARED_EDITS_DIR0_KEY, serviceKey); adjustMetaD...
[ "public", "static", "void", "adjustMetaDirectoryNames", "(", "Configuration", "conf", ",", "String", "serviceKey", ")", "{", "adjustMetaDirectoryName", "(", "conf", ",", "DFS_SHARED_NAME_DIR0_KEY", ",", "serviceKey", ")", ";", "adjustMetaDirectoryName", "(", "conf", "...
Append service name to each avatar meta directory name @param conf configuration of NameNode @param serviceKey the non-empty name of the name node service
[ "Append", "service", "name", "to", "each", "avatar", "meta", "directory", "name" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L1598-L1603
118,472
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java
AvatarNode.isPrimaryAlive
private static void isPrimaryAlive(String zkRegistry) throws IOException { String parts[] = zkRegistry.split(":"); if (parts.length != 2) { throw new IllegalArgumentException("Invalid Address : " + zkRegistry); } String host = parts[0]; int port = Integer.parseInt(parts[1]); InetSocketAddr...
java
private static void isPrimaryAlive(String zkRegistry) throws IOException { String parts[] = zkRegistry.split(":"); if (parts.length != 2) { throw new IllegalArgumentException("Invalid Address : " + zkRegistry); } String host = parts[0]; int port = Integer.parseInt(parts[1]); InetSocketAddr...
[ "private", "static", "void", "isPrimaryAlive", "(", "String", "zkRegistry", ")", "throws", "IOException", "{", "String", "parts", "[", "]", "=", "zkRegistry", ".", "split", "(", "\":\"", ")", ";", "if", "(", "parts", ".", "length", "!=", "2", ")", "{", ...
Tries to bind to the address specified in ZooKeeper, this will always fail if the primary is alive either on the same machine or on a remote machine.
[ "Tries", "to", "bind", "to", "the", "address", "specified", "in", "ZooKeeper", "this", "will", "always", "fail", "if", "the", "primary", "is", "alive", "either", "on", "the", "same", "machine", "or", "on", "a", "remote", "machine", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L1641-L1652
118,473
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java
AvatarNode.getRemoteNamenodeAddress
static InetSocketAddress getRemoteNamenodeAddress(Configuration conf, InstanceId instance) throws IOException { String fs = null; if (instance == InstanceId.NODEZERO) { fs = conf.get(DFS_NAMENODE_RPC_ADDRESS1_KEY); if (fs == null) fs = conf.get("fs.default.name1"); } else if ...
java
static InetSocketAddress getRemoteNamenodeAddress(Configuration conf, InstanceId instance) throws IOException { String fs = null; if (instance == InstanceId.NODEZERO) { fs = conf.get(DFS_NAMENODE_RPC_ADDRESS1_KEY); if (fs == null) fs = conf.get("fs.default.name1"); } else if ...
[ "static", "InetSocketAddress", "getRemoteNamenodeAddress", "(", "Configuration", "conf", ",", "InstanceId", "instance", ")", "throws", "IOException", "{", "String", "fs", "=", "null", ";", "if", "(", "instance", "==", "InstanceId", ".", "NODEZERO", ")", "{", "fs...
Returns the address of the remote namenode
[ "Returns", "the", "address", "of", "the", "remote", "namenode" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L2032-L2053
118,474
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java
AvatarNode.getRemoteNamenodeHttpName
static String getRemoteNamenodeHttpName(Configuration conf, InstanceId instance) throws IOException { if (instance == InstanceId.NODEZERO) { return conf.get("dfs.http.address1"); } else if (instance == InstanceId.NODEONE) { return conf.get("dfs.http.address0"); } else { throw n...
java
static String getRemoteNamenodeHttpName(Configuration conf, InstanceId instance) throws IOException { if (instance == InstanceId.NODEZERO) { return conf.get("dfs.http.address1"); } else if (instance == InstanceId.NODEONE) { return conf.get("dfs.http.address0"); } else { throw n...
[ "static", "String", "getRemoteNamenodeHttpName", "(", "Configuration", "conf", ",", "InstanceId", "instance", ")", "throws", "IOException", "{", "if", "(", "instance", "==", "InstanceId", ".", "NODEZERO", ")", "{", "return", "conf", ".", "get", "(", "\"dfs.http....
Returns the name of the http server of the local namenode
[ "Returns", "the", "name", "of", "the", "http", "server", "of", "the", "local", "namenode" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L2058-L2068
118,475
facebookarchive/hadoop-20
src/core/org/apache/hadoop/net/SocksSocketFactory.java
SocksSocketFactory.setProxy
private void setProxy(String proxyStr) { String[] strs = proxyStr.split(":", 2); if (strs.length != 2) throw new RuntimeException("Bad SOCKS proxy parameter: " + proxyStr); String host = strs[0]; int port = Integer.parseInt(strs[1]); this.proxy = new Proxy(Proxy.Type.SOCKS, InetSocketA...
java
private void setProxy(String proxyStr) { String[] strs = proxyStr.split(":", 2); if (strs.length != 2) throw new RuntimeException("Bad SOCKS proxy parameter: " + proxyStr); String host = strs[0]; int port = Integer.parseInt(strs[1]); this.proxy = new Proxy(Proxy.Type.SOCKS, InetSocketA...
[ "private", "void", "setProxy", "(", "String", "proxyStr", ")", "{", "String", "[", "]", "strs", "=", "proxyStr", ".", "split", "(", "\":\"", ",", "2", ")", ";", "if", "(", "strs", ".", "length", "!=", "2", ")", "throw", "new", "RuntimeException", "("...
Set the proxy of this socket factory as described in the string parameter @param proxyStr the proxy address using the format "host:port"
[ "Set", "the", "proxy", "of", "this", "socket", "factory", "as", "described", "in", "the", "string", "parameter" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/SocksSocketFactory.java#L151-L160
118,476
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/PoolMetadata.java
PoolMetadata.addResourceMetadata
public void addResourceMetadata(String resourceName, ResourceMetadata resourceMetadata) { if (resourceMetadataMap.put(resourceName, resourceMetadata) != null) { throw new RuntimeException("Resource name " + resourceName + " already exists!"); } }
java
public void addResourceMetadata(String resourceName, ResourceMetadata resourceMetadata) { if (resourceMetadataMap.put(resourceName, resourceMetadata) != null) { throw new RuntimeException("Resource name " + resourceName + " already exists!"); } }
[ "public", "void", "addResourceMetadata", "(", "String", "resourceName", ",", "ResourceMetadata", "resourceMetadata", ")", "{", "if", "(", "resourceMetadataMap", ".", "put", "(", "resourceName", ",", "resourceMetadata", ")", "!=", "null", ")", "{", "throw", "new", ...
Add resource metadata for this pool. @param resourceName Name of the resource @param resourceMetadata Resource metadata associated with the name
[ "Add", "resource", "metadata", "for", "this", "pool", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/PoolMetadata.java#L55-L61
118,477
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/PoolMetadata.java
PoolMetadata.getResourceMetadata
public ResourceMetadata getResourceMetadata(String resourceName) { if (!resourceMetadataMap.containsKey(resourceName)) { throw new RuntimeException("No resource metadata for " + resourceName); } return resourceMetadataMap.get(resourceName); }
java
public ResourceMetadata getResourceMetadata(String resourceName) { if (!resourceMetadataMap.containsKey(resourceName)) { throw new RuntimeException("No resource metadata for " + resourceName); } return resourceMetadataMap.get(resourceName); }
[ "public", "ResourceMetadata", "getResourceMetadata", "(", "String", "resourceName", ")", "{", "if", "(", "!", "resourceMetadataMap", ".", "containsKey", "(", "resourceName", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"No resource metadata for \"", "+", ...
Get resource metadata for a resource name @param resourceName Name of the resource @return Resource metadata for this name @throws RuntimException if the resource name doesn't exist
[ "Get", "resource", "metadata", "for", "a", "resource", "name" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/PoolMetadata.java#L79-L84
118,478
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/corona/ClusterNode.java
ClusterNode.readClusterNodeInfo
private void readClusterNodeInfo(CoronaSerializer coronaSerializer) throws IOException { coronaSerializer.readField("clusterNodeInfo"); clusterNodeInfo = new ClusterNodeInfo(); // Expecting the START_OBJECT token for clusterNodeInfo coronaSerializer.readStartObjectToken("clusterNodeInfo"); corona...
java
private void readClusterNodeInfo(CoronaSerializer coronaSerializer) throws IOException { coronaSerializer.readField("clusterNodeInfo"); clusterNodeInfo = new ClusterNodeInfo(); // Expecting the START_OBJECT token for clusterNodeInfo coronaSerializer.readStartObjectToken("clusterNodeInfo"); corona...
[ "private", "void", "readClusterNodeInfo", "(", "CoronaSerializer", "coronaSerializer", ")", "throws", "IOException", "{", "coronaSerializer", ".", "readField", "(", "\"clusterNodeInfo\"", ")", ";", "clusterNodeInfo", "=", "new", "ClusterNodeInfo", "(", ")", ";", "// E...
Reads the clusterNodeInfo object from the JSON stream @param coronaSerializer The CoronaSerializer instance being used to read the JSON from disk @throws IOException
[ "Reads", "the", "clusterNodeInfo", "object", "from", "the", "JSON", "stream" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/ClusterNode.java#L205-L229
118,479
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/corona/ClusterNode.java
ClusterNode.readGrants
private void readGrants(CoronaSerializer coronaSerializer) throws IOException { // Expecting the START_OBJECT token for grants coronaSerializer.readStartObjectToken("grants"); JsonToken current = coronaSerializer.nextToken(); while (current != JsonToken.END_OBJECT) { // We can access the key f...
java
private void readGrants(CoronaSerializer coronaSerializer) throws IOException { // Expecting the START_OBJECT token for grants coronaSerializer.readStartObjectToken("grants"); JsonToken current = coronaSerializer.nextToken(); while (current != JsonToken.END_OBJECT) { // We can access the key f...
[ "private", "void", "readGrants", "(", "CoronaSerializer", "coronaSerializer", ")", "throws", "IOException", "{", "// Expecting the START_OBJECT token for grants", "coronaSerializer", ".", "readStartObjectToken", "(", "\"grants\"", ")", ";", "JsonToken", "current", "=", "cor...
Reads the list of grants from the JSON stream @param coronaSerializer The CoronaSerializer instance being used to read the JSON from disk @throws IOException
[ "Reads", "the", "list", "of", "grants", "from", "the", "JSON", "stream" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/ClusterNode.java#L237-L261
118,480
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/corona/ClusterNode.java
ClusterNode.write
public void write(JsonGenerator jsonGenerator) throws IOException { jsonGenerator.writeStartObject(); // clusterNodeInfo begins jsonGenerator.writeFieldName("clusterNodeInfo"); jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("name", clusterNodeInfo.name); jsonGenerator.writeObj...
java
public void write(JsonGenerator jsonGenerator) throws IOException { jsonGenerator.writeStartObject(); // clusterNodeInfo begins jsonGenerator.writeFieldName("clusterNodeInfo"); jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("name", clusterNodeInfo.name); jsonGenerator.writeObj...
[ "public", "void", "write", "(", "JsonGenerator", "jsonGenerator", ")", "throws", "IOException", "{", "jsonGenerator", ".", "writeStartObject", "(", ")", ";", "// clusterNodeInfo begins", "jsonGenerator", ".", "writeFieldName", "(", "\"clusterNodeInfo\"", ")", ";", "js...
Used to write the state of the ClusterNode instance to disk, when we are persisting the state of the NodeManager @param jsonGenerator The JsonGenerator instance being used to write JSON to disk @throws IOException
[ "Used", "to", "write", "the", "state", "of", "the", "ClusterNode", "instance", "to", "disk", "when", "we", "are", "persisting", "the", "state", "of", "the", "NodeManager" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/ClusterNode.java#L270-L304
118,481
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/corona/ClusterNode.java
ClusterNode.initResourceTypeToMaxCpuMap
public void initResourceTypeToMaxCpuMap(Map<Integer, Map<ResourceType, Integer>> cpuToResourcePartitioning) { resourceTypeToMaxCpu = getResourceTypeToCountMap((int) clusterNodeInfo.total.numCpus, cpuToResourcePartitioning); }
java
public void initResourceTypeToMaxCpuMap(Map<Integer, Map<ResourceType, Integer>> cpuToResourcePartitioning) { resourceTypeToMaxCpu = getResourceTypeToCountMap((int) clusterNodeInfo.total.numCpus, cpuToResourcePartitioning); }
[ "public", "void", "initResourceTypeToMaxCpuMap", "(", "Map", "<", "Integer", ",", "Map", "<", "ResourceType", ",", "Integer", ">", ">", "cpuToResourcePartitioning", ")", "{", "resourceTypeToMaxCpu", "=", "getResourceTypeToCountMap", "(", "(", "int", ")", "clusterNod...
This method is used to initialize the resource type to max CPU mapping based upon the cpuToResourcePartitioning instance given @param cpuToResourcePartitioning Mapping of cpus to resources to be used
[ "This", "method", "is", "used", "to", "initialize", "the", "resource", "type", "to", "max", "CPU", "mapping", "based", "upon", "the", "cpuToResourcePartitioning", "instance", "given" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/ClusterNode.java#L320-L325
118,482
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/corona/ClusterNode.java
ClusterNode.getResourceTypeToCountMap
public static Map<ResourceType, Integer> getResourceTypeToCountMap( int numCpus, Map<Integer, Map<ResourceType, Integer>> cpuToResourcePartitioning) { Map<ResourceType, Integer> ret = cpuToResourcePartitioning.get(numCpus); if (ret == null) { Map<ResourceType, Integer> oneCpuMap = cpuT...
java
public static Map<ResourceType, Integer> getResourceTypeToCountMap( int numCpus, Map<Integer, Map<ResourceType, Integer>> cpuToResourcePartitioning) { Map<ResourceType, Integer> ret = cpuToResourcePartitioning.get(numCpus); if (ret == null) { Map<ResourceType, Integer> oneCpuMap = cpuT...
[ "public", "static", "Map", "<", "ResourceType", ",", "Integer", ">", "getResourceTypeToCountMap", "(", "int", "numCpus", ",", "Map", "<", "Integer", ",", "Map", "<", "ResourceType", ",", "Integer", ">", ">", "cpuToResourcePartitioning", ")", "{", "Map", "<", ...
Get a mapping of the resource type to amount of resources for a given number of cpus. @param numCpus Number of cpus available @param cpuToResourcePartitioning Mapping of number of cpus to resources @return Resources for this amount of cpus
[ "Get", "a", "mapping", "of", "the", "resource", "type", "to", "amount", "of", "resources", "for", "a", "given", "number", "of", "cpus", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/ClusterNode.java#L335-L354
118,483
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java
ImageLoaderCurrent.processINodesUC
private void processINodesUC(DataInputStream in, ImageVisitor v, boolean skipBlocks) throws IOException { int numINUC = in.readInt(); v.visitEnclosingElement(ImageElement.INODES_UNDER_CONSTRUCTION, ImageElement.NUM_INODES_UNDER_CONSTRUCTION, numINUC); for(int i = 0; i < nu...
java
private void processINodesUC(DataInputStream in, ImageVisitor v, boolean skipBlocks) throws IOException { int numINUC = in.readInt(); v.visitEnclosingElement(ImageElement.INODES_UNDER_CONSTRUCTION, ImageElement.NUM_INODES_UNDER_CONSTRUCTION, numINUC); for(int i = 0; i < nu...
[ "private", "void", "processINodesUC", "(", "DataInputStream", "in", ",", "ImageVisitor", "v", ",", "boolean", "skipBlocks", ")", "throws", "IOException", "{", "int", "numINUC", "=", "in", ".", "readInt", "(", ")", ";", "v", ".", "visitEnclosingElement", "(", ...
Process the INodes under construction section of the fsimage. @param in DataInputStream to process @param v Visitor to walk over inodes @param skipBlocks Walk over each block?
[ "Process", "the", "INodes", "under", "construction", "section", "of", "the", "fsimage", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java#L202-L250
118,484
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java
ImageLoaderCurrent.processBlocks
private void processBlocks(DataInputStream in, ImageVisitor v, int numBlocks, boolean skipBlocks) throws IOException { v.visitEnclosingElement(ImageElement.BLOCKS, ImageElement.NUM_BLOCKS, numBlocks); // directory or symlink, no blocks to process if(numBlocks == -1...
java
private void processBlocks(DataInputStream in, ImageVisitor v, int numBlocks, boolean skipBlocks) throws IOException { v.visitEnclosingElement(ImageElement.BLOCKS, ImageElement.NUM_BLOCKS, numBlocks); // directory or symlink, no blocks to process if(numBlocks == -1...
[ "private", "void", "processBlocks", "(", "DataInputStream", "in", ",", "ImageVisitor", "v", ",", "int", "numBlocks", ",", "boolean", "skipBlocks", ")", "throws", "IOException", "{", "v", ".", "visitEnclosingElement", "(", "ImageElement", ".", "BLOCKS", ",", "Ima...
Process the blocks section of the fsimage. @param in Datastream to process @param v Visitor to walk over inodes @param skipBlocks Walk over each block?
[ "Process", "the", "blocks", "section", "of", "the", "fsimage", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java#L259-L294
118,485
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java
ImageLoaderCurrent.processPermission
private void processPermission(DataInputStream in, ImageVisitor v) throws IOException { v.visitEnclosingElement(ImageElement.PERMISSIONS); v.visit(ImageElement.USER_NAME, Text.readStringOpt(in)); v.visit(ImageElement.GROUP_NAME, Text.readStringOpt(in)); FsPermission fsp = new FsPermission(in.readS...
java
private void processPermission(DataInputStream in, ImageVisitor v) throws IOException { v.visitEnclosingElement(ImageElement.PERMISSIONS); v.visit(ImageElement.USER_NAME, Text.readStringOpt(in)); v.visit(ImageElement.GROUP_NAME, Text.readStringOpt(in)); FsPermission fsp = new FsPermission(in.readS...
[ "private", "void", "processPermission", "(", "DataInputStream", "in", ",", "ImageVisitor", "v", ")", "throws", "IOException", "{", "v", ".", "visitEnclosingElement", "(", "ImageElement", ".", "PERMISSIONS", ")", ";", "v", ".", "visit", "(", "ImageElement", ".", ...
Extract the INode permissions stored in the fsimage file. @param in Datastream to process @param v Visitor to walk over inodes
[ "Extract", "the", "INode", "permissions", "stored", "in", "the", "fsimage", "file", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java#L302-L310
118,486
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java
ImageLoaderCurrent.processINodes
private void processINodes(DataInputStream in, ImageVisitor v, long numInodes, boolean skipBlocks) throws IOException { v.visitEnclosingElement(ImageElement.INODES, ImageElement.NUM_INODES, numInodes); if (LayoutVersion.supports(Feature.FSIMAGE_NAME_OPTIMIZATION, imageVersion)) { proces...
java
private void processINodes(DataInputStream in, ImageVisitor v, long numInodes, boolean skipBlocks) throws IOException { v.visitEnclosingElement(ImageElement.INODES, ImageElement.NUM_INODES, numInodes); if (LayoutVersion.supports(Feature.FSIMAGE_NAME_OPTIMIZATION, imageVersion)) { proces...
[ "private", "void", "processINodes", "(", "DataInputStream", "in", ",", "ImageVisitor", "v", ",", "long", "numInodes", ",", "boolean", "skipBlocks", ")", "throws", "IOException", "{", "v", ".", "visitEnclosingElement", "(", "ImageElement", ".", "INODES", ",", "Im...
Process the INode records stored in the fsimage. @param in Datastream to process @param v Visitor to walk over INodes @param numInodes Number of INodes stored in file @param skipBlocks Process all the blocks within the INode? @throws VisitException @throws IOException
[ "Process", "the", "INode", "records", "stored", "in", "the", "fsimage", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java#L322-L335
118,487
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java
ImageLoaderCurrent.processINode
private void processINode(DataInputStream in, ImageVisitor v, boolean skipBlocks, String parentName) throws IOException { checkInterruption(); v.visitEnclosingElement(ImageElement.INODE); String pathName = FSImageSerialization.readString(in); if (parentName != null) { // local name pathNam...
java
private void processINode(DataInputStream in, ImageVisitor v, boolean skipBlocks, String parentName) throws IOException { checkInterruption(); v.visitEnclosingElement(ImageElement.INODE); String pathName = FSImageSerialization.readString(in); if (parentName != null) { // local name pathNam...
[ "private", "void", "processINode", "(", "DataInputStream", "in", ",", "ImageVisitor", "v", ",", "boolean", "skipBlocks", ",", "String", "parentName", ")", "throws", "IOException", "{", "checkInterruption", "(", ")", ";", "v", ".", "visitEnclosingElement", "(", "...
Process an INode @param in image stream @param v visitor @param skipBlocks skip blocks or not @param parentName the name of its parent node @throws IOException
[ "Process", "an", "INode" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java#L391-L447
118,488
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java
QuorumJournalManager.createNewUniqueEpoch
Map<AsyncLogger, NewEpochResponseProto> createNewUniqueEpoch() throws IOException { Preconditions.checkState(!loggers.isEpochEstablished(), "epoch already created"); Map<AsyncLogger, GetJournalStateResponseProto> lastPromises = loggers.waitForWriteQuorum(loggers.getJournalState(), ...
java
Map<AsyncLogger, NewEpochResponseProto> createNewUniqueEpoch() throws IOException { Preconditions.checkState(!loggers.isEpochEstablished(), "epoch already created"); Map<AsyncLogger, GetJournalStateResponseProto> lastPromises = loggers.waitForWriteQuorum(loggers.getJournalState(), ...
[ "Map", "<", "AsyncLogger", ",", "NewEpochResponseProto", ">", "createNewUniqueEpoch", "(", ")", "throws", "IOException", "{", "Preconditions", ".", "checkState", "(", "!", "loggers", ".", "isEpochEstablished", "(", ")", ",", "\"epoch already created\"", ")", ";", ...
Fence any previous writers, and obtain a unique epoch number for write-access to the journal nodes. @return the new, unique epoch number
[ "Fence", "any", "previous", "writers", "and", "obtain", "a", "unique", "epoch", "number", "for", "write", "-", "access", "to", "the", "journal", "nodes", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java#L218-L240
118,489
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java
QuorumJournalManager.hasSomeDataInternal
private boolean hasSomeDataInternal(boolean image) throws IOException { QuorumCall<AsyncLogger, Boolean> call = image ? loggers.isImageFormatted() : loggers.isJournalFormatted(); try { call.waitFor(loggers.size(), 0, 0, hasDataTimeoutMs, "hasSomeData"); } catch (InterruptedException e) { ...
java
private boolean hasSomeDataInternal(boolean image) throws IOException { QuorumCall<AsyncLogger, Boolean> call = image ? loggers.isImageFormatted() : loggers.isJournalFormatted(); try { call.waitFor(loggers.size(), 0, 0, hasDataTimeoutMs, "hasSomeData"); } catch (InterruptedException e) { ...
[ "private", "boolean", "hasSomeDataInternal", "(", "boolean", "image", ")", "throws", "IOException", "{", "QuorumCall", "<", "AsyncLogger", ",", "Boolean", ">", "call", "=", "image", "?", "loggers", ".", "isImageFormatted", "(", ")", ":", "loggers", ".", "isJou...
Checks if any data is available in the underlying storage. Returns true if any of the nodes has some data.
[ "Checks", "if", "any", "data", "is", "available", "in", "the", "underlying", "storage", ".", "Returns", "true", "if", "any", "of", "the", "nodes", "has", "some", "data", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java#L294-L321
118,490
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java
QuorumJournalManager.selectInputStreams
@Override public void selectInputStreams(Collection<EditLogInputStream> streams, long fromTxnId, boolean inProgressOk, boolean validateInProgressSegments) throws IOException { QuorumCall<AsyncLogger, RemoteEditLogManifest> q = loggers.getEditLogManifest(fromTxnId); // we insist on getting...
java
@Override public void selectInputStreams(Collection<EditLogInputStream> streams, long fromTxnId, boolean inProgressOk, boolean validateInProgressSegments) throws IOException { QuorumCall<AsyncLogger, RemoteEditLogManifest> q = loggers.getEditLogManifest(fromTxnId); // we insist on getting...
[ "@", "Override", "public", "void", "selectInputStreams", "(", "Collection", "<", "EditLogInputStream", ">", "streams", ",", "long", "fromTxnId", ",", "boolean", "inProgressOk", ",", "boolean", "validateInProgressSegments", ")", "throws", "IOException", "{", "QuorumCal...
Select input streams. inProgressOk should be true only for tailing, not for startup
[ "Select", "input", "streams", ".", "inProgressOk", "should", "be", "true", "only", "for", "tailing", "not", "for", "startup" ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java#L548-L585
118,491
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java
QuorumJournalManager.getCheckpointOutputStream
@Override public OutputStream getCheckpointOutputStream(long txid) throws IOException { return new HttpImageUploadStream(httpAddresses, journalId, nsInfo, txid, loggers.getEpoch(), imageUploadBufferSize, imageUploadMaxBufferedChunks); }
java
@Override public OutputStream getCheckpointOutputStream(long txid) throws IOException { return new HttpImageUploadStream(httpAddresses, journalId, nsInfo, txid, loggers.getEpoch(), imageUploadBufferSize, imageUploadMaxBufferedChunks); }
[ "@", "Override", "public", "OutputStream", "getCheckpointOutputStream", "(", "long", "txid", ")", "throws", "IOException", "{", "return", "new", "HttpImageUploadStream", "(", "httpAddresses", ",", "journalId", ",", "nsInfo", ",", "txid", ",", "loggers", ".", "getE...
Creates output stream for image at txid to the underlying quorum of journal nodes.
[ "Creates", "output", "stream", "for", "image", "at", "txid", "to", "the", "underlying", "quorum", "of", "journal", "nodes", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java#L670-L674
118,492
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java
QuorumJournalManager.saveDigestAndRenameCheckpointImage
@Override public boolean saveDigestAndRenameCheckpointImage(long txid, MD5Hash digest) { try { LOG.info("Saving md5: " + digest + " for txid: " + txid); QuorumCall<AsyncLogger, Void> q = loggers .saveDigestAndRenameCheckpointImage(txid, digest); loggers.waitForWriteQuorum(q, writeTxnsT...
java
@Override public boolean saveDigestAndRenameCheckpointImage(long txid, MD5Hash digest) { try { LOG.info("Saving md5: " + digest + " for txid: " + txid); QuorumCall<AsyncLogger, Void> q = loggers .saveDigestAndRenameCheckpointImage(txid, digest); loggers.waitForWriteQuorum(q, writeTxnsT...
[ "@", "Override", "public", "boolean", "saveDigestAndRenameCheckpointImage", "(", "long", "txid", ",", "MD5Hash", "digest", ")", "{", "try", "{", "LOG", ".", "info", "(", "\"Saving md5: \"", "+", "digest", "+", "\" for txid: \"", "+", "txid", ")", ";", "QuorumC...
Roll image and save md5 digest to the underlying nodes. This is a quorum roll, and we ensure that it can succeed only on the nodes that consumed entirely the uploaded image.
[ "Roll", "image", "and", "save", "md5", "digest", "to", "the", "underlying", "nodes", ".", "This", "is", "a", "quorum", "roll", "and", "we", "ensure", "that", "it", "can", "succeed", "only", "on", "the", "nodes", "that", "consumed", "entirely", "the", "up...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java#L682-L695
118,493
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java
QuorumJournalManager.getImageManifest
@Override public RemoteImageManifest getImageManifest(long fromTxnId) throws IOException { QuorumCall<AsyncLogger, RemoteImageManifest> q = loggers .getImageManifest(fromTxnId); Map<AsyncLogger, RemoteImageManifest> resps = loggers .waitForReadQuorumWithAllResponses(q, getImageManifestTi...
java
@Override public RemoteImageManifest getImageManifest(long fromTxnId) throws IOException { QuorumCall<AsyncLogger, RemoteImageManifest> q = loggers .getImageManifest(fromTxnId); Map<AsyncLogger, RemoteImageManifest> resps = loggers .waitForReadQuorumWithAllResponses(q, getImageManifestTi...
[ "@", "Override", "public", "RemoteImageManifest", "getImageManifest", "(", "long", "fromTxnId", ")", "throws", "IOException", "{", "QuorumCall", "<", "AsyncLogger", ",", "RemoteImageManifest", ">", "q", "=", "loggers", ".", "getImageManifest", "(", "fromTxnId", ")",...
Get manifest for the images stored in journal nodes. An image is considered valid if it appears in majority of the nodes, with a valid md5 sum. The returned images are sorted according to their transaction id.
[ "Get", "manifest", "for", "the", "images", "stored", "in", "journal", "nodes", ".", "An", "image", "is", "considered", "valid", "if", "it", "appears", "in", "majority", "of", "the", "nodes", "with", "a", "valid", "md5", "sum", ".", "The", "returned", "im...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java#L718-L727
118,494
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java
QuorumJournalManager.createImageManifest
static RemoteImageManifest createImageManifest( Collection<RemoteImageManifest> resps) throws IOException { // found valid images (with md5 hash) Map<Long, RemoteImage> images = Maps.newHashMap(); for (RemoteImageManifest rm : resps) { for (RemoteImage ri : rm.getImages()) { if (ri.getD...
java
static RemoteImageManifest createImageManifest( Collection<RemoteImageManifest> resps) throws IOException { // found valid images (with md5 hash) Map<Long, RemoteImage> images = Maps.newHashMap(); for (RemoteImageManifest rm : resps) { for (RemoteImage ri : rm.getImages()) { if (ri.getD...
[ "static", "RemoteImageManifest", "createImageManifest", "(", "Collection", "<", "RemoteImageManifest", ">", "resps", ")", "throws", "IOException", "{", "// found valid images (with md5 hash)", "Map", "<", "Long", ",", "RemoteImage", ">", "images", "=", "Maps", ".", "n...
Concatenate manifests obtained from the underlying journalnodes. The final manifest will contain only the images committed to the majority of the nodes. Images with no md5 associated are ignored. Also, the md5 must match between images from different journal nodes.
[ "Concatenate", "manifests", "obtained", "from", "the", "underlying", "journalnodes", ".", "The", "final", "manifest", "will", "contain", "only", "the", "images", "committed", "to", "the", "majority", "of", "the", "nodes", ".", "Images", "with", "no", "md5", "a...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java#L735-L768
118,495
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java
QuorumJournalManager.getImageInputStream
@Override public ImageInputStream getImageInputStream(long txid) throws IOException { URLImageInputStream stream = loggers.getImageInputStream(txid, httpConnectReadTimeoutMs); if (stream == null) { throw new IOException("Cannot obtain input stream for image: " + txid); } return new Image...
java
@Override public ImageInputStream getImageInputStream(long txid) throws IOException { URLImageInputStream stream = loggers.getImageInputStream(txid, httpConnectReadTimeoutMs); if (stream == null) { throw new IOException("Cannot obtain input stream for image: " + txid); } return new Image...
[ "@", "Override", "public", "ImageInputStream", "getImageInputStream", "(", "long", "txid", ")", "throws", "IOException", "{", "URLImageInputStream", "stream", "=", "loggers", ".", "getImageInputStream", "(", "txid", ",", "httpConnectReadTimeoutMs", ")", ";", "if", "...
Get input stream to one of the nodes for given txid.
[ "Get", "input", "stream", "to", "one", "of", "the", "nodes", "for", "given", "txid", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java#L789-L798
118,496
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/MD5Hash.java
MD5Hash.read
public static MD5Hash read(DataInput in) throws IOException { MD5Hash result = new MD5Hash(); result.readFields(in); return result; }
java
public static MD5Hash read(DataInput in) throws IOException { MD5Hash result = new MD5Hash(); result.readFields(in); return result; }
[ "public", "static", "MD5Hash", "read", "(", "DataInput", "in", ")", "throws", "IOException", "{", "MD5Hash", "result", "=", "new", "MD5Hash", "(", ")", ";", "result", ".", "readFields", "(", "in", ")", ";", "return", "result", ";", "}" ]
Constructs, reads and returns an instance.
[ "Constructs", "reads", "and", "returns", "an", "instance", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/MD5Hash.java#L77-L81
118,497
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/MD5Hash.java
MD5Hash.digest
public static MD5Hash digest(InputStream in) throws IOException { final byte[] buffer = new byte[4*1024]; int fileLength = 0; final MessageDigest digester = DIGESTER_FACTORY.get(); for(int n; (n = in.read(buffer)) != -1; ) { digester.update(buffer, 0, n); fileLength += n; } return...
java
public static MD5Hash digest(InputStream in) throws IOException { final byte[] buffer = new byte[4*1024]; int fileLength = 0; final MessageDigest digester = DIGESTER_FACTORY.get(); for(int n; (n = in.read(buffer)) != -1; ) { digester.update(buffer, 0, n); fileLength += n; } return...
[ "public", "static", "MD5Hash", "digest", "(", "InputStream", "in", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "4", "*", "1024", "]", ";", "int", "fileLength", "=", "0", ";", "final", "MessageDigest", ...
Construct a hash value for the content from the InputStream.
[ "Construct", "a", "hash", "value", "for", "the", "content", "from", "the", "InputStream", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/MD5Hash.java#L109-L120
118,498
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/MD5Hash.java
MD5Hash.digest
public static MD5Hash digest(byte[] data, int start, int len) { byte[] digest; MessageDigest digester = DIGESTER_FACTORY.get(); digester.update(data, start, len); digest = digester.digest(); return new MD5Hash(digest); }
java
public static MD5Hash digest(byte[] data, int start, int len) { byte[] digest; MessageDigest digester = DIGESTER_FACTORY.get(); digester.update(data, start, len); digest = digester.digest(); return new MD5Hash(digest); }
[ "public", "static", "MD5Hash", "digest", "(", "byte", "[", "]", "data", ",", "int", "start", ",", "int", "len", ")", "{", "byte", "[", "]", "digest", ";", "MessageDigest", "digester", "=", "DIGESTER_FACTORY", ".", "get", "(", ")", ";", "digester", ".",...
Construct a hash value for a byte array.
[ "Construct", "a", "hash", "value", "for", "a", "byte", "array", "." ]
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/MD5Hash.java#L123-L129
118,499
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/CleanupQueue.java
CleanupQueue.forceClean
public void forceClean() { while(true) { PathDeletionContext context = null; try { context = cleanupThread.queue.poll(50L, TimeUnit.MILLISECONDS); if (context == null) { return; } if (!deletePath(context)) { LOG.warn("forceClean:Unable to delete path "...
java
public void forceClean() { while(true) { PathDeletionContext context = null; try { context = cleanupThread.queue.poll(50L, TimeUnit.MILLISECONDS); if (context == null) { return; } if (!deletePath(context)) { LOG.warn("forceClean:Unable to delete path "...
[ "public", "void", "forceClean", "(", ")", "{", "while", "(", "true", ")", "{", "PathDeletionContext", "context", "=", "null", ";", "try", "{", "context", "=", "cleanupThread", ".", "queue", ".", "poll", "(", "50L", ",", "TimeUnit", ".", "MILLISECONDS", "...
Force to clean the all path, it should be called when task tracker is shut down Now we only called it in MiniCoronaCluster to make sure the unit test run in a clean fixture
[ "Force", "to", "clean", "the", "all", "path", "it", "should", "be", "called", "when", "task", "tracker", "is", "shut", "down", "Now", "we", "only", "called", "it", "in", "MiniCoronaCluster", "to", "make", "sure", "the", "unit", "test", "run", "in", "a", ...
2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/CleanupQueue.java#L59-L80