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,900 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/SpillRecord.java | SpillRecord.putIndex | public void putIndex(IndexRecord rec, int partition) {
final int pos = partition * MapTask.MAP_OUTPUT_INDEX_RECORD_LENGTH / 8;
entries.put(pos, rec.startOffset);
entries.put(pos + 1, rec.rawLength);
entries.put(pos + 2, rec.partLength);
} | java | public void putIndex(IndexRecord rec, int partition) {
final int pos = partition * MapTask.MAP_OUTPUT_INDEX_RECORD_LENGTH / 8;
entries.put(pos, rec.startOffset);
entries.put(pos + 1, rec.rawLength);
entries.put(pos + 2, rec.partLength);
} | [
"public",
"void",
"putIndex",
"(",
"IndexRecord",
"rec",
",",
"int",
"partition",
")",
"{",
"final",
"int",
"pos",
"=",
"partition",
"*",
"MapTask",
".",
"MAP_OUTPUT_INDEX_RECORD_LENGTH",
"/",
"8",
";",
"entries",
".",
"put",
"(",
"pos",
",",
"rec",
".",
... | Set spill offsets for given partition. | [
"Set",
"spill",
"offsets",
"for",
"given",
"partition",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/SpillRecord.java#L102-L107 |
118,901 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/SpillRecord.java | SpillRecord.writeToFile | public void writeToFile(Path loc, JobConf job)
throws IOException {
writeToFile(loc, job, new PureJavaCrc32());
} | java | public void writeToFile(Path loc, JobConf job)
throws IOException {
writeToFile(loc, job, new PureJavaCrc32());
} | [
"public",
"void",
"writeToFile",
"(",
"Path",
"loc",
",",
"JobConf",
"job",
")",
"throws",
"IOException",
"{",
"writeToFile",
"(",
"loc",
",",
"job",
",",
"new",
"PureJavaCrc32",
"(",
")",
")",
";",
"}"
] | Write this spill record to the location provided. | [
"Write",
"this",
"spill",
"record",
"to",
"the",
"location",
"provided",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/SpillRecord.java#L112-L115 |
118,902 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java | FairSchedulerServlet.printFilterInfo | static void printFilterInfo(PrintWriter out,
String poolFilter, String userFilter, String showAllLink) {
if (userFilter != null || poolFilter != null) {
StringBuilder customizedInfo = new StringBuilder("Only showing ");
if (poolFilter != null) {
customizedInfo.append("pool(s) " + poolFilte... | java | static void printFilterInfo(PrintWriter out,
String poolFilter, String userFilter, String showAllLink) {
if (userFilter != null || poolFilter != null) {
StringBuilder customizedInfo = new StringBuilder("Only showing ");
if (poolFilter != null) {
customizedInfo.append("pool(s) " + poolFilte... | [
"static",
"void",
"printFilterInfo",
"(",
"PrintWriter",
"out",
",",
"String",
"poolFilter",
",",
"String",
"userFilter",
",",
"String",
"showAllLink",
")",
"{",
"if",
"(",
"userFilter",
"!=",
"null",
"||",
"poolFilter",
"!=",
"null",
")",
"{",
"StringBuilder"... | Print the filter information for pools and users
@param out Where the output is dumped
@param poolFilter Comma separated list of pools, null for none
@param userSet Comma separated list of users, null for none
@param showAllLink Link to show everything | [
"Print",
"the",
"filter",
"information",
"for",
"pools",
"and",
"users"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java#L286-L302 |
118,903 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java | FairSchedulerServlet.showAdminFormPreemption | private void showAdminFormPreemption(PrintWriter out, boolean advancedView) {
out.print("<h2>Task Preemption</h2>\n");
String advParam = advancedView ? "&advanced" : "";
out.print(generateSelect(Arrays.asList("On,Off".split(",")),
scheduler.isPreemptionEnabled() ? "On" : "Off",
"... | java | private void showAdminFormPreemption(PrintWriter out, boolean advancedView) {
out.print("<h2>Task Preemption</h2>\n");
String advParam = advancedView ? "&advanced" : "";
out.print(generateSelect(Arrays.asList("On,Off".split(",")),
scheduler.isPreemptionEnabled() ? "On" : "Off",
"... | [
"private",
"void",
"showAdminFormPreemption",
"(",
"PrintWriter",
"out",
",",
"boolean",
"advancedView",
")",
"{",
"out",
".",
"print",
"(",
"\"<h2>Task Preemption</h2>\\n\"",
")",
";",
"String",
"advParam",
"=",
"advancedView",
"?",
"\"&advanced\"",
":",
"\"\"",
... | Print the administration form for preemption | [
"Print",
"the",
"administration",
"form",
"for",
"preemption"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java#L735-L741 |
118,904 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java | FairSchedulerServlet.showAdminFormMemBasedLoadMgr | private void showAdminFormMemBasedLoadMgr(PrintWriter out,
boolean advancedView) {
if (!(loadMgr instanceof MemBasedLoadManager)) {
return;
}
out.print("<h2>Memory Based Scheduling</h2>\n");
MemBasedLoadManager memLoadMgr = (MemBasedLoadManager)loadMgr;
... | java | private void showAdminFormMemBasedLoadMgr(PrintWriter out,
boolean advancedView) {
if (!(loadMgr instanceof MemBasedLoadManager)) {
return;
}
out.print("<h2>Memory Based Scheduling</h2>\n");
MemBasedLoadManager memLoadMgr = (MemBasedLoadManager)loadMgr;
... | [
"private",
"void",
"showAdminFormMemBasedLoadMgr",
"(",
"PrintWriter",
"out",
",",
"boolean",
"advancedView",
")",
"{",
"if",
"(",
"!",
"(",
"loadMgr",
"instanceof",
"MemBasedLoadManager",
")",
")",
"{",
"return",
";",
"}",
"out",
".",
"print",
"(",
"\"<h2>Mem... | Print the administration form for the MemBasedLoadManager | [
"Print",
"the",
"administration",
"form",
"for",
"the",
"MemBasedLoadManager"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java#L746-L761 |
118,905 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java | FairSchedulerServlet.showCluster | static void showCluster(
PrintWriter out, boolean advancedView, JobTracker jobTracker) {
String cluster = "";
try {
cluster = JSPUtil.generateClusterResTable(jobTracker);
if (cluster.equals("")) {
return;
}
} catch (IOException e) {
return;
}
out.print("<h2>Clus... | java | static void showCluster(
PrintWriter out, boolean advancedView, JobTracker jobTracker) {
String cluster = "";
try {
cluster = JSPUtil.generateClusterResTable(jobTracker);
if (cluster.equals("")) {
return;
}
} catch (IOException e) {
return;
}
out.print("<h2>Clus... | [
"static",
"void",
"showCluster",
"(",
"PrintWriter",
"out",
",",
"boolean",
"advancedView",
",",
"JobTracker",
"jobTracker",
")",
"{",
"String",
"cluster",
"=",
"\"\"",
";",
"try",
"{",
"cluster",
"=",
"JSPUtil",
".",
"generateClusterResTable",
"(",
"jobTracker"... | Print the cluster resource utilization | [
"Print",
"the",
"cluster",
"resource",
"utilization"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java#L766-L779 |
118,906 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java | FairSchedulerServlet.showNumTaskPerHeartBeatOption | private void showNumTaskPerHeartBeatOption(
PrintWriter out, boolean advancedView) {
out.print("<h2>Number of Assigned Tasks Per HeartBeat</h2>\n");
out.printf("<p>Number of map tasks assigned per heartbeat:%s",
generateSelect(Arrays.asList("1,2,3,4,5,6,7,8,9,10".split(",")),
... | java | private void showNumTaskPerHeartBeatOption(
PrintWriter out, boolean advancedView) {
out.print("<h2>Number of Assigned Tasks Per HeartBeat</h2>\n");
out.printf("<p>Number of map tasks assigned per heartbeat:%s",
generateSelect(Arrays.asList("1,2,3,4,5,6,7,8,9,10".split(",")),
... | [
"private",
"void",
"showNumTaskPerHeartBeatOption",
"(",
"PrintWriter",
"out",
",",
"boolean",
"advancedView",
")",
"{",
"out",
".",
"print",
"(",
"\"<h2>Number of Assigned Tasks Per HeartBeat</h2>\\n\"",
")",
";",
"out",
".",
"printf",
"(",
"\"<p>Number of map tasks assi... | Print the UI that allows us to change the number of tasks assigned per
heartbeat. | [
"Print",
"the",
"UI",
"that",
"allows",
"us",
"to",
"change",
"the",
"number",
"of",
"tasks",
"assigned",
"per",
"heartbeat",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java#L785-L800 |
118,907 | facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java | FairSchedulerServlet.getInitedJobs | private Collection<JobInProgress> getInitedJobs() {
Collection<JobInProgress> runningJobs = jobTracker.getRunningJobs();
for (Iterator<JobInProgress> it = runningJobs.iterator(); it.hasNext();) {
JobInProgress job = it.next();
if (!job.inited()) {
it.remove();
}
}
return runnin... | java | private Collection<JobInProgress> getInitedJobs() {
Collection<JobInProgress> runningJobs = jobTracker.getRunningJobs();
for (Iterator<JobInProgress> it = runningJobs.iterator(); it.hasNext();) {
JobInProgress job = it.next();
if (!job.inited()) {
it.remove();
}
}
return runnin... | [
"private",
"Collection",
"<",
"JobInProgress",
">",
"getInitedJobs",
"(",
")",
"{",
"Collection",
"<",
"JobInProgress",
">",
"runningJobs",
"=",
"jobTracker",
".",
"getRunningJobs",
"(",
")",
";",
"for",
"(",
"Iterator",
"<",
"JobInProgress",
">",
"it",
"=",
... | Obtained all initialized jobs | [
"Obtained",
"all",
"initialized",
"jobs"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java#L805-L814 |
118,908 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/pipes/Submitter.java | Submitter.setIfUnset | private static void setIfUnset(JobConf conf, String key, String value) {
if (conf.get(key) == null) {
conf.set(key, value);
}
} | java | private static void setIfUnset(JobConf conf, String key, String value) {
if (conf.get(key) == null) {
conf.set(key, value);
}
} | [
"private",
"static",
"void",
"setIfUnset",
"(",
"JobConf",
"conf",
",",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"conf",
".",
"get",
"(",
"key",
")",
"==",
"null",
")",
"{",
"conf",
".",
"set",
"(",
"key",
",",
"value",
")",
... | Set the configuration, if it doesn't already have a value for the given
key.
@param conf the configuration to modify
@param key the key to set
@param value the new "default" value to set | [
"Set",
"the",
"configuration",
"if",
"it",
"doesn",
"t",
"already",
"have",
"a",
"value",
"for",
"the",
"given",
"key",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/pipes/Submitter.java#L177-L181 |
118,909 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/pipes/Submitter.java | Submitter.main | public static void main(String[] args) throws Exception {
int exitCode = new Submitter().run(args);
System.exit(exitCode);
} | java | public static void main(String[] args) throws Exception {
int exitCode = new Submitter().run(args);
System.exit(exitCode);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"int",
"exitCode",
"=",
"new",
"Submitter",
"(",
")",
".",
"run",
"(",
"args",
")",
";",
"System",
".",
"exit",
"(",
"exitCode",
")",
";",
"}"
] | Submit a pipes job based on the command line arguments.
@param args | [
"Submit",
"a",
"pipes",
"job",
"based",
"on",
"the",
"command",
"line",
"arguments",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/pipes/Submitter.java#L493-L496 |
118,910 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.loadEnabledPermissionCheckingDirs | private void loadEnabledPermissionCheckingDirs(Configuration conf)
throws IOException {
if (this.isPermissionEnabled) {
String[] permissionCheckingDirs =
conf.getStrings("dfs.permissions.checking.paths", "/");
int numDirs = permissionCheckingDirs.length;
if (numDirs == 0) {
... | java | private void loadEnabledPermissionCheckingDirs(Configuration conf)
throws IOException {
if (this.isPermissionEnabled) {
String[] permissionCheckingDirs =
conf.getStrings("dfs.permissions.checking.paths", "/");
int numDirs = permissionCheckingDirs.length;
if (numDirs == 0) {
... | [
"private",
"void",
"loadEnabledPermissionCheckingDirs",
"(",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"isPermissionEnabled",
")",
"{",
"String",
"[",
"]",
"permissionCheckingDirs",
"=",
"conf",
".",
"getStrings",
"(",
"\"... | Load the predefined paths that should enable permission checking,
each of which represents the root of a subtree
whose nodes should check permission
@param conf configuration
@throws IOException if a predefine path does not exist | [
"Load",
"the",
"predefined",
"paths",
"that",
"should",
"enable",
"permission",
"checking",
"each",
"of",
"which",
"represents",
"the",
"root",
"of",
"a",
"subtree",
"whose",
"nodes",
"should",
"check",
"permission"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L658-L678 |
118,911 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.isPermissionCheckingEnabled | private boolean isPermissionCheckingEnabled(INode[] pathNodes) {
if (this.isPermissionEnabled) {
if (permissionEnabled == null) {
return false;
}
for (INode enableDir : this.permissionEnabled) {
for (INode pathNode : pathNodes) {
if (pathNode == enableDir) {
r... | java | private boolean isPermissionCheckingEnabled(INode[] pathNodes) {
if (this.isPermissionEnabled) {
if (permissionEnabled == null) {
return false;
}
for (INode enableDir : this.permissionEnabled) {
for (INode pathNode : pathNodes) {
if (pathNode == enableDir) {
r... | [
"private",
"boolean",
"isPermissionCheckingEnabled",
"(",
"INode",
"[",
"]",
"pathNodes",
")",
"{",
"if",
"(",
"this",
".",
"isPermissionEnabled",
")",
"{",
"if",
"(",
"permissionEnabled",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"I... | Check if a path is predefined to enable permission checking | [
"Check",
"if",
"a",
"path",
"is",
"predefined",
"to",
"enable",
"permission",
"checking"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L681-L696 |
118,912 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.setHeartbeatInterval | private void setHeartbeatInterval(long heartbeatInterval,
long heartbeatRecheckInterval) {
this.heartbeatInterval = heartbeatInterval;
this.heartbeatRecheckInterval = heartbeatRecheckInterval;
this.heartbeatExpireInterval = 2 * heartbeatRecheckInterval +
10 * heartb... | java | private void setHeartbeatInterval(long heartbeatInterval,
long heartbeatRecheckInterval) {
this.heartbeatInterval = heartbeatInterval;
this.heartbeatRecheckInterval = heartbeatRecheckInterval;
this.heartbeatExpireInterval = 2 * heartbeatRecheckInterval +
10 * heartb... | [
"private",
"void",
"setHeartbeatInterval",
"(",
"long",
"heartbeatInterval",
",",
"long",
"heartbeatRecheckInterval",
")",
"{",
"this",
".",
"heartbeatInterval",
"=",
"heartbeatInterval",
";",
"this",
".",
"heartbeatRecheckInterval",
"=",
"heartbeatRecheckInterval",
";",
... | Set parameters derived from heartbeat interval. | [
"Set",
"parameters",
"derived",
"from",
"heartbeat",
"interval",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L732-L742 |
118,913 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.stopLeaseMonitor | public void stopLeaseMonitor() throws InterruptedException {
if (lmmonitor != null) {
lmmonitor.stop();
InjectionHandler
.processEvent(InjectionEvent.FSNAMESYSTEM_STOP_LEASEMANAGER);
}
if (lmthread != null) {
// interrupt the lease monitor thread. We need to make sure the
/... | java | public void stopLeaseMonitor() throws InterruptedException {
if (lmmonitor != null) {
lmmonitor.stop();
InjectionHandler
.processEvent(InjectionEvent.FSNAMESYSTEM_STOP_LEASEMANAGER);
}
if (lmthread != null) {
// interrupt the lease monitor thread. We need to make sure the
/... | [
"public",
"void",
"stopLeaseMonitor",
"(",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"lmmonitor",
"!=",
"null",
")",
"{",
"lmmonitor",
".",
"stop",
"(",
")",
";",
"InjectionHandler",
".",
"processEvent",
"(",
"InjectionEvent",
".",
"FSNAMESYSTEM_STO... | Stops lease monitor thread. | [
"Stops",
"lease",
"monitor",
"thread",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L901-L921 |
118,914 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.close | public void close() {
fsRunning = false;
try {
if (pendingReplications != null) {
pendingReplications.stop();
}
if (hbthread != null) {
hbthread.interrupt();
}
if (underreplthread != null) {
underreplthread.interrupt();
}
if (overreplthread... | java | public void close() {
fsRunning = false;
try {
if (pendingReplications != null) {
pendingReplications.stop();
}
if (hbthread != null) {
hbthread.interrupt();
}
if (underreplthread != null) {
underreplthread.interrupt();
}
if (overreplthread... | [
"public",
"void",
"close",
"(",
")",
"{",
"fsRunning",
"=",
"false",
";",
"try",
"{",
"if",
"(",
"pendingReplications",
"!=",
"null",
")",
"{",
"pendingReplications",
".",
"stop",
"(",
")",
";",
"}",
"if",
"(",
"hbthread",
"!=",
"null",
")",
"{",
"hb... | Close down this file system manager.
Causes heartbeat and lease daemons to stop; waits briefly for
them to finish, but a short timeout returns control back to caller. | [
"Close",
"down",
"this",
"file",
"system",
"manager",
".",
"Causes",
"heartbeat",
"and",
"lease",
"daemons",
"to",
"stop",
";",
"waits",
"briefly",
"for",
"them",
"to",
"finish",
"but",
"a",
"short",
"timeout",
"returns",
"control",
"back",
"to",
"caller",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L928-L978 |
118,915 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.metaSave | void metaSave(String filename) throws IOException {
readLock();
try {
checkSuperuserPrivilege();
File file = new File(System.getProperty("hadoop.log.dir"),
filename);
PrintWriter out = new PrintWriter(new BufferedWriter(
new FileWriter(file, true)));
//
// Dum... | java | void metaSave(String filename) throws IOException {
readLock();
try {
checkSuperuserPrivilege();
File file = new File(System.getProperty("hadoop.log.dir"),
filename);
PrintWriter out = new PrintWriter(new BufferedWriter(
new FileWriter(file, true)));
//
// Dum... | [
"void",
"metaSave",
"(",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"readLock",
"(",
")",
";",
"try",
"{",
"checkSuperuserPrivilege",
"(",
")",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"System",
".",
"getProperty",
"(",
"\"hadoop.log.dir\"... | Dump all metadata into specified file | [
"Dump",
"all",
"metadata",
"into",
"specified",
"file"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L1002-L1079 |
118,916 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.addBlock | private long addBlock(Block block, List<BlockWithLocations> results) {
ArrayList<String> machineSet =
new ArrayList<String>(blocksMap.numNodes(block));
for (Iterator<DatanodeDescriptor> it =
blocksMap.nodeIterator(block); it.hasNext();) {
String storageID = it.next().getStorageID();
// f... | java | private long addBlock(Block block, List<BlockWithLocations> results) {
ArrayList<String> machineSet =
new ArrayList<String>(blocksMap.numNodes(block));
for (Iterator<DatanodeDescriptor> it =
blocksMap.nodeIterator(block); it.hasNext();) {
String storageID = it.next().getStorageID();
// f... | [
"private",
"long",
"addBlock",
"(",
"Block",
"block",
",",
"List",
"<",
"BlockWithLocations",
">",
"results",
")",
"{",
"ArrayList",
"<",
"String",
">",
"machineSet",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"blocksMap",
".",
"numNodes",
"(",
"blo... | Get all valid locations of the block & add the block to results
return the length of the added block; 0 if the block is not added | [
"Get",
"all",
"valid",
"locations",
"of",
"the",
"block",
"&",
"add",
"the",
"block",
"to",
"results",
"return",
"the",
"length",
"of",
"the",
"added",
"block",
";",
"0",
"if",
"the",
"block",
"is",
"not",
"added"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L1185-L1204 |
118,917 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.setPermission | public void setPermission(String src, FsPermission permission
) throws IOException {
INode[] inodes = null;
writeLock();
try {
if (isInSafeMode()) {
throw new SafeModeException("Cannot set permission for " + src, safeMode);
}
inodes = dir.getExistingPathINodes(src);
if (isP... | java | public void setPermission(String src, FsPermission permission
) throws IOException {
INode[] inodes = null;
writeLock();
try {
if (isInSafeMode()) {
throw new SafeModeException("Cannot set permission for " + src, safeMode);
}
inodes = dir.getExistingPathINodes(src);
if (isP... | [
"public",
"void",
"setPermission",
"(",
"String",
"src",
",",
"FsPermission",
"permission",
")",
"throws",
"IOException",
"{",
"INode",
"[",
"]",
"inodes",
"=",
"null",
";",
"writeLock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"isInSafeMode",
"(",
")",
")"... | Set permissions for an existing file.
@throws IOException | [
"Set",
"permissions",
"for",
"an",
"existing",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L1217-L1239 |
118,918 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.setOwner | public void setOwner(String src, String username, String group
) throws IOException {
INode[] inodes = null;
writeLock();
try {
if (isInSafeMode()) {
throw new SafeModeException("Cannot set permission for " + src, safeMode);
}
inodes = dir.getExistingPathINodes(src);
if (is... | java | public void setOwner(String src, String username, String group
) throws IOException {
INode[] inodes = null;
writeLock();
try {
if (isInSafeMode()) {
throw new SafeModeException("Cannot set permission for " + src, safeMode);
}
inodes = dir.getExistingPathINodes(src);
if (is... | [
"public",
"void",
"setOwner",
"(",
"String",
"src",
",",
"String",
"username",
",",
"String",
"group",
")",
"throws",
"IOException",
"{",
"INode",
"[",
"]",
"inodes",
"=",
"null",
";",
"writeLock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"isInSafeMode",
... | Set owner for an existing file.
@throws IOException | [
"Set",
"owner",
"for",
"an",
"existing",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L1246-L1289 |
118,919 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.updateDatanodeInfo | LocatedBlocksWithMetaInfo updateDatanodeInfo(LocatedBlocks locatedBlocks)
throws IOException {
if (locatedBlocks.getLocatedBlocks().size() == 0)
return new LocatedBlocksWithMetaInfo(locatedBlocks.getFileLength(),
locatedBlocks.getLocatedBlocks(), false,
DataTransferProtocol.DATA_TRAN... | java | LocatedBlocksWithMetaInfo updateDatanodeInfo(LocatedBlocks locatedBlocks)
throws IOException {
if (locatedBlocks.getLocatedBlocks().size() == 0)
return new LocatedBlocksWithMetaInfo(locatedBlocks.getFileLength(),
locatedBlocks.getLocatedBlocks(), false,
DataTransferProtocol.DATA_TRAN... | [
"LocatedBlocksWithMetaInfo",
"updateDatanodeInfo",
"(",
"LocatedBlocks",
"locatedBlocks",
")",
"throws",
"IOException",
"{",
"if",
"(",
"locatedBlocks",
".",
"getLocatedBlocks",
"(",
")",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
"new",
"LocatedBlocksWithMeta... | Updates DatanodeInfo for each LocatedBlock in locatedBlocks. | [
"Updates",
"DatanodeInfo",
"for",
"each",
"LocatedBlock",
"in",
"locatedBlocks",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L1301-L1360 |
118,920 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.setTimes | public void setTimes(String src, long mtime, long atime) throws IOException {
if ( !accessTimeTouchable && atime != -1) {
throw new AccessTimeException("setTimes is not allowed for accessTime");
}
setTimesInternal(src, mtime, atime);
getEditLog().logSync(false);
} | java | public void setTimes(String src, long mtime, long atime) throws IOException {
if ( !accessTimeTouchable && atime != -1) {
throw new AccessTimeException("setTimes is not allowed for accessTime");
}
setTimesInternal(src, mtime, atime);
getEditLog().logSync(false);
} | [
"public",
"void",
"setTimes",
"(",
"String",
"src",
",",
"long",
"mtime",
",",
"long",
"atime",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"accessTimeTouchable",
"&&",
"atime",
"!=",
"-",
"1",
")",
"{",
"throw",
"new",
"AccessTimeException",
"(",
... | stores the modification and access time for this inode.
The access time is precise upto an hour. The transaction, if needed, is
written to the edits log but is not flushed. | [
"stores",
"the",
"modification",
"and",
"access",
"time",
"for",
"this",
"inode",
".",
"The",
"access",
"time",
"is",
"precise",
"upto",
"an",
"hour",
".",
"The",
"transaction",
"if",
"needed",
"is",
"written",
"to",
"the",
"edits",
"log",
"but",
"is",
"... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L1898-L1904 |
118,921 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.verifyReplication | private void verifyReplication(String src,
short replication,
String clientName
) throws IOException {
String text = "file " + src
+ ((clientName != null) ? " on client " + clientName : "")
+ ".\n"
+ "Requested replication " + rep... | java | private void verifyReplication(String src,
short replication,
String clientName
) throws IOException {
String text = "file " + src
+ ((clientName != null) ? " on client " + clientName : "")
+ ".\n"
+ "Requested replication " + rep... | [
"private",
"void",
"verifyReplication",
"(",
"String",
"src",
",",
"short",
"replication",
",",
"String",
"clientName",
")",
"throws",
"IOException",
"{",
"String",
"text",
"=",
"\"file \"",
"+",
"src",
"+",
"(",
"(",
"clientName",
"!=",
"null",
")",
"?",
... | Check whether the replication parameter is within the range
determined by system configuration. | [
"Check",
"whether",
"the",
"replication",
"parameter",
"is",
"within",
"the",
"range",
"determined",
"by",
"system",
"configuration",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L2027-L2044 |
118,922 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.startFile | void startFile(String src, PermissionStatus permissions,
String holder, String clientMachine,
boolean overwrite, boolean createParent, short replication, long blockSize
) throws IOException {
INodeFileUnderConstruction file =
startFileInternal(src, permissions, holder, clie... | java | void startFile(String src, PermissionStatus permissions,
String holder, String clientMachine,
boolean overwrite, boolean createParent, short replication, long blockSize
) throws IOException {
INodeFileUnderConstruction file =
startFileInternal(src, permissions, holder, clie... | [
"void",
"startFile",
"(",
"String",
"src",
",",
"PermissionStatus",
"permissions",
",",
"String",
"holder",
",",
"String",
"clientMachine",
",",
"boolean",
"overwrite",
",",
"boolean",
"createParent",
",",
"short",
"replication",
",",
"long",
"blockSize",
")",
"... | Create a new file entry in the namespace.
@throws IOException if file name is invalid
{@link FSDirectory#isValidToCreate(String)}.
@see ClientProtocol#create(String, FsPermission, String, boolean, short, long) | [
"Create",
"a",
"new",
"file",
"entry",
"in",
"the",
"namespace",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L2071-L2084 |
118,923 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.recoverLease | boolean recoverLease(String src, String holder, String clientMachine,
boolean discardLastBlock) throws IOException {
// convert names to array of bytes w/o holding lock
byte[][] components = INodeDirectory.getPathComponents(src);
writeLock();
try {
if (isInSafeMode... | java | boolean recoverLease(String src, String holder, String clientMachine,
boolean discardLastBlock) throws IOException {
// convert names to array of bytes w/o holding lock
byte[][] components = INodeDirectory.getPathComponents(src);
writeLock();
try {
if (isInSafeMode... | [
"boolean",
"recoverLease",
"(",
"String",
"src",
",",
"String",
"holder",
",",
"String",
"clientMachine",
",",
"boolean",
"discardLastBlock",
")",
"throws",
"IOException",
"{",
"// convert names to array of bytes w/o holding lock",
"byte",
"[",
"]",
"[",
"]",
"compone... | Recover lease;
Immediately revoke the lease of the current lease holder and start lease
recovery so that the file can be forced to be closed.
@param src the path of the file to start lease recovery
@param holder the lease holder's name
@param clientMachine the client machine's name
@param discardLastBlock if true, the... | [
"Recover",
"lease",
";",
"Immediately",
"revoke",
"the",
"lease",
"of",
"the",
"current",
"lease",
"holder",
"and",
"start",
"lease",
"recovery",
"so",
"that",
"the",
"file",
"can",
"be",
"forced",
"to",
"be",
"closed",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L2257-L2290 |
118,924 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.getAdditionalBlock | public LocatedBlock getAdditionalBlock(String src,
String clientName
) throws IOException {
return getAdditionalBlock(src, clientName, null);
} | java | public LocatedBlock getAdditionalBlock(String src,
String clientName
) throws IOException {
return getAdditionalBlock(src, clientName, null);
} | [
"public",
"LocatedBlock",
"getAdditionalBlock",
"(",
"String",
"src",
",",
"String",
"clientName",
")",
"throws",
"IOException",
"{",
"return",
"getAdditionalBlock",
"(",
"src",
",",
"clientName",
",",
"null",
")",
";",
"}"
] | Stub for old callers pre-HDFS-630 | [
"Stub",
"for",
"old",
"callers",
"pre",
"-",
"HDFS",
"-",
"630"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L2472-L2476 |
118,925 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.findBestDatanodeInCluster | private DatanodeDescriptor[] findBestDatanodeInCluster(
List<DatanodeInfo> infos, int replication)
throws IOException {
int targetReplication = Math.min(infos.size(), replication);
DatanodeDescriptor[] dns = new DatanodeDescriptor[targetReplication];
boolean[] changedRacks = new boolean[targetRe... | java | private DatanodeDescriptor[] findBestDatanodeInCluster(
List<DatanodeInfo> infos, int replication)
throws IOException {
int targetReplication = Math.min(infos.size(), replication);
DatanodeDescriptor[] dns = new DatanodeDescriptor[targetReplication];
boolean[] changedRacks = new boolean[targetRe... | [
"private",
"DatanodeDescriptor",
"[",
"]",
"findBestDatanodeInCluster",
"(",
"List",
"<",
"DatanodeInfo",
">",
"infos",
",",
"int",
"replication",
")",
"throws",
"IOException",
"{",
"int",
"targetReplication",
"=",
"Math",
".",
"min",
"(",
"infos",
".",
"size",
... | Given information about an array of datanodes,
returns an array of DatanodeDescriptors for the
same, or if it doesn't find the datanode, it looks for a machine local and
then rack local datanode, if a rack local datanode is not possible either,
it returns the DatanodeDescriptor of any random node in the cluster.
@para... | [
"Given",
"information",
"about",
"an",
"array",
"of",
"datanodes",
"returns",
"an",
"array",
"of",
"DatanodeDescriptors",
"for",
"the",
"same",
"or",
"if",
"it",
"doesn",
"t",
"find",
"the",
"datanode",
"it",
"looks",
"for",
"a",
"machine",
"local",
"and",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L2495-L2571 |
118,926 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.setLastBlockSize | private void setLastBlockSize(INodeFileUnderConstruction pendingFile) {
Block block = pendingFile.getLastBlock();
if (block != null) {
block.setNumBytes(pendingFile.getPreferredBlockSize());
}
} | java | private void setLastBlockSize(INodeFileUnderConstruction pendingFile) {
Block block = pendingFile.getLastBlock();
if (block != null) {
block.setNumBytes(pendingFile.getPreferredBlockSize());
}
} | [
"private",
"void",
"setLastBlockSize",
"(",
"INodeFileUnderConstruction",
"pendingFile",
")",
"{",
"Block",
"block",
"=",
"pendingFile",
".",
"getLastBlock",
"(",
")",
";",
"if",
"(",
"block",
"!=",
"null",
")",
"{",
"block",
".",
"setNumBytes",
"(",
"pendingF... | Set last block's block size to be the file's default block size
@param file file inode under construction | [
"Set",
"last",
"block",
"s",
"block",
"size",
"to",
"be",
"the",
"file",
"s",
"default",
"block",
"size"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L2877-L2882 |
118,927 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.replicateLastBlock | private void replicateLastBlock(String src, INodeFileUnderConstruction file) {
BlockInfo[] blks = file.getBlocks();
if (blks == null || blks.length == 0)
return;
BlockInfo block = blks[blks.length-1];
DatanodeDescriptor[] targets = file.getValidTargets();
final int numOfTargets = targets == nu... | java | private void replicateLastBlock(String src, INodeFileUnderConstruction file) {
BlockInfo[] blks = file.getBlocks();
if (blks == null || blks.length == 0)
return;
BlockInfo block = blks[blks.length-1];
DatanodeDescriptor[] targets = file.getValidTargets();
final int numOfTargets = targets == nu... | [
"private",
"void",
"replicateLastBlock",
"(",
"String",
"src",
",",
"INodeFileUnderConstruction",
"file",
")",
"{",
"BlockInfo",
"[",
"]",
"blks",
"=",
"file",
".",
"getBlocks",
"(",
")",
";",
"if",
"(",
"blks",
"==",
"null",
"||",
"blks",
".",
"length",
... | Check last block of the file under construction
Replicate it if it is under replicated
@param src the file name
@param file the file's inode | [
"Check",
"last",
"block",
"of",
"the",
"file",
"under",
"construction",
"Replicate",
"it",
"if",
"it",
"is",
"under",
"replicated"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L2890-L2923 |
118,928 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.abandonBlock | public boolean abandonBlock(Block b, String src, String holder
) throws IOException {
writeLock();
try {
//
// Remove the block from the pending creates list
//
if (NameNode.stateChangeLog.isDebugEnabled()) {
NameNode.stateChangeLog.debug("BLOCK* NameSystem.abandonBlock: "
... | java | public boolean abandonBlock(Block b, String src, String holder
) throws IOException {
writeLock();
try {
//
// Remove the block from the pending creates list
//
if (NameNode.stateChangeLog.isDebugEnabled()) {
NameNode.stateChangeLog.debug("BLOCK* NameSystem.abandonBlock: "
... | [
"public",
"boolean",
"abandonBlock",
"(",
"Block",
"b",
",",
"String",
"src",
",",
"String",
"holder",
")",
"throws",
"IOException",
"{",
"writeLock",
"(",
")",
";",
"try",
"{",
"//",
"// Remove the block from the pending creates list",
"//",
"if",
"(",
"NameNod... | The client would like to let go of the given block | [
"The",
"client",
"would",
"like",
"to",
"let",
"go",
"of",
"the",
"given",
"block"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L2928-L2954 |
118,929 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.checkLease | private INodeFileUnderConstruction checkLease(String src, String holder)
throws IOException {
INodeFile file = dir.getFileINode(src);
return checkLease(src, holder, file);
} | java | private INodeFileUnderConstruction checkLease(String src, String holder)
throws IOException {
INodeFile file = dir.getFileINode(src);
return checkLease(src, holder, file);
} | [
"private",
"INodeFileUnderConstruction",
"checkLease",
"(",
"String",
"src",
",",
"String",
"holder",
")",
"throws",
"IOException",
"{",
"INodeFile",
"file",
"=",
"dir",
".",
"getFileINode",
"(",
"src",
")",
";",
"return",
"checkLease",
"(",
"src",
",",
"holde... | make sure that we still have the lease on this file. | [
"make",
"sure",
"that",
"we",
"still",
"have",
"the",
"lease",
"on",
"this",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3099-L3103 |
118,930 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.allocateBlock | private Block allocateBlock(String src, INode[] inodes) throws IOException {
Block b = new Block(generateBlockId(), 0, 0);
while (isValidBlock(b)) {
b.setBlockId(generateBlockId());
}
b.setGenerationStamp(getGenerationStamp());
b = dir.addBlock(src, inodes, b);
return b;
} | java | private Block allocateBlock(String src, INode[] inodes) throws IOException {
Block b = new Block(generateBlockId(), 0, 0);
while (isValidBlock(b)) {
b.setBlockId(generateBlockId());
}
b.setGenerationStamp(getGenerationStamp());
b = dir.addBlock(src, inodes, b);
return b;
} | [
"private",
"Block",
"allocateBlock",
"(",
"String",
"src",
",",
"INode",
"[",
"]",
"inodes",
")",
"throws",
"IOException",
"{",
"Block",
"b",
"=",
"new",
"Block",
"(",
"generateBlockId",
"(",
")",
",",
"0",
",",
"0",
")",
";",
"while",
"(",
"isValidBlo... | Allocate a block at the given pending filename
@param src path to the file
@param inodes INode representing each of the components of src.
<code>inodes[inodes.length-1]</code> is the INode for the file. | [
"Allocate",
"a",
"block",
"at",
"the",
"given",
"pending",
"filename"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3307-L3315 |
118,931 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.allocateParityBlocks | private Block[] allocateParityBlocks(int numParityBlocks) throws IOException {
Block[] blocks = new Block[numParityBlocks];
for (int i = 0; i < numParityBlocks; i++) {
Block b = new Block(generateBlockId(), 0, 0);
while (isValidBlock(b)) {
b.setBlockId(generateBlockId());
}
b.set... | java | private Block[] allocateParityBlocks(int numParityBlocks) throws IOException {
Block[] blocks = new Block[numParityBlocks];
for (int i = 0; i < numParityBlocks; i++) {
Block b = new Block(generateBlockId(), 0, 0);
while (isValidBlock(b)) {
b.setBlockId(generateBlockId());
}
b.set... | [
"private",
"Block",
"[",
"]",
"allocateParityBlocks",
"(",
"int",
"numParityBlocks",
")",
"throws",
"IOException",
"{",
"Block",
"[",
"]",
"blocks",
"=",
"new",
"Block",
"[",
"numParityBlocks",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
... | Allocate a number of parity blocks
Require a write lock
@param numParityBlocks | [
"Allocate",
"a",
"number",
"of",
"parity",
"blocks",
"Require",
"a",
"write",
"lock"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3322-L3333 |
118,932 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.checkFileProgress | boolean checkFileProgress(INodeFile v, boolean checkall)
throws IOException {
INode.enforceRegularStorageINode(v,
"checkFileProgress is not supported for non-regular files");
if (checkall) {
//
// check all blocks of the file.
//
int closeFileReplicationMin =
Math.m... | java | boolean checkFileProgress(INodeFile v, boolean checkall)
throws IOException {
INode.enforceRegularStorageINode(v,
"checkFileProgress is not supported for non-regular files");
if (checkall) {
//
// check all blocks of the file.
//
int closeFileReplicationMin =
Math.m... | [
"boolean",
"checkFileProgress",
"(",
"INodeFile",
"v",
",",
"boolean",
"checkall",
")",
"throws",
"IOException",
"{",
"INode",
".",
"enforceRegularStorageINode",
"(",
"v",
",",
"\"checkFileProgress is not supported for non-regular files\"",
")",
";",
"if",
"(",
"checkal... | Check that the indicated file's blocks are present and
replicated. If not, return false. If checkall is true, then check
all blocks, otherwise check only penultimate block. | [
"Check",
"that",
"the",
"indicated",
"file",
"s",
"blocks",
"are",
"present",
"and",
"replicated",
".",
"If",
"not",
"return",
"false",
".",
"If",
"checkall",
"is",
"true",
"then",
"check",
"all",
"blocks",
"otherwise",
"check",
"only",
"penultimate",
"block... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3340-L3363 |
118,933 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.removeFromInvalidates | void removeFromInvalidates(String storageID) {
LightWeightHashSet<Block> blocks = recentInvalidateSets.remove(storageID);
if (blocks != null) {
pendingDeletionBlocksCount -= blocks.size();
}
} | java | void removeFromInvalidates(String storageID) {
LightWeightHashSet<Block> blocks = recentInvalidateSets.remove(storageID);
if (blocks != null) {
pendingDeletionBlocksCount -= blocks.size();
}
} | [
"void",
"removeFromInvalidates",
"(",
"String",
"storageID",
")",
"{",
"LightWeightHashSet",
"<",
"Block",
">",
"blocks",
"=",
"recentInvalidateSets",
".",
"remove",
"(",
"storageID",
")",
";",
"if",
"(",
"blocks",
"!=",
"null",
")",
"{",
"pendingDeletionBlocksC... | Remove a datanode from the invalidatesSet
@param n datanode | [
"Remove",
"a",
"datanode",
"from",
"the",
"invalidatesSet"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3386-L3391 |
118,934 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.addToInvalidates | void addToInvalidates(Block b, DatanodeInfo n, boolean ackRequired) {
addToInvalidatesNoLog(b, n, ackRequired);
if (isInitialized && !isInSafeModeInternal()) {
// do not log in startup phase
NameNode.stateChangeLog.info("BLOCK* NameSystem.addToInvalidates: "
+ b.getBlockName() + " is added t... | java | void addToInvalidates(Block b, DatanodeInfo n, boolean ackRequired) {
addToInvalidatesNoLog(b, n, ackRequired);
if (isInitialized && !isInSafeModeInternal()) {
// do not log in startup phase
NameNode.stateChangeLog.info("BLOCK* NameSystem.addToInvalidates: "
+ b.getBlockName() + " is added t... | [
"void",
"addToInvalidates",
"(",
"Block",
"b",
",",
"DatanodeInfo",
"n",
",",
"boolean",
"ackRequired",
")",
"{",
"addToInvalidatesNoLog",
"(",
"b",
",",
"n",
",",
"ackRequired",
")",
";",
"if",
"(",
"isInitialized",
"&&",
"!",
"isInSafeModeInternal",
"(",
"... | Adds block to list of blocks which will be invalidated on
specified datanode and log the move
@param b block
@param n datanode | [
"Adds",
"block",
"to",
"list",
"of",
"blocks",
"which",
"will",
"be",
"invalidated",
"on",
"specified",
"datanode",
"and",
"log",
"the",
"move"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3400-L3407 |
118,935 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.addToInvalidatesNoLog | void addToInvalidatesNoLog(Block b, DatanodeInfo n, boolean ackRequired) {
// We are the standby avatar and we don't want to add blocks to the
// invalidates list.
if (this.getNameNode().shouldRetryAbsentBlocks()) {
return;
}
LightWeightHashSet<Block> invalidateSet = recentInvalidateSets.get(... | java | void addToInvalidatesNoLog(Block b, DatanodeInfo n, boolean ackRequired) {
// We are the standby avatar and we don't want to add blocks to the
// invalidates list.
if (this.getNameNode().shouldRetryAbsentBlocks()) {
return;
}
LightWeightHashSet<Block> invalidateSet = recentInvalidateSets.get(... | [
"void",
"addToInvalidatesNoLog",
"(",
"Block",
"b",
",",
"DatanodeInfo",
"n",
",",
"boolean",
"ackRequired",
")",
"{",
"// We are the standby avatar and we don't want to add blocks to the",
"// invalidates list.",
"if",
"(",
"this",
".",
"getNameNode",
"(",
")",
".",
"s... | Adds block to list of blocks which will be invalidated on
specified datanode
@param b block
@param n datanode | [
"Adds",
"block",
"to",
"list",
"of",
"blocks",
"which",
"will",
"be",
"invalidated",
"on",
"specified",
"datanode"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3416-L3435 |
118,936 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.addToInvalidates | private void addToInvalidates(Block b, boolean ackRequired) {
StringBuilder sb = new StringBuilder();
for (Iterator<DatanodeDescriptor> it =
blocksMap.nodeIterator(b); it.hasNext();) {
DatanodeDescriptor node = it.next();
addToInvalidatesNoLog(b, node, ackRequired);
sb.append(node.getNam... | java | private void addToInvalidates(Block b, boolean ackRequired) {
StringBuilder sb = new StringBuilder();
for (Iterator<DatanodeDescriptor> it =
blocksMap.nodeIterator(b); it.hasNext();) {
DatanodeDescriptor node = it.next();
addToInvalidatesNoLog(b, node, ackRequired);
sb.append(node.getNam... | [
"private",
"void",
"addToInvalidates",
"(",
"Block",
"b",
",",
"boolean",
"ackRequired",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Iterator",
"<",
"DatanodeDescriptor",
">",
"it",
"=",
"blocksMap",
".",
"nodeIt... | Adds block to list of blocks which will be invalidated on
all its datanodes. | [
"Adds",
"block",
"to",
"list",
"of",
"blocks",
"which",
"will",
"be",
"invalidated",
"on",
"all",
"its",
"datanodes",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3441-L3455 |
118,937 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.markBlockAsCorrupt | public void markBlockAsCorrupt(Block blk, DatanodeInfo dn,
final boolean parallelInitialBlockReport) throws IOException {
if (!parallelInitialBlockReport) {
// regular call, not through parallel block report
writeLock();
}
lockParallelBRLock(parallelInitialBlockReport);
try {
... | java | public void markBlockAsCorrupt(Block blk, DatanodeInfo dn,
final boolean parallelInitialBlockReport) throws IOException {
if (!parallelInitialBlockReport) {
// regular call, not through parallel block report
writeLock();
}
lockParallelBRLock(parallelInitialBlockReport);
try {
... | [
"public",
"void",
"markBlockAsCorrupt",
"(",
"Block",
"blk",
",",
"DatanodeInfo",
"dn",
",",
"final",
"boolean",
"parallelInitialBlockReport",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"parallelInitialBlockReport",
")",
"{",
"// regular call, not through parall... | Mark the block belonging to datanode as corrupt
@param blk Block to be marked as corrupt
@param dn Datanode which holds the corrupt replica
@param parallelInitialBlockReport indicates that this call
is a result of parallel initial block report | [
"Mark",
"the",
"block",
"belonging",
"to",
"datanode",
"as",
"corrupt"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3508-L3567 |
118,938 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.invalidateBlock | private void invalidateBlock(Block blk, DatanodeInfo dn, boolean ackRequired)
throws IOException {
NameNode.stateChangeLog.info("DIR* NameSystem.invalidateBlock: "
+ blk + " on "
+ dn.getName());
DatanodeDescriptor node = getDatanode(dn);
if (node == null) {
throw new IOException("Cann... | java | private void invalidateBlock(Block blk, DatanodeInfo dn, boolean ackRequired)
throws IOException {
NameNode.stateChangeLog.info("DIR* NameSystem.invalidateBlock: "
+ blk + " on "
+ dn.getName());
DatanodeDescriptor node = getDatanode(dn);
if (node == null) {
throw new IOException("Cann... | [
"private",
"void",
"invalidateBlock",
"(",
"Block",
"blk",
",",
"DatanodeInfo",
"dn",
",",
"boolean",
"ackRequired",
")",
"throws",
"IOException",
"{",
"NameNode",
".",
"stateChangeLog",
".",
"info",
"(",
"\"DIR* NameSystem.invalidateBlock: \"",
"+",
"blk",
"+",
"... | Invalidates the given block on the given datanode. | [
"Invalidates",
"the",
"given",
"block",
"on",
"the",
"given",
"datanode",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3572-L3601 |
118,939 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.hardLinkTo | public boolean hardLinkTo(String src, String dst) throws IOException {
INode dstNode = hardLinkToInternal(src, dst);
getEditLog().logSync(false);
if (dstNode != null && auditLog.isInfoEnabled()) {
logAuditEvent(getCurrentUGI(), Server.getRemoteIp(),
"hardlink", src, dst, dstNode);
}
... | java | public boolean hardLinkTo(String src, String dst) throws IOException {
INode dstNode = hardLinkToInternal(src, dst);
getEditLog().logSync(false);
if (dstNode != null && auditLog.isInfoEnabled()) {
logAuditEvent(getCurrentUGI(), Server.getRemoteIp(),
"hardlink", src, dst, dstNode);
}
... | [
"public",
"boolean",
"hardLinkTo",
"(",
"String",
"src",
",",
"String",
"dst",
")",
"throws",
"IOException",
"{",
"INode",
"dstNode",
"=",
"hardLinkToInternal",
"(",
"src",
",",
"dst",
")",
";",
"getEditLog",
"(",
")",
".",
"logSync",
"(",
"false",
")",
... | Create the hard link from src file to the dest file. | [
"Create",
"the",
"hard",
"link",
"from",
"src",
"file",
"to",
"the",
"dest",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3624-L3632 |
118,940 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.deleteInternal | boolean deleteInternal(String src, INode[] inodes, boolean recursive,
boolean enforcePermission) throws IOException {
ArrayList<BlockInfo> collectedBlocks = new ArrayList<BlockInfo>();
INode targetNode = null;
byte[][] components = inodes == null ?
INodeDirectory.getPathCompo... | java | boolean deleteInternal(String src, INode[] inodes, boolean recursive,
boolean enforcePermission) throws IOException {
ArrayList<BlockInfo> collectedBlocks = new ArrayList<BlockInfo>();
INode targetNode = null;
byte[][] components = inodes == null ?
INodeDirectory.getPathCompo... | [
"boolean",
"deleteInternal",
"(",
"String",
"src",
",",
"INode",
"[",
"]",
"inodes",
",",
"boolean",
"recursive",
",",
"boolean",
"enforcePermission",
")",
"throws",
"IOException",
"{",
"ArrayList",
"<",
"BlockInfo",
">",
"collectedBlocks",
"=",
"new",
"ArrayLis... | Remove the indicated filename from the namespace. This may
invalidate some blocks that make up the file. | [
"Remove",
"the",
"indicated",
"filename",
"from",
"the",
"namespace",
".",
"This",
"may",
"invalidate",
"some",
"blocks",
"that",
"make",
"up",
"the",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3789-L3860 |
118,941 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.removeBlocks | private void removeBlocks(List<BlockInfo> blocks) {
if (blocks == null) {
return;
}
for (BlockInfo b : blocks) {
removeFromExcessReplicateMap(b);
neededReplications.remove(b, -1);
corruptReplicas.removeFromCorruptReplicasMap(b);
if (pendingReplications != null) {
int re... | java | private void removeBlocks(List<BlockInfo> blocks) {
if (blocks == null) {
return;
}
for (BlockInfo b : blocks) {
removeFromExcessReplicateMap(b);
neededReplications.remove(b, -1);
corruptReplicas.removeFromCorruptReplicasMap(b);
if (pendingReplications != null) {
int re... | [
"private",
"void",
"removeBlocks",
"(",
"List",
"<",
"BlockInfo",
">",
"blocks",
")",
"{",
"if",
"(",
"blocks",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"BlockInfo",
"b",
":",
"blocks",
")",
"{",
"removeFromExcessReplicateMap",
"(",
"b",
... | From the given list, incrementally remove the blocks. Add the blocks
to invalidates, and set a flag that explicit ACK from DataNode is not
required. This function should be used only for deleting entire files. | [
"From",
"the",
"given",
"list",
"incrementally",
"remove",
"the",
"blocks",
".",
"Add",
"the",
"blocks",
"to",
"invalidates",
"and",
"set",
"a",
"flag",
"that",
"explicit",
"ACK",
"from",
"DataNode",
"is",
"not",
"required",
".",
"This",
"function",
"should"... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3867-L3884 |
118,942 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.removePathAndBlocks | void removePathAndBlocks(String src, List<BlockInfo> blocks) throws IOException {
// No need for lock until we start accepting requests from clients.
assert (!nameNode.isRpcServerRunning() || hasWriteLock());
leaseManager.removeLeaseWithPrefixPath(src);
removeBlocks(blocks);
} | java | void removePathAndBlocks(String src, List<BlockInfo> blocks) throws IOException {
// No need for lock until we start accepting requests from clients.
assert (!nameNode.isRpcServerRunning() || hasWriteLock());
leaseManager.removeLeaseWithPrefixPath(src);
removeBlocks(blocks);
} | [
"void",
"removePathAndBlocks",
"(",
"String",
"src",
",",
"List",
"<",
"BlockInfo",
">",
"blocks",
")",
"throws",
"IOException",
"{",
"// No need for lock until we start accepting requests from clients.",
"assert",
"(",
"!",
"nameNode",
".",
"isRpcServerRunning",
"(",
"... | Remove the blocks from the given list. Also, remove the path. Add the
blocks to invalidates, and set a flag that explicit ACK from DataNode is
not required. This function should be used only for deleting entire files. | [
"Remove",
"the",
"blocks",
"from",
"the",
"given",
"list",
".",
"Also",
"remove",
"the",
"path",
".",
"Add",
"the",
"blocks",
"to",
"invalidates",
"and",
"set",
"a",
"flag",
"that",
"explicit",
"ACK",
"from",
"DataNode",
"is",
"not",
"required",
".",
"Th... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3891-L3896 |
118,943 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.fsync | void fsync(String src, String clientName) throws IOException {
NameNode.stateChangeLog.info("BLOCK* NameSystem.fsync: file "
+ src + " for " + clientName);
writeLock();
try {
if (isInSafeMode()) {
throw new SafeModeException("Cannot fsync file " + src, safeMode);
}
INodeFile... | java | void fsync(String src, String clientName) throws IOException {
NameNode.stateChangeLog.info("BLOCK* NameSystem.fsync: file "
+ src + " for " + clientName);
writeLock();
try {
if (isInSafeMode()) {
throw new SafeModeException("Cannot fsync file " + src, safeMode);
}
INodeFile... | [
"void",
"fsync",
"(",
"String",
"src",
",",
"String",
"clientName",
")",
"throws",
"IOException",
"{",
"NameNode",
".",
"stateChangeLog",
".",
"info",
"(",
"\"BLOCK* NameSystem.fsync: file \"",
"+",
"src",
"+",
"\" for \"",
"+",
"clientName",
")",
";",
"writeLoc... | Persist all metadata about this file.
@param src The string representation of the path
@param clientName The string representation of the client
@throws IOException if path does not exist | [
"Persist",
"all",
"metadata",
"about",
"this",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L4108-L4130 |
118,944 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.internalReleaseLease | void internalReleaseLease(Lease lease, String src,
INodeFileUnderConstruction pendingFile) throws IOException {
if (lease.hasPath()) {
// make a copy of the paths because internalReleaseLeaseOne removes
// pathnames from the lease record.
String[] leasePaths = new String[lease.getPaths().siz... | java | void internalReleaseLease(Lease lease, String src,
INodeFileUnderConstruction pendingFile) throws IOException {
if (lease.hasPath()) {
// make a copy of the paths because internalReleaseLeaseOne removes
// pathnames from the lease record.
String[] leasePaths = new String[lease.getPaths().siz... | [
"void",
"internalReleaseLease",
"(",
"Lease",
"lease",
",",
"String",
"src",
",",
"INodeFileUnderConstruction",
"pendingFile",
")",
"throws",
"IOException",
"{",
"if",
"(",
"lease",
".",
"hasPath",
"(",
")",
")",
"{",
"// make a copy of the paths because internalRelea... | This is invoked when a lease expires. On lease expiry,
all the files that were written from that dfsclient should be
recovered. | [
"This",
"is",
"invoked",
"when",
"a",
"lease",
"expires",
".",
"On",
"lease",
"expiry",
"all",
"the",
"files",
"that",
"were",
"written",
"from",
"that",
"dfsclient",
"should",
"be",
"recovered",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L4137-L4152 |
118,945 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.discardDone | private boolean discardDone(INodeFileUnderConstruction pendingFile,
String src) throws IOException {
Block[] blocks = pendingFile.getBlocks();
if (blocks == null || blocks.length == 0) {
return false;
}
Block last = blocks[blocks.length-1];
if (last.getNumBytes() ... | java | private boolean discardDone(INodeFileUnderConstruction pendingFile,
String src) throws IOException {
Block[] blocks = pendingFile.getBlocks();
if (blocks == null || blocks.length == 0) {
return false;
}
Block last = blocks[blocks.length-1];
if (last.getNumBytes() ... | [
"private",
"boolean",
"discardDone",
"(",
"INodeFileUnderConstruction",
"pendingFile",
",",
"String",
"src",
")",
"throws",
"IOException",
"{",
"Block",
"[",
"]",
"blocks",
"=",
"pendingFile",
".",
"getBlocks",
"(",
")",
";",
"if",
"(",
"blocks",
"==",
"null",... | the last block completely. | [
"the",
"last",
"block",
"completely",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L4238-L4254 |
118,946 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.updatePipeline | void updatePipeline(String clientName, Block oldBlock,
Block newBlock, List<DatanodeID> newNodes) throws IOException {
LOG.info("updatePipeline(block=" + oldBlock
+ ", newGenerationStamp=" + newBlock.getGenerationStamp()
+ ", newLength=" + newBlock.getNumBytes()
+ ", newNodes=" + newN... | java | void updatePipeline(String clientName, Block oldBlock,
Block newBlock, List<DatanodeID> newNodes) throws IOException {
LOG.info("updatePipeline(block=" + oldBlock
+ ", newGenerationStamp=" + newBlock.getGenerationStamp()
+ ", newLength=" + newBlock.getNumBytes()
+ ", newNodes=" + newN... | [
"void",
"updatePipeline",
"(",
"String",
"clientName",
",",
"Block",
"oldBlock",
",",
"Block",
"newBlock",
",",
"List",
"<",
"DatanodeID",
">",
"newNodes",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"info",
"(",
"\"updatePipeline(block=\"",
"+",
"oldBlock",
... | Update a pipeline for a block under construction
@param clientName the name of the client
@param oldBlock an old block
@param newBlock a new block with a new generation stamp and length
@param newNodes if any error occurs
@throws IOException | [
"Update",
"a",
"pipeline",
"for",
"a",
"block",
"under",
"construction"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L4478-L4547 |
118,947 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.newStorageID | private String newStorageID() {
String newID = null;
while (newID == null) {
newID = "DS" + Integer.toString(r.nextInt());
if (datanodeMap.get(newID) != null) {
newID = null;
}
}
return newID;
} | java | private String newStorageID() {
String newID = null;
while (newID == null) {
newID = "DS" + Integer.toString(r.nextInt());
if (datanodeMap.get(newID) != null) {
newID = null;
}
}
return newID;
} | [
"private",
"String",
"newStorageID",
"(",
")",
"{",
"String",
"newID",
"=",
"null",
";",
"while",
"(",
"newID",
"==",
"null",
")",
"{",
"newID",
"=",
"\"DS\"",
"+",
"Integer",
".",
"toString",
"(",
"r",
".",
"nextInt",
"(",
")",
")",
";",
"if",
"("... | Generate new storage ID.
@return unique storage ID
<p/>
Note: that collisions are still possible if somebody will try
to bring in a data storage from a different cluster. | [
"Generate",
"new",
"storage",
"ID",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L4845-L4854 |
118,948 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.computeDatanodeWork | public int computeDatanodeWork() throws IOException {
int workFound = 0;
int blocksToProcess = 0;
int nodesToProcess = 0;
// blocks should not be replicated or removed if safe mode is on
if (isInSafeMode()) {
updateReplicationCounts(workFound);
return workFound;
}
synchronized (h... | java | public int computeDatanodeWork() throws IOException {
int workFound = 0;
int blocksToProcess = 0;
int nodesToProcess = 0;
// blocks should not be replicated or removed if safe mode is on
if (isInSafeMode()) {
updateReplicationCounts(workFound);
return workFound;
}
synchronized (h... | [
"public",
"int",
"computeDatanodeWork",
"(",
")",
"throws",
"IOException",
"{",
"int",
"workFound",
"=",
"0",
";",
"int",
"blocksToProcess",
"=",
"0",
";",
"int",
"nodesToProcess",
"=",
"0",
";",
"// blocks should not be replicated or removed if safe mode is on",
"if"... | Compute block replication and block invalidation work
that can be scheduled on data-nodes.
The datanode will be informed of this work at the next heartbeat.
@return number of blocks scheduled for replication or removal. | [
"Compute",
"block",
"replication",
"and",
"block",
"invalidation",
"work",
"that",
"can",
"be",
"scheduled",
"on",
"data",
"-",
"nodes",
".",
"The",
"datanode",
"will",
"be",
"informed",
"of",
"this",
"work",
"at",
"the",
"next",
"heartbeat",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L5196-L5219 |
118,949 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.computeInvalidateWork | int computeInvalidateWork(int nodesToProcess) {
int numOfNodes = 0;
ArrayList<String> keyArray = null;
readLock();
try {
numOfNodes = recentInvalidateSets.size();
// get an array of the keys
keyArray = new ArrayList<String>(recentInvalidateSets.keySet());
} finally {
readUnl... | java | int computeInvalidateWork(int nodesToProcess) {
int numOfNodes = 0;
ArrayList<String> keyArray = null;
readLock();
try {
numOfNodes = recentInvalidateSets.size();
// get an array of the keys
keyArray = new ArrayList<String>(recentInvalidateSets.keySet());
} finally {
readUnl... | [
"int",
"computeInvalidateWork",
"(",
"int",
"nodesToProcess",
")",
"{",
"int",
"numOfNodes",
"=",
"0",
";",
"ArrayList",
"<",
"String",
">",
"keyArray",
"=",
"null",
";",
"readLock",
"(",
")",
";",
"try",
"{",
"numOfNodes",
"=",
"recentInvalidateSets",
".",
... | Schedule blocks for deletion at datanodes
@param nodesToProcess number of datanodes to schedule deletion work
@return total number of block for deletion | [
"Schedule",
"blocks",
"for",
"deletion",
"at",
"datanodes"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L5239-L5274 |
118,950 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.getQuotaForThisPriority | private int getQuotaForThisPriority(int totalQuota, int blocksForThisPriority,
int blocksForLowerPriorities) {
// reserve at most 20% for lower priority blocks
int quotaForLowerPriorities =
Math.min(totalQuota/5, blocksForLowerPriorities);
return Math.min( blocksForThisPriority,
... | java | private int getQuotaForThisPriority(int totalQuota, int blocksForThisPriority,
int blocksForLowerPriorities) {
// reserve at most 20% for lower priority blocks
int quotaForLowerPriorities =
Math.min(totalQuota/5, blocksForLowerPriorities);
return Math.min( blocksForThisPriority,
... | [
"private",
"int",
"getQuotaForThisPriority",
"(",
"int",
"totalQuota",
",",
"int",
"blocksForThisPriority",
",",
"int",
"blocksForLowerPriorities",
")",
"{",
"// reserve at most 20% for lower priority blocks",
"int",
"quotaForLowerPriorities",
"=",
"Math",
".",
"min",
"(",
... | Decide the number of blocks to replicate on for this priority.
The heuristic is that allocate at most 20% the quota for
lower priority blocks
@param totalQuota max number of blocks can be replicated
@param blocksForThisPriority
number of needed replication blocks for this priority
@param blocksForLowerPriorities
numbe... | [
"Decide",
"the",
"number",
"of",
"blocks",
"to",
"replicate",
"on",
"for",
"this",
"priority",
".",
"The",
"heuristic",
"is",
"that",
"allocate",
"at",
"most",
"20%",
"the",
"quota",
"for",
"lower",
"priority",
"blocks"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L5311-L5318 |
118,951 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.chooseUnderReplicatedBlocks | List<List<BlockInfo>> chooseUnderReplicatedBlocks(int blocksToProcess) {
// initialize data structure for the return value
List<List<BlockInfo>> blocksToReplicate =
new ArrayList<List<BlockInfo>>(UnderReplicatedBlocks.LEVEL);
for (int i = 0; i < UnderReplicatedBlocks.LEVEL; i++) {
blocksToReplic... | java | List<List<BlockInfo>> chooseUnderReplicatedBlocks(int blocksToProcess) {
// initialize data structure for the return value
List<List<BlockInfo>> blocksToReplicate =
new ArrayList<List<BlockInfo>>(UnderReplicatedBlocks.LEVEL);
for (int i = 0; i < UnderReplicatedBlocks.LEVEL; i++) {
blocksToReplic... | [
"List",
"<",
"List",
"<",
"BlockInfo",
">",
">",
"chooseUnderReplicatedBlocks",
"(",
"int",
"blocksToProcess",
")",
"{",
"// initialize data structure for the return value",
"List",
"<",
"List",
"<",
"BlockInfo",
">>",
"blocksToReplicate",
"=",
"new",
"ArrayList",
"<"... | Get a list of block lists to be replicated
The index of block lists represents the
@param blocksToProcess
@return Return a list of block lists to be replicated.
The block list index represents its replication priority. | [
"Get",
"a",
"list",
"of",
"block",
"lists",
"to",
"be",
"replicated",
"The",
"index",
"of",
"block",
"lists",
"represents",
"the"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L5328-L5377 |
118,952 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.updateReplicationMetrics | private void updateReplicationMetrics(List<ReplicationWork> work) {
for(ReplicationWork rw : work){
DatanodeDescriptor[] targets = rw.targets;
if (targets == null) continue;
for (DatanodeDescriptor target : targets) {
if (clusterMap.isOnSameRack(rw.srcNode, target)) {
myFSMetrics... | java | private void updateReplicationMetrics(List<ReplicationWork> work) {
for(ReplicationWork rw : work){
DatanodeDescriptor[] targets = rw.targets;
if (targets == null) continue;
for (DatanodeDescriptor target : targets) {
if (clusterMap.isOnSameRack(rw.srcNode, target)) {
myFSMetrics... | [
"private",
"void",
"updateReplicationMetrics",
"(",
"List",
"<",
"ReplicationWork",
">",
"work",
")",
"{",
"for",
"(",
"ReplicationWork",
"rw",
":",
"work",
")",
"{",
"DatanodeDescriptor",
"[",
"]",
"targets",
"=",
"rw",
".",
"targets",
";",
"if",
"(",
"ta... | Update replication metrics
@param work record for all scheduled replication | [
"Update",
"replication",
"metrics"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L5558-L5570 |
118,953 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.chooseTarget | private DatanodeDescriptor[] chooseTarget(ReplicationWork work) {
if (!neededReplications.contains(work.block)) {
return null;
}
if (work.blockSize == BlockFlags.NO_ACK) {
LOG.warn("Block " + work.block.getBlockId() +
" of the file " + getFullPathName(work.fileINode) +
" is... | java | private DatanodeDescriptor[] chooseTarget(ReplicationWork work) {
if (!neededReplications.contains(work.block)) {
return null;
}
if (work.blockSize == BlockFlags.NO_ACK) {
LOG.warn("Block " + work.block.getBlockId() +
" of the file " + getFullPathName(work.fileINode) +
" is... | [
"private",
"DatanodeDescriptor",
"[",
"]",
"chooseTarget",
"(",
"ReplicationWork",
"work",
")",
"{",
"if",
"(",
"!",
"neededReplications",
".",
"contains",
"(",
"work",
".",
"block",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"work",
".",
"blo... | Wrapper function for choosing targets for replication. | [
"Wrapper",
"function",
"for",
"choosing",
"targets",
"for",
"replication",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L5588-L5607 |
118,954 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.isGoodReplica | private boolean isGoodReplica(DatanodeDescriptor node, Block block) {
Collection<Block> excessBlocks =
excessReplicateMap.get(node.getStorageID());
Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(block);
return (nodesCorrupt == null || !nodesCorrupt.contains(node)) // not corrup... | java | private boolean isGoodReplica(DatanodeDescriptor node, Block block) {
Collection<Block> excessBlocks =
excessReplicateMap.get(node.getStorageID());
Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(block);
return (nodesCorrupt == null || !nodesCorrupt.contains(node)) // not corrup... | [
"private",
"boolean",
"isGoodReplica",
"(",
"DatanodeDescriptor",
"node",
",",
"Block",
"block",
")",
"{",
"Collection",
"<",
"Block",
">",
"excessBlocks",
"=",
"excessReplicateMap",
".",
"get",
"(",
"node",
".",
"getStorageID",
"(",
")",
")",
";",
"Collection... | Decide if a replica is valid
@param node datanode the block is located
@param block a block
@return true if a replica is valid | [
"Decide",
"if",
"a",
"replica",
"is",
"valid"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L5697-L5707 |
118,955 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.processPendingReplications | void processPendingReplications() {
BlockInfo[] timedOutItems = pendingReplications.getTimedOutBlocks();
if (timedOutItems != null) {
writeLock();
try {
for (int i = 0; i < timedOutItems.length; i++) {
NumberReplicas num = countNodes(timedOutItems[i]);
neededReplications.... | java | void processPendingReplications() {
BlockInfo[] timedOutItems = pendingReplications.getTimedOutBlocks();
if (timedOutItems != null) {
writeLock();
try {
for (int i = 0; i < timedOutItems.length; i++) {
NumberReplicas num = countNodes(timedOutItems[i]);
neededReplications.... | [
"void",
"processPendingReplications",
"(",
")",
"{",
"BlockInfo",
"[",
"]",
"timedOutItems",
"=",
"pendingReplications",
".",
"getTimedOutBlocks",
"(",
")",
";",
"if",
"(",
"timedOutItems",
"!=",
"null",
")",
"{",
"writeLock",
"(",
")",
";",
"try",
"{",
"for... | If there were any replication requests that timed out, reap them
and put them back into the neededReplication queue | [
"If",
"there",
"were",
"any",
"replication",
"requests",
"that",
"timed",
"out",
"reap",
"them",
"and",
"put",
"them",
"back",
"into",
"the",
"neededReplication",
"queue"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L5771-L5791 |
118,956 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.clearReplicationQueues | void clearReplicationQueues() {
writeLock();
try {
synchronized (neededReplications) {
neededReplications.clear();
}
underReplicatedBlocksCount = 0;
corruptReplicas.clear();
corruptReplicaBlocksCount = 0;
overReplicatedBlocks.clear();
raidEncodingTasks.clear()... | java | void clearReplicationQueues() {
writeLock();
try {
synchronized (neededReplications) {
neededReplications.clear();
}
underReplicatedBlocksCount = 0;
corruptReplicas.clear();
corruptReplicaBlocksCount = 0;
overReplicatedBlocks.clear();
raidEncodingTasks.clear()... | [
"void",
"clearReplicationQueues",
"(",
")",
"{",
"writeLock",
"(",
")",
";",
"try",
"{",
"synchronized",
"(",
"neededReplications",
")",
"{",
"neededReplications",
".",
"clear",
"(",
")",
";",
"}",
"underReplicatedBlocksCount",
"=",
"0",
";",
"corruptReplicas",
... | Clear replication queues. This is used by standby avatar to reclaim memory. | [
"Clear",
"replication",
"queues",
".",
"This",
"is",
"used",
"by",
"standby",
"avatar",
"to",
"reclaim",
"memory",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L5817-L5836 |
118,957 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.wipeDatanode | void wipeDatanode(DatanodeID nodeID) throws IOException {
String key = nodeID.getStorageID();
host2DataNodeMap.remove(datanodeMap.remove(key));
if (NameNode.stateChangeLog.isDebugEnabled()) {
NameNode.stateChangeLog.debug(
"BLOCK* NameSystem.wipeDatanode: "
+ nodeID.getName() + " sto... | java | void wipeDatanode(DatanodeID nodeID) throws IOException {
String key = nodeID.getStorageID();
host2DataNodeMap.remove(datanodeMap.remove(key));
if (NameNode.stateChangeLog.isDebugEnabled()) {
NameNode.stateChangeLog.debug(
"BLOCK* NameSystem.wipeDatanode: "
+ nodeID.getName() + " sto... | [
"void",
"wipeDatanode",
"(",
"DatanodeID",
"nodeID",
")",
"throws",
"IOException",
"{",
"String",
"key",
"=",
"nodeID",
".",
"getStorageID",
"(",
")",
";",
"host2DataNodeMap",
".",
"remove",
"(",
"datanodeMap",
".",
"remove",
"(",
"key",
")",
")",
";",
"if... | Physically remove node from datanodeMap.
@param nodeID node | [
"Physically",
"remove",
"node",
"from",
"datanodeMap",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L5899-L5908 |
118,958 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.heartbeatCheck | void heartbeatCheck() {
if (!getNameNode().shouldCheckHeartbeat()) {
// not to check dead nodes.
return;
}
boolean allAlive = false;
while (!allAlive) {
boolean foundDead = false;
DatanodeID nodeID = null;
// locate the first dead node.
synchronized (heartbeats) {
... | java | void heartbeatCheck() {
if (!getNameNode().shouldCheckHeartbeat()) {
// not to check dead nodes.
return;
}
boolean allAlive = false;
while (!allAlive) {
boolean foundDead = false;
DatanodeID nodeID = null;
// locate the first dead node.
synchronized (heartbeats) {
... | [
"void",
"heartbeatCheck",
"(",
")",
"{",
"if",
"(",
"!",
"getNameNode",
"(",
")",
".",
"shouldCheckHeartbeat",
"(",
")",
")",
"{",
"// not to check dead nodes.",
"return",
";",
"}",
"boolean",
"allAlive",
"=",
"false",
";",
"while",
"(",
"!",
"allAlive",
"... | Check if there are any expired heartbeats, and if so,
whether any blocks have to be re-replicated.
While removing dead datanodes, make sure that only one datanode is marked
dead at a time within the synchronized section. Otherwise, a cascading
effect causes more datanodes to be declared dead. | [
"Check",
"if",
"there",
"are",
"any",
"expired",
"heartbeats",
"and",
"if",
"so",
"whether",
"any",
"blocks",
"have",
"to",
"be",
"re",
"-",
"replicated",
".",
"While",
"removing",
"dead",
"datanodes",
"make",
"sure",
"that",
"only",
"one",
"datanode",
"is... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L5925-L5974 |
118,959 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.checkBlockSize | private boolean checkBlockSize(Block block, INodeFile inode) {
if (block.getNumBytes() < 0) {
return false;
}
BlockInfo[] blocks = inode.getBlocks();
if (blocks.length == 0) {
return false;
}
return block.getNumBytes() <= inode.getPreferredBlockSize();
} | java | private boolean checkBlockSize(Block block, INodeFile inode) {
if (block.getNumBytes() < 0) {
return false;
}
BlockInfo[] blocks = inode.getBlocks();
if (blocks.length == 0) {
return false;
}
return block.getNumBytes() <= inode.getPreferredBlockSize();
} | [
"private",
"boolean",
"checkBlockSize",
"(",
"Block",
"block",
",",
"INodeFile",
"inode",
")",
"{",
"if",
"(",
"block",
".",
"getNumBytes",
"(",
")",
"<",
"0",
")",
"{",
"return",
"false",
";",
"}",
"BlockInfo",
"[",
"]",
"blocks",
"=",
"inode",
".",
... | Return true if the block size number is valid | [
"Return",
"true",
"if",
"the",
"block",
"size",
"number",
"is",
"valid"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L6199-L6208 |
118,960 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.rejectAddStoredBlock | private void rejectAddStoredBlock(Block block,
DatanodeDescriptor node,
String msg,
boolean ignoreInfoLogs,
final boolean parallelInitialBlockReport) {
if ((!isInSafe... | java | private void rejectAddStoredBlock(Block block,
DatanodeDescriptor node,
String msg,
boolean ignoreInfoLogs,
final boolean parallelInitialBlockReport) {
if ((!isInSafe... | [
"private",
"void",
"rejectAddStoredBlock",
"(",
"Block",
"block",
",",
"DatanodeDescriptor",
"node",
",",
"String",
"msg",
",",
"boolean",
"ignoreInfoLogs",
",",
"final",
"boolean",
"parallelInitialBlockReport",
")",
"{",
"if",
"(",
"(",
"!",
"isInSafeModeInternal",... | Log a rejection of an addStoredBlock RPC, invalidate the reported block.
@param block
@param node
@param msg error message
@param ignoreInfoLogs should the logs be printed (used for fast startup)
@param parallelInitialBlockReport indicates that this call
is a result of parallel initial block report | [
"Log",
"a",
"rejection",
"of",
"an",
"addStoredBlock",
"RPC",
"invalidate",
"the",
"reported",
"block",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L6561-L6580 |
118,961 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.processOverReplicatedBlocksAsync | private void processOverReplicatedBlocksAsync() {
// blocks should not be scheduled for deletion during safemode
if (isInSafeMode()) {
return;
}
if (delayOverreplicationMonitorTime > now()) {
LOG.info("Overreplication monitor delayed for "
+ ((delayOverreplicationMonitorTime ... | java | private void processOverReplicatedBlocksAsync() {
// blocks should not be scheduled for deletion during safemode
if (isInSafeMode()) {
return;
}
if (delayOverreplicationMonitorTime > now()) {
LOG.info("Overreplication monitor delayed for "
+ ((delayOverreplicationMonitorTime ... | [
"private",
"void",
"processOverReplicatedBlocksAsync",
"(",
")",
"{",
"// blocks should not be scheduled for deletion during safemode",
"if",
"(",
"isInSafeMode",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"delayOverreplicationMonitorTime",
">",
"now",
"(",
")",... | This is called from the ReplicationMonitor to process over
replicated blocks. | [
"This",
"is",
"called",
"from",
"the",
"ReplicationMonitor",
"to",
"process",
"over",
"replicated",
"blocks",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L6909-L6954 |
118,962 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.updateNeededReplicationQueue | private void updateNeededReplicationQueue(BlockInfo blockInfo, int delta,
int numCurrentReplicas, int numCurrentDecommissionedReplicas,
DatanodeDescriptor node, short fileReplication) {
int numOldReplicas = numCurrentReplicas;
int numOldDecommissionedReplicas = numCurrentDecommissionedReplicas;
... | java | private void updateNeededReplicationQueue(BlockInfo blockInfo, int delta,
int numCurrentReplicas, int numCurrentDecommissionedReplicas,
DatanodeDescriptor node, short fileReplication) {
int numOldReplicas = numCurrentReplicas;
int numOldDecommissionedReplicas = numCurrentDecommissionedReplicas;
... | [
"private",
"void",
"updateNeededReplicationQueue",
"(",
"BlockInfo",
"blockInfo",
",",
"int",
"delta",
",",
"int",
"numCurrentReplicas",
",",
"int",
"numCurrentDecommissionedReplicas",
",",
"DatanodeDescriptor",
"node",
",",
"short",
"fileReplication",
")",
"{",
"int",
... | Update a block's priority queue in neededReplicaiton queues
@param blockInfo blockInfo
@param delta the change of number of replicas
@param numCurrentReplicas current number of replicas
@param numCurrentDecommissionedReplicas current number of decommissioed replicas
@param node the node where the replica resides
@para... | [
"Update",
"a",
"block",
"s",
"priority",
"queue",
"in",
"neededReplicaiton",
"queues"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L7554-L7572 |
118,963 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.blockReceived | private boolean blockReceived(Block block,
String delHint,
DatanodeDescriptor node) throws IOException {
assert (hasWriteLock());
// decrement number of blocks scheduled to this datanode.
node.decBlocksScheduled();
// get the deletion hint node
... | java | private boolean blockReceived(Block block,
String delHint,
DatanodeDescriptor node) throws IOException {
assert (hasWriteLock());
// decrement number of blocks scheduled to this datanode.
node.decBlocksScheduled();
// get the deletion hint node
... | [
"private",
"boolean",
"blockReceived",
"(",
"Block",
"block",
",",
"String",
"delHint",
",",
"DatanodeDescriptor",
"node",
")",
"throws",
"IOException",
"{",
"assert",
"(",
"hasWriteLock",
"(",
")",
")",
";",
"// decrement number of blocks scheduled to this datanode.",
... | The given node is reporting that it received a certain block. | [
"The",
"given",
"node",
"is",
"reporting",
"that",
"it",
"received",
"a",
"certain",
"block",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L7605-L7629 |
118,964 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.getDatanodes | DatanodeInfo[] getDatanodes(DatanodeReportType type) {
ArrayList<DatanodeDescriptor> results = getDatanodeListForReport(type);
DatanodeInfo[] arr = new DatanodeInfo[results.size()];
for (int i = 0; i < arr.length; i++) {
arr[i] = new DatanodeInfo(results.get(i));
}
return arr;
} | java | DatanodeInfo[] getDatanodes(DatanodeReportType type) {
ArrayList<DatanodeDescriptor> results = getDatanodeListForReport(type);
DatanodeInfo[] arr = new DatanodeInfo[results.size()];
for (int i = 0; i < arr.length; i++) {
arr[i] = new DatanodeInfo(results.get(i));
}
return arr;
} | [
"DatanodeInfo",
"[",
"]",
"getDatanodes",
"(",
"DatanodeReportType",
"type",
")",
"{",
"ArrayList",
"<",
"DatanodeDescriptor",
">",
"results",
"=",
"getDatanodeListForReport",
"(",
"type",
")",
";",
"DatanodeInfo",
"[",
"]",
"arr",
"=",
"new",
"DatanodeInfo",
"[... | Get all the datanodes of the given type
@param type type of the datanodes
@return a list of datanodes | [
"Get",
"all",
"the",
"datanodes",
"of",
"the",
"given",
"type"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L7844-L7851 |
118,965 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.saveNamespace | void saveNamespace(boolean force, boolean uncompressed) throws AccessControlException, IOException {
LOG.info("Saving namespace");
writeLock();
try {
checkSuperuserPrivilege();
if(!force && !isInSafeMode()) {
throw new IOException("Safe mode should be turned ON " +
"in order to... | java | void saveNamespace(boolean force, boolean uncompressed) throws AccessControlException, IOException {
LOG.info("Saving namespace");
writeLock();
try {
checkSuperuserPrivilege();
if(!force && !isInSafeMode()) {
throw new IOException("Safe mode should be turned ON " +
"in order to... | [
"void",
"saveNamespace",
"(",
"boolean",
"force",
",",
"boolean",
"uncompressed",
")",
"throws",
"AccessControlException",
",",
"IOException",
"{",
"LOG",
".",
"info",
"(",
"\"Saving namespace\"",
")",
";",
"writeLock",
"(",
")",
";",
"try",
"{",
"checkSuperuser... | Save namespace image.
This will save current namespace into fsimage file and empty edits file.
Requires superuser privilege and safe mode.
@param force if true, then the namenode need not already be in safemode.
@throws AccessControlException if superuser privilege is violated.
@throws IOException if | [
"Save",
"namespace",
"image",
".",
"This",
"will",
"save",
"current",
"namespace",
"into",
"fsimage",
"file",
"and",
"empty",
"edits",
"file",
".",
"Requires",
"superuser",
"privilege",
"and",
"safe",
"mode",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L7862-L7876 |
118,966 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.datanodeDump | private void datanodeDump(PrintWriter out) {
readLock();
try {
synchronized (datanodeMap) {
out.println("Metasave: Number of datanodes: " + datanodeMap.size());
for (Iterator<DatanodeDescriptor> it = datanodeMap.values().iterator(); it.hasNext();) {
DatanodeDescriptor node = it.n... | java | private void datanodeDump(PrintWriter out) {
readLock();
try {
synchronized (datanodeMap) {
out.println("Metasave: Number of datanodes: " + datanodeMap.size());
for (Iterator<DatanodeDescriptor> it = datanodeMap.values().iterator(); it.hasNext();) {
DatanodeDescriptor node = it.n... | [
"private",
"void",
"datanodeDump",
"(",
"PrintWriter",
"out",
")",
"{",
"readLock",
"(",
")",
";",
"try",
"{",
"synchronized",
"(",
"datanodeMap",
")",
"{",
"out",
".",
"println",
"(",
"\"Metasave: Number of datanodes: \"",
"+",
"datanodeMap",
".",
"size",
"("... | Prints information about all datanodes. | [
"Prints",
"information",
"about",
"all",
"datanodes",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L7901-L7914 |
118,967 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.startDecommission | void startDecommission(DatanodeDescriptor node)
throws IOException {
if (!node.isDecommissionInProgress() && !node.isDecommissioned()) {
LOG.info("Start Decommissioning node " + node.getName() + " with " +
node.numBlocks() + " blocks.");
synchronized (heartbeats) {
updateS... | java | void startDecommission(DatanodeDescriptor node)
throws IOException {
if (!node.isDecommissionInProgress() && !node.isDecommissioned()) {
LOG.info("Start Decommissioning node " + node.getName() + " with " +
node.numBlocks() + " blocks.");
synchronized (heartbeats) {
updateS... | [
"void",
"startDecommission",
"(",
"DatanodeDescriptor",
"node",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"node",
".",
"isDecommissionInProgress",
"(",
")",
"&&",
"!",
"node",
".",
"isDecommissioned",
"(",
")",
")",
"{",
"LOG",
".",
"info",
"(",
"... | Start decommissioning the specified datanode. | [
"Start",
"decommissioning",
"the",
"specified",
"datanode",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L7919-L7938 |
118,968 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.stopDecommission | void stopDecommission(DatanodeDescriptor node)
throws IOException {
if ((node.isDecommissionInProgress() &&
((Monitor) dnthread.getRunnable()).stopDecommission(node)) ||
node.isDecommissioned()) {
LOG.info("Stop Decommissioning node " + node.getName());
synchronized (heartbeats) {
... | java | void stopDecommission(DatanodeDescriptor node)
throws IOException {
if ((node.isDecommissionInProgress() &&
((Monitor) dnthread.getRunnable()).stopDecommission(node)) ||
node.isDecommissioned()) {
LOG.info("Stop Decommissioning node " + node.getName());
synchronized (heartbeats) {
... | [
"void",
"stopDecommission",
"(",
"DatanodeDescriptor",
"node",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"node",
".",
"isDecommissionInProgress",
"(",
")",
"&&",
"(",
"(",
"Monitor",
")",
"dnthread",
".",
"getRunnable",
"(",
")",
")",
".",
"stopDeco... | Stop decommissioning the specified datanodes. | [
"Stop",
"decommissioning",
"the",
"specified",
"datanodes",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L7943-L7969 |
118,969 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.countLiveNodes | private int countLiveNodes(Block b, Iterator<DatanodeDescriptor> nodeIter) {
int live = 0;
Collection<DatanodeDescriptor> nodesCorrupt = null;
if (corruptReplicas.size() != 0) {
nodesCorrupt = corruptReplicas.getNodes(b);
}
while (nodeIter.hasNext()) {
DatanodeDescriptor node = nodeIter.... | java | private int countLiveNodes(Block b, Iterator<DatanodeDescriptor> nodeIter) {
int live = 0;
Collection<DatanodeDescriptor> nodesCorrupt = null;
if (corruptReplicas.size() != 0) {
nodesCorrupt = corruptReplicas.getNodes(b);
}
while (nodeIter.hasNext()) {
DatanodeDescriptor node = nodeIter.... | [
"private",
"int",
"countLiveNodes",
"(",
"Block",
"b",
",",
"Iterator",
"<",
"DatanodeDescriptor",
">",
"nodeIter",
")",
"{",
"int",
"live",
"=",
"0",
";",
"Collection",
"<",
"DatanodeDescriptor",
">",
"nodesCorrupt",
"=",
"null",
";",
"if",
"(",
"corruptRep... | Counts the number of live nodes in the given list | [
"Counts",
"the",
"number",
"of",
"live",
"nodes",
"in",
"the",
"given",
"list"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8105-L8121 |
118,970 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.isReplicationInProgress | BlockInfo isReplicationInProgress(final DecommissioningStatus status,
final DatanodeDescriptor srcNode, final BlockInfo block,
boolean addToNeeded) {
INode fileINode = blocksMap.getINode(block);
if (fileINode == null) {
return null;
}
NumberReplicas num = countNodes(block);
int cur... | java | BlockInfo isReplicationInProgress(final DecommissioningStatus status,
final DatanodeDescriptor srcNode, final BlockInfo block,
boolean addToNeeded) {
INode fileINode = blocksMap.getINode(block);
if (fileINode == null) {
return null;
}
NumberReplicas num = countNodes(block);
int cur... | [
"BlockInfo",
"isReplicationInProgress",
"(",
"final",
"DecommissioningStatus",
"status",
",",
"final",
"DatanodeDescriptor",
"srcNode",
",",
"final",
"BlockInfo",
"block",
",",
"boolean",
"addToNeeded",
")",
"{",
"INode",
"fileINode",
"=",
"blocksMap",
".",
"getINode"... | Check if a block on srcNode has reached its replication factor or not
@param status decomission status to update; null means no update
@param srcNode a datanode
@param block a block
@param addToNeeded if the block needs to add to needReplication queue
@return block if not addToNeeded and the block needes to added la... | [
"Check",
"if",
"a",
"block",
"on",
"srcNode",
"has",
"reached",
"its",
"replication",
"factor",
"or",
"not"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8193-L8235 |
118,971 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.getHostNameForIp | private String getHostNameForIp(String ipAddr) {
try {
// this handles the case where the hostlist contains names
// and the datanodes are using IPs
InetAddress addr = InetAddress.getByName(ipAddr);
return addr.getHostName();
} catch (Exception e) {
// this can be safely ignored
... | java | private String getHostNameForIp(String ipAddr) {
try {
// this handles the case where the hostlist contains names
// and the datanodes are using IPs
InetAddress addr = InetAddress.getByName(ipAddr);
return addr.getHostName();
} catch (Exception e) {
// this can be safely ignored
... | [
"private",
"String",
"getHostNameForIp",
"(",
"String",
"ipAddr",
")",
"{",
"try",
"{",
"// this handles the case where the hostlist contains names",
"// and the datanodes are using IPs",
"InetAddress",
"addr",
"=",
"InetAddress",
".",
"getByName",
"(",
"ipAddr",
")",
";",
... | Best effort reverse DNS resolution.
Returns null on error. | [
"Best",
"effort",
"reverse",
"DNS",
"resolution",
".",
"Returns",
"null",
"on",
"error",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8241-L8251 |
118,972 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.verifyNodeRegistration | private boolean verifyNodeRegistration(DatanodeRegistration nodeReg, String ipAddr)
throws IOException {
assert (hasWriteLock());
return inHostsList(nodeReg, ipAddr);
} | java | private boolean verifyNodeRegistration(DatanodeRegistration nodeReg, String ipAddr)
throws IOException {
assert (hasWriteLock());
return inHostsList(nodeReg, ipAddr);
} | [
"private",
"boolean",
"verifyNodeRegistration",
"(",
"DatanodeRegistration",
"nodeReg",
",",
"String",
"ipAddr",
")",
"throws",
"IOException",
"{",
"assert",
"(",
"hasWriteLock",
"(",
")",
")",
";",
"return",
"inHostsList",
"(",
"nodeReg",
",",
"ipAddr",
")",
";... | Checks if the node is not on the hosts list. If it is not, then
it will be disallowed from registering. | [
"Checks",
"if",
"the",
"node",
"is",
"not",
"on",
"the",
"hosts",
"list",
".",
"If",
"it",
"is",
"not",
"then",
"it",
"will",
"be",
"disallowed",
"from",
"registering",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8393-L8397 |
118,973 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.checkDecommissioning | private void checkDecommissioning(DatanodeDescriptor nodeReg, String ipAddr)
throws IOException {
// If the registered node is in exclude list, then decommission it
if (inExcludedHostsList(nodeReg, ipAddr)) {
startDecommission(nodeReg);
}
} | java | private void checkDecommissioning(DatanodeDescriptor nodeReg, String ipAddr)
throws IOException {
// If the registered node is in exclude list, then decommission it
if (inExcludedHostsList(nodeReg, ipAddr)) {
startDecommission(nodeReg);
}
} | [
"private",
"void",
"checkDecommissioning",
"(",
"DatanodeDescriptor",
"nodeReg",
",",
"String",
"ipAddr",
")",
"throws",
"IOException",
"{",
"// If the registered node is in exclude list, then decommission it",
"if",
"(",
"inExcludedHostsList",
"(",
"nodeReg",
",",
"ipAddr",
... | Decommission the node if it is in exclude list. | [
"Decommission",
"the",
"node",
"if",
"it",
"is",
"in",
"exclude",
"list",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8402-L8408 |
118,974 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.getDatanode | public DatanodeDescriptor getDatanode(DatanodeID nodeID) throws IOException {
UnregisteredDatanodeException e = null;
DatanodeDescriptor node = datanodeMap.get(nodeID.getStorageID());
if (node == null) {
return null;
}
if (!node.getName().equals(nodeID.getName())) {
e = new UnregisteredD... | java | public DatanodeDescriptor getDatanode(DatanodeID nodeID) throws IOException {
UnregisteredDatanodeException e = null;
DatanodeDescriptor node = datanodeMap.get(nodeID.getStorageID());
if (node == null) {
return null;
}
if (!node.getName().equals(nodeID.getName())) {
e = new UnregisteredD... | [
"public",
"DatanodeDescriptor",
"getDatanode",
"(",
"DatanodeID",
"nodeID",
")",
"throws",
"IOException",
"{",
"UnregisteredDatanodeException",
"e",
"=",
"null",
";",
"DatanodeDescriptor",
"node",
"=",
"datanodeMap",
".",
"get",
"(",
"nodeID",
".",
"getStorageID",
"... | Get data node by storage ID.
@param nodeID
@return DatanodeDescriptor or null if the node is not found.
@throws IOException | [
"Get",
"data",
"node",
"by",
"storage",
"ID",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8417-L8430 |
118,975 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.incrementSafeBlockCount | void incrementSafeBlockCount(int replication, boolean skipCheck) {
if (safeMode != null && safeMode.isOn()) {
if ((int) replication == minReplication) {
this.blocksSafe++;
if(!skipCheck) {
safeMode.checkMode();
}
}
}
} | java | void incrementSafeBlockCount(int replication, boolean skipCheck) {
if (safeMode != null && safeMode.isOn()) {
if ((int) replication == minReplication) {
this.blocksSafe++;
if(!skipCheck) {
safeMode.checkMode();
}
}
}
} | [
"void",
"incrementSafeBlockCount",
"(",
"int",
"replication",
",",
"boolean",
"skipCheck",
")",
"{",
"if",
"(",
"safeMode",
"!=",
"null",
"&&",
"safeMode",
".",
"isOn",
"(",
")",
")",
"{",
"if",
"(",
"(",
"int",
")",
"replication",
"==",
"minReplication",
... | Increment number of blocks that reached minimal replication.
@param replication current replication
@param skipCheck if true the safemode will not be checked -
used for processing initial block reports to skip the
check for every block - at the end checkSafeMode() must be called | [
"Increment",
"number",
"of",
"blocks",
"that",
"reached",
"minimal",
"replication",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8575-L8584 |
118,976 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.enterSafeMode | void enterSafeMode() throws IOException {
writeLock();
try {
// Ensure that any concurrent operations have been fully synced
// before entering safe mode. This ensures that the FSImage
// is entirely stable on disk as soon as we're in safe mode.
getEditLog().logSyncAll();
if (!isIn... | java | void enterSafeMode() throws IOException {
writeLock();
try {
// Ensure that any concurrent operations have been fully synced
// before entering safe mode. This ensures that the FSImage
// is entirely stable on disk as soon as we're in safe mode.
getEditLog().logSyncAll();
if (!isIn... | [
"void",
"enterSafeMode",
"(",
")",
"throws",
"IOException",
"{",
"writeLock",
"(",
")",
";",
"try",
"{",
"// Ensure that any concurrent operations have been fully synced",
"// before entering safe mode. This ensures that the FSImage",
"// is entirely stable on disk as soon as we're in ... | Enter safe mode manually.
@throws IOException | [
"Enter",
"safe",
"mode",
"manually",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8686-L8705 |
118,977 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.leaveSafeMode | void leaveSafeMode(boolean checkForUpgrades) throws SafeModeException {
writeLock();
try {
if (!isInSafeMode()) {
NameNode.stateChangeLog.info("STATE* Safe mode is already OFF.");
return;
}
if (getDistributedUpgradeState()) {
throw new SafeModeException("Distributed upg... | java | void leaveSafeMode(boolean checkForUpgrades) throws SafeModeException {
writeLock();
try {
if (!isInSafeMode()) {
NameNode.stateChangeLog.info("STATE* Safe mode is already OFF.");
return;
}
if (getDistributedUpgradeState()) {
throw new SafeModeException("Distributed upg... | [
"void",
"leaveSafeMode",
"(",
"boolean",
"checkForUpgrades",
")",
"throws",
"SafeModeException",
"{",
"writeLock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"isInSafeMode",
"(",
")",
")",
"{",
"NameNode",
".",
"stateChangeLog",
".",
"info",
"(",
"\"STATE* S... | Leave safe mode.
@throws IOException | [
"Leave",
"safe",
"mode",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8712-L8728 |
118,978 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.initializeReplQueues | void initializeReplQueues() throws SafeModeException {
writeLock();
try {
if (isPopulatingReplQueues()) {
NameNode.stateChangeLog.info("STATE* Safe mode is already OFF."
+ " Replication queues are initialized");
return;
}
safeMode.initializeReplicationQueues();
... | java | void initializeReplQueues() throws SafeModeException {
writeLock();
try {
if (isPopulatingReplQueues()) {
NameNode.stateChangeLog.info("STATE* Safe mode is already OFF."
+ " Replication queues are initialized");
return;
}
safeMode.initializeReplicationQueues();
... | [
"void",
"initializeReplQueues",
"(",
")",
"throws",
"SafeModeException",
"{",
"writeLock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"isPopulatingReplQueues",
"(",
")",
")",
"{",
"NameNode",
".",
"stateChangeLog",
".",
"info",
"(",
"\"STATE* Safe mode is already OFF.\... | Manually initialize replication queues when in safemode. | [
"Manually",
"initialize",
"replication",
"queues",
"when",
"in",
"safemode",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8733-L8745 |
118,979 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.nextGenerationStampForBlock | public long nextGenerationStampForBlock(Block block, boolean fromNN) throws IOException {
writeLock();
try {
if (isInSafeMode()) {
throw new SafeModeException("Cannot get nextGenStamp for " + block, safeMode);
}
Block blockWithWildcardGenstamp = new Block(block.getBlockId());
Blo... | java | public long nextGenerationStampForBlock(Block block, boolean fromNN) throws IOException {
writeLock();
try {
if (isInSafeMode()) {
throw new SafeModeException("Cannot get nextGenStamp for " + block, safeMode);
}
Block blockWithWildcardGenstamp = new Block(block.getBlockId());
Blo... | [
"public",
"long",
"nextGenerationStampForBlock",
"(",
"Block",
"block",
",",
"boolean",
"fromNN",
")",
"throws",
"IOException",
"{",
"writeLock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"isInSafeMode",
"(",
")",
")",
"{",
"throw",
"new",
"SafeModeException",
"... | Verifies that the block is associated with a file that has a lease.
Increments, logs and then returns the stamp
@param block block
@param fromNN if it is for lease recovery initiated by NameNode
@return a new generation stamp | [
"Verifies",
"that",
"the",
"block",
"is",
"associated",
"with",
"a",
"file",
"that",
"has",
"a",
"lease",
".",
"Increments",
"logs",
"and",
"then",
"returns",
"the",
"stamp"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L9116-L9161 |
118,980 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.saveFilesUnderConstruction | void saveFilesUnderConstruction(SaveNamespaceContext ctx, DataOutputStream out) throws IOException {
synchronized (leaseManager) {
int pathsToSave = 0;
Iterator<Lease> itrl = leaseManager.getSortedLeases().iterator();
while (itrl.hasNext()) {
Lease lease = itrl.next();
for (String ... | java | void saveFilesUnderConstruction(SaveNamespaceContext ctx, DataOutputStream out) throws IOException {
synchronized (leaseManager) {
int pathsToSave = 0;
Iterator<Lease> itrl = leaseManager.getSortedLeases().iterator();
while (itrl.hasNext()) {
Lease lease = itrl.next();
for (String ... | [
"void",
"saveFilesUnderConstruction",
"(",
"SaveNamespaceContext",
"ctx",
",",
"DataOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"leaseManager",
")",
"{",
"int",
"pathsToSave",
"=",
"0",
";",
"Iterator",
"<",
"Lease",
">",
"itrl",
... | Serializes leases. | [
"Serializes",
"leases",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L9194-L9257 |
118,981 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.getLiveNodes | @Override // NameNodeMXBean
public String getLiveNodes() {
final Map<String, Map<String,Object>> info =
new HashMap<String, Map<String,Object>>();
try {
final ArrayList<DatanodeDescriptor> liveNodeList =
new ArrayList<DatanodeDescriptor>();
final ArrayList<DatanodeDescriptor> deadN... | java | @Override // NameNodeMXBean
public String getLiveNodes() {
final Map<String, Map<String,Object>> info =
new HashMap<String, Map<String,Object>>();
try {
final ArrayList<DatanodeDescriptor> liveNodeList =
new ArrayList<DatanodeDescriptor>();
final ArrayList<DatanodeDescriptor> deadN... | [
"@",
"Override",
"// NameNodeMXBean",
"public",
"String",
"getLiveNodes",
"(",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"info",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"O... | Returned information is a JSON representation of map with host name as the
key and value is a map of live node attribute keys to its values | [
"Returned",
"information",
"is",
"a",
"JSON",
"representation",
"of",
"map",
"with",
"host",
"name",
"as",
"the",
"key",
"and",
"value",
"is",
"a",
"map",
"of",
"live",
"node",
"attribute",
"keys",
"to",
"its",
"values"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L9782-L9805 |
118,982 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.getDecomNodes | @Override // NameNodeMXBean
public String getDecomNodes() {
final Map<String, Map<String, Object>> info =
new HashMap<String, Map<String, Object>>();
try {
final ArrayList<DatanodeDescriptor> decomNodeList =
this.getDecommissioningNodesList();
for (DatanodeDescriptor node : decomNo... | java | @Override // NameNodeMXBean
public String getDecomNodes() {
final Map<String, Map<String, Object>> info =
new HashMap<String, Map<String, Object>>();
try {
final ArrayList<DatanodeDescriptor> decomNodeList =
this.getDecommissioningNodesList();
for (DatanodeDescriptor node : decomNo... | [
"@",
"Override",
"// NameNodeMXBean",
"public",
"String",
"getDecomNodes",
"(",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"info",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"... | Returned information is a JSON representation of map with host name as the
key and value is a map of decomisioning node attribute keys to its values | [
"Returned",
"information",
"is",
"a",
"JSON",
"representation",
"of",
"map",
"with",
"host",
"name",
"as",
"the",
"key",
"and",
"value",
"is",
"a",
"map",
"of",
"decomisioning",
"node",
"attribute",
"keys",
"to",
"its",
"values"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L9840-L9861 |
118,983 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.adjustReplication | public short adjustReplication(short replication) {
short r = (short) (replication < minReplication? minReplication
: replication > maxReplication? maxReplication: replication);
return r;
} | java | public short adjustReplication(short replication) {
short r = (short) (replication < minReplication? minReplication
: replication > maxReplication? maxReplication: replication);
return r;
} | [
"public",
"short",
"adjustReplication",
"(",
"short",
"replication",
")",
"{",
"short",
"r",
"=",
"(",
"short",
")",
"(",
"replication",
"<",
"minReplication",
"?",
"minReplication",
":",
"replication",
">",
"maxReplication",
"?",
"maxReplication",
":",
"replica... | Clamp the specified replication between the minimum and the maximum
replication levels. | [
"Clamp",
"the",
"specified",
"replication",
"between",
"the",
"minimum",
"and",
"the",
"maximum",
"replication",
"levels",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L10078-L10082 |
118,984 | facebookarchive/hadoop-20 | src/contrib/storageservice/src/java/org/apache/hadoop/hdfs/storageservice/StorageServiceConfigKeys.java | StorageServiceConfigKeys.translateToOldSchema | @Deprecated
public static URI translateToOldSchema(Configuration clusterConf, String nameserviceId) {
String key = FSConstants.DFS_NAMENODE_RPC_ADDRESS_KEY + "." + nameserviceId;
String value = clusterConf.get(key);
if (value == null) {
throw new IllegalArgumentException(
"Cannot translate... | java | @Deprecated
public static URI translateToOldSchema(Configuration clusterConf, String nameserviceId) {
String key = FSConstants.DFS_NAMENODE_RPC_ADDRESS_KEY + "." + nameserviceId;
String value = clusterConf.get(key);
if (value == null) {
throw new IllegalArgumentException(
"Cannot translate... | [
"@",
"Deprecated",
"public",
"static",
"URI",
"translateToOldSchema",
"(",
"Configuration",
"clusterConf",
",",
"String",
"nameserviceId",
")",
"{",
"String",
"key",
"=",
"FSConstants",
".",
"DFS_NAMENODE_RPC_ADDRESS_KEY",
"+",
"\".\"",
"+",
"nameserviceId",
";",
"S... | Translates nameserviceId to ZK key in deprecated layout | [
"Translates",
"nameserviceId",
"to",
"ZK",
"key",
"in",
"deprecated",
"layout"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/storageservice/src/java/org/apache/hadoop/hdfs/storageservice/StorageServiceConfigKeys.java#L57-L67 |
118,985 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetUtils.java | NetUtils.getSocketFactoryFromProperty | public static SocketFactory getSocketFactoryFromProperty(
Configuration conf, String propValue) {
try {
Class<?> theClass = conf.getClassByName(propValue);
return (SocketFactory) ReflectionUtils.newInstance(theClass, conf);
} catch (ClassNotFoundException cnfe) {
throw new RuntimeExcep... | java | public static SocketFactory getSocketFactoryFromProperty(
Configuration conf, String propValue) {
try {
Class<?> theClass = conf.getClassByName(propValue);
return (SocketFactory) ReflectionUtils.newInstance(theClass, conf);
} catch (ClassNotFoundException cnfe) {
throw new RuntimeExcep... | [
"public",
"static",
"SocketFactory",
"getSocketFactoryFromProperty",
"(",
"Configuration",
"conf",
",",
"String",
"propValue",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"theClass",
"=",
"conf",
".",
"getClassByName",
"(",
"propValue",
")",
";",
"return",
"... | Get the socket factory corresponding to the given proxy URI. If the
given proxy URI corresponds to an absence of configuration parameter,
returns null. If the URI is malformed raises an exception.
@param propValue the property which is the class name of the
SocketFactory to instantiate; assumed non null and non empty.... | [
"Get",
"the",
"socket",
"factory",
"corresponding",
"to",
"the",
"given",
"proxy",
"URI",
".",
"If",
"the",
"given",
"proxy",
"URI",
"corresponds",
"to",
"an",
"absence",
"of",
"configuration",
"parameter",
"returns",
"null",
".",
"If",
"the",
"URI",
"is",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetUtils.java#L129-L139 |
118,986 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetUtils.java | NetUtils.getServerAddress | @Deprecated
public static String getServerAddress(Configuration conf,
String oldBindAddressName,
String oldPortName,
String newBindAddressName) {
String oldAddr = conf.get(oldBindAddressName);
int oldPort = conf.getInt(oldPortName, 0);
String newAddrPort = conf.get(newBindAddressName);
... | java | @Deprecated
public static String getServerAddress(Configuration conf,
String oldBindAddressName,
String oldPortName,
String newBindAddressName) {
String oldAddr = conf.get(oldBindAddressName);
int oldPort = conf.getInt(oldPortName, 0);
String newAddrPort = conf.get(newBindAddressName);
... | [
"@",
"Deprecated",
"public",
"static",
"String",
"getServerAddress",
"(",
"Configuration",
"conf",
",",
"String",
"oldBindAddressName",
",",
"String",
"oldPortName",
",",
"String",
"newBindAddressName",
")",
"{",
"String",
"oldAddr",
"=",
"conf",
".",
"get",
"(",
... | Handle the transition from pairs of attributes specifying a host and port
to a single colon separated one.
@param conf the configuration to check
@param oldBindAddressName the old address attribute name
@param oldPortName the old port attribute name
@param newBindAddressName the new combined name
@return the complete a... | [
"Handle",
"the",
"transition",
"from",
"pairs",
"of",
"attributes",
"specifying",
"a",
"host",
"and",
"port",
"to",
"a",
"single",
"colon",
"separated",
"one",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetUtils.java#L194-L225 |
118,987 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetUtils.java | NetUtils.normalizeHostNames | public static List<String> normalizeHostNames(Collection<String> names) {
List<String> resolvedIpAddresses = new ArrayList<String>(names.size());
for (String name : names) {
resolvedIpAddresses.add(normalizeHostName(name));
}
return resolvedIpAddresses;
} | java | public static List<String> normalizeHostNames(Collection<String> names) {
List<String> resolvedIpAddresses = new ArrayList<String>(names.size());
for (String name : names) {
resolvedIpAddresses.add(normalizeHostName(name));
}
return resolvedIpAddresses;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"normalizeHostNames",
"(",
"Collection",
"<",
"String",
">",
"names",
")",
"{",
"List",
"<",
"String",
">",
"resolvedIpAddresses",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"names",
".",
"size",
"(",
... | Given a collection of string representation of hosts, return a list of
corresponding IP addresses in the textual representation.
@param names a collection of string representations of hosts
@return a list of corresponding IP addresses in the string format
@see #normalizeHostName(String) | [
"Given",
"a",
"collection",
"of",
"string",
"representation",
"of",
"hosts",
"return",
"a",
"list",
"of",
"corresponding",
"IP",
"addresses",
"in",
"the",
"textual",
"representation",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetUtils.java#L482-L488 |
118,988 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetUtils.java | NetUtils.isSocketBindable | public static void isSocketBindable(InetSocketAddress addr)
throws IOException {
if (addr == null) {
return;
}
ServerSocket socket = new ServerSocket();
try {
socket.bind(addr);
} finally {
socket.close();
}
} | java | public static void isSocketBindable(InetSocketAddress addr)
throws IOException {
if (addr == null) {
return;
}
ServerSocket socket = new ServerSocket();
try {
socket.bind(addr);
} finally {
socket.close();
}
} | [
"public",
"static",
"void",
"isSocketBindable",
"(",
"InetSocketAddress",
"addr",
")",
"throws",
"IOException",
"{",
"if",
"(",
"addr",
"==",
"null",
")",
"{",
"return",
";",
"}",
"ServerSocket",
"socket",
"=",
"new",
"ServerSocket",
"(",
")",
";",
"try",
... | Tries to bind to the given address. Throws an exception on failure.
Used to fail earlier and verify configuration values. | [
"Tries",
"to",
"bind",
"to",
"the",
"given",
"address",
".",
"Throws",
"an",
"exception",
"on",
"failure",
".",
"Used",
"to",
"fail",
"earlier",
"and",
"verify",
"configuration",
"values",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetUtils.java#L598-L609 |
118,989 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/raid/DirectoryStatistics.java | DirectoryStatistics.addSourceFile | public boolean addSourceFile(FileSystem fs, PolicyInfo info, FileStatus src,
RaidState.Checker checker, long now, int targetReplication)
throws IOException {
List<FileStatus> lfs = RaidNode.listDirectoryRaidFileStatus(
fs.getConf(), fs, src.getPath());
if (lfs == null)... | java | public boolean addSourceFile(FileSystem fs, PolicyInfo info, FileStatus src,
RaidState.Checker checker, long now, int targetReplication)
throws IOException {
List<FileStatus> lfs = RaidNode.listDirectoryRaidFileStatus(
fs.getConf(), fs, src.getPath());
if (lfs == null)... | [
"public",
"boolean",
"addSourceFile",
"(",
"FileSystem",
"fs",
",",
"PolicyInfo",
"info",
",",
"FileStatus",
"src",
",",
"RaidState",
".",
"Checker",
"checker",
",",
"long",
"now",
",",
"int",
"targetReplication",
")",
"throws",
"IOException",
"{",
"List",
"<"... | Collect the statistics of a source directory. Return true if the file
should be raided but not.
@throws IOException | [
"Collect",
"the",
"statistics",
"of",
"a",
"source",
"directory",
".",
"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/DirectoryStatistics.java#L42-L67 |
118,990 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java | RemoteJTProxy.incrementAttemptUnprotected | private void incrementAttemptUnprotected() {
attempt++;
currentAttemptId = new TaskAttemptID(new TaskID(attemptJobId,
currentAttemptId.isMap(), currentAttemptId.getTaskID().getId()),
attempt);
} | java | private void incrementAttemptUnprotected() {
attempt++;
currentAttemptId = new TaskAttemptID(new TaskID(attemptJobId,
currentAttemptId.isMap(), currentAttemptId.getTaskID().getId()),
attempt);
} | [
"private",
"void",
"incrementAttemptUnprotected",
"(",
")",
"{",
"attempt",
"++",
";",
"currentAttemptId",
"=",
"new",
"TaskAttemptID",
"(",
"new",
"TaskID",
"(",
"attemptJobId",
",",
"currentAttemptId",
".",
"isMap",
"(",
")",
",",
"currentAttemptId",
".",
"get... | Increment the attempt number for launching a remote corona job tracker.
Must be called only when holding the object lock. | [
"Increment",
"the",
"attempt",
"number",
"for",
"launching",
"a",
"remote",
"corona",
"job",
"tracker",
".",
"Must",
"be",
"called",
"only",
"when",
"holding",
"the",
"object",
"lock",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java#L270-L275 |
118,991 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java | RemoteJTProxy.checkAttempt | private void checkAttempt(TaskAttemptID attemptId) throws IOException {
if (!attemptId.equals(currentAttemptId)) {
throw new IOException("Attempt " + attemptId
+ " does not match current attempt " + currentAttemptId);
}
} | java | private void checkAttempt(TaskAttemptID attemptId) throws IOException {
if (!attemptId.equals(currentAttemptId)) {
throw new IOException("Attempt " + attemptId
+ " does not match current attempt " + currentAttemptId);
}
} | [
"private",
"void",
"checkAttempt",
"(",
"TaskAttemptID",
"attemptId",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"attemptId",
".",
"equals",
"(",
"currentAttemptId",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Attempt \"",
"+",
"attemptId",
"... | Checks whether provided attempt id of remote JT matches currently set,
throws if not
@param attempt attempt id to check
@throws IOException | [
"Checks",
"whether",
"provided",
"attempt",
"id",
"of",
"remote",
"JT",
"matches",
"currently",
"set",
"throws",
"if",
"not"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java#L283-L288 |
118,992 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java | RemoteJTProxy.initializeClientUnprotected | void initializeClientUnprotected(String host, int port, String sessionId)
throws IOException {
if (client != null) {
return;
}
LOG.info("Creating JT client to " + host + ":" + port);
long connectTimeout = RemoteJTProxy.getRemotJTTimeout(conf);
int rpcTimeout = RemoteJTProxy.getRemoteJTRPCT... | java | void initializeClientUnprotected(String host, int port, String sessionId)
throws IOException {
if (client != null) {
return;
}
LOG.info("Creating JT client to " + host + ":" + port);
long connectTimeout = RemoteJTProxy.getRemotJTTimeout(conf);
int rpcTimeout = RemoteJTProxy.getRemoteJTRPCT... | [
"void",
"initializeClientUnprotected",
"(",
"String",
"host",
",",
"int",
"port",
",",
"String",
"sessionId",
")",
"throws",
"IOException",
"{",
"if",
"(",
"client",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"LOG",
".",
"info",
"(",
"\"Creating JT client t... | Create the RPC client to the remote corona job tracker.
@param host The host running the remote corona job tracker.
@param port The port of the remote corona job tracker.
@param sessionId The session for the remote corona job tracker.
@throws IOException | [
"Create",
"the",
"RPC",
"client",
"to",
"the",
"remote",
"corona",
"job",
"tracker",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java#L297-L322 |
118,993 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java | RemoteJTProxy.waitForJTStart | public void waitForJTStart(JobConf jobConf) throws IOException {
int maxJTAttempts = jobConf.getInt(
"mapred.coronajobtracker.remotejobtracker.attempts", 4);
ResourceTracker resourceTracker = jt.getResourceTracker();
SessionDriver sessionDriver = jt.getSessionDriver();
List<ResourceGrant> exclud... | java | public void waitForJTStart(JobConf jobConf) throws IOException {
int maxJTAttempts = jobConf.getInt(
"mapred.coronajobtracker.remotejobtracker.attempts", 4);
ResourceTracker resourceTracker = jt.getResourceTracker();
SessionDriver sessionDriver = jt.getSessionDriver();
List<ResourceGrant> exclud... | [
"public",
"void",
"waitForJTStart",
"(",
"JobConf",
"jobConf",
")",
"throws",
"IOException",
"{",
"int",
"maxJTAttempts",
"=",
"jobConf",
".",
"getInt",
"(",
"\"mapred.coronajobtracker.remotejobtracker.attempts\"",
",",
"4",
")",
";",
"ResourceTracker",
"resourceTracker... | Waits for the remote Corona JT to be ready.
This involves
- getting a JOBTRACKER resource from the cluster manager.
- starting the remote job tracker by connecting to the corona task
tracker on the machine.
- waiting for the remote job tracker to report its port back to this
process.
@param jobConf The job configuratio... | [
"Waits",
"for",
"the",
"remote",
"Corona",
"JT",
"to",
"be",
"ready",
".",
"This",
"involves",
"-",
"getting",
"a",
"JOBTRACKER",
"resource",
"from",
"the",
"cluster",
"manager",
".",
"-",
"starting",
"the",
"remote",
"job",
"tracker",
"by",
"connecting",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java#L351-L386 |
118,994 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java | RemoteJTProxy.waitForJTGrant | private ResourceGrant waitForJTGrant(
ResourceTracker resourceTracker,
SessionDriver sessionDriver,
List<ResourceGrant> previousGrants)
throws IOException, InterruptedException {
LOG.info("Waiting for JT grant for " + attemptJobId);
ResourceRequest req = resourceTracker.newJobTrackerReques... | java | private ResourceGrant waitForJTGrant(
ResourceTracker resourceTracker,
SessionDriver sessionDriver,
List<ResourceGrant> previousGrants)
throws IOException, InterruptedException {
LOG.info("Waiting for JT grant for " + attemptJobId);
ResourceRequest req = resourceTracker.newJobTrackerReques... | [
"private",
"ResourceGrant",
"waitForJTGrant",
"(",
"ResourceTracker",
"resourceTracker",
",",
"SessionDriver",
"sessionDriver",
",",
"List",
"<",
"ResourceGrant",
">",
"previousGrants",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"LOG",
".",
"info",
... | Wait for a JOBTRACKER grant.
@param resourceTracker The resource tracker object for getting the grant
@param sessionDriver The session driver for getting the grant
@param previousGrants Previous grants that could not be used successfully.
@return A new JOBTRACKER grant.
@throws IOException
@throws InterruptedException | [
"Wait",
"for",
"a",
"JOBTRACKER",
"grant",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java#L397-L434 |
118,995 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java | RemoteJTProxy.startRemoteJT | private boolean startRemoteJT(
JobConf jobConf,
ResourceGrant grant) throws InterruptedException {
org.apache.hadoop.corona.InetAddress ttAddr =
Utilities.appInfoToAddress(grant.appInfo);
CoronaTaskTrackerProtocol coronaTT = null;
try {
coronaTT = jt.getTaskTrackerClient(ttAddr.getHost()... | java | private boolean startRemoteJT(
JobConf jobConf,
ResourceGrant grant) throws InterruptedException {
org.apache.hadoop.corona.InetAddress ttAddr =
Utilities.appInfoToAddress(grant.appInfo);
CoronaTaskTrackerProtocol coronaTT = null;
try {
coronaTT = jt.getTaskTrackerClient(ttAddr.getHost()... | [
"private",
"boolean",
"startRemoteJT",
"(",
"JobConf",
"jobConf",
",",
"ResourceGrant",
"grant",
")",
"throws",
"InterruptedException",
"{",
"org",
".",
"apache",
".",
"hadoop",
".",
"corona",
".",
"InetAddress",
"ttAddr",
"=",
"Utilities",
".",
"appInfoToAddress"... | Start corona job tracker on the machine provided by using the corona
task tracker API.
@param jobConf The job configuration.
@param grant The grant that specifies the remote machine.
@return A boolean indicating success.
@throws InterruptedException | [
"Start",
"corona",
"job",
"tracker",
"on",
"the",
"machine",
"provided",
"by",
"using",
"the",
"corona",
"task",
"tracker",
"API",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java#L444-L504 |
118,996 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java | RemoteJTProxy.close | public void close() {
clientLock.writeLock().lock();
try {
if (client != null) {
RPC.stopProxy(client);
client = null;
}
} finally {
clientLock.writeLock().unlock();
}
} | java | public void close() {
clientLock.writeLock().lock();
try {
if (client != null) {
RPC.stopProxy(client);
client = null;
}
} finally {
clientLock.writeLock().unlock();
}
} | [
"public",
"void",
"close",
"(",
")",
"{",
"clientLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"client",
"!=",
"null",
")",
"{",
"RPC",
".",
"stopProxy",
"(",
"client",
")",
";",
"client",
"=",
"null",
";",... | Stop RPC client. | [
"Stop",
"RPC",
"client",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java#L741-L751 |
118,997 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java | RemoteJTProxy.checkClient | private JobSubmissionProtocol checkClient() throws IOException {
synchronized (this) {
while (client == null) {
try {
if (remoteJTStatus == RemoteJTStatus.FAILURE) {
throw new IOException("Remote Job Tracker is not available");
}
this.wait(1000);
} cat... | java | private JobSubmissionProtocol checkClient() throws IOException {
synchronized (this) {
while (client == null) {
try {
if (remoteJTStatus == RemoteJTStatus.FAILURE) {
throw new IOException("Remote Job Tracker is not available");
}
this.wait(1000);
} cat... | [
"private",
"JobSubmissionProtocol",
"checkClient",
"(",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"this",
")",
"{",
"while",
"(",
"client",
"==",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"remoteJTStatus",
"==",
"RemoteJTStatus",
".",
"FAILURE",
... | Check if the RPC client to the remote job tracker is ready, and wait if
not.
@throws IOException | [
"Check",
"if",
"the",
"RPC",
"client",
"to",
"the",
"remote",
"job",
"tracker",
"is",
"ready",
"and",
"wait",
"if",
"not",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java#L988-L1002 |
118,998 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskMemoryManagerThread.java | TaskMemoryManagerThread.isProcessTreeOverLimit | boolean isProcessTreeOverLimit(String tId,
long currentMemUsage,
long curMemUsageOfAgedProcesses,
long limit) {
boolean isOverLimit = false;
if (currentMemUsage > (2*limit)) {
LOG.warn("Process tr... | java | boolean isProcessTreeOverLimit(String tId,
long currentMemUsage,
long curMemUsageOfAgedProcesses,
long limit) {
boolean isOverLimit = false;
if (currentMemUsage > (2*limit)) {
LOG.warn("Process tr... | [
"boolean",
"isProcessTreeOverLimit",
"(",
"String",
"tId",
",",
"long",
"currentMemUsage",
",",
"long",
"curMemUsageOfAgedProcesses",
",",
"long",
"limit",
")",
"{",
"boolean",
"isOverLimit",
"=",
"false",
";",
"if",
"(",
"currentMemUsage",
">",
"(",
"2",
"*",
... | Check whether a task's process tree's current memory usage is over limit.
When a java process exec's a program, it could momentarily account for
double the size of it's memory, because the JVM does a fork()+exec()
which at fork time creates a copy of the parent's memory. If the
monitoring thread detects the memory use... | [
"Check",
"whether",
"a",
"task",
"s",
"process",
"tree",
"s",
"current",
"memory",
"usage",
"is",
"over",
"limit",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskMemoryManagerThread.java#L451-L470 |
118,999 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskMemoryManagerThread.java | TaskMemoryManagerThread.isProcessTreeOverLimit | boolean isProcessTreeOverLimit(ProcfsBasedProcessTree pTree,
String tId, long limit) {
long currentMemUsage = pTree.getCumulativeVmem();
// as processes begin with an age 1, we want to see if there are processes
// more than 1 iteration old.
long curMemUsageOfAgedPro... | java | boolean isProcessTreeOverLimit(ProcfsBasedProcessTree pTree,
String tId, long limit) {
long currentMemUsage = pTree.getCumulativeVmem();
// as processes begin with an age 1, we want to see if there are processes
// more than 1 iteration old.
long curMemUsageOfAgedPro... | [
"boolean",
"isProcessTreeOverLimit",
"(",
"ProcfsBasedProcessTree",
"pTree",
",",
"String",
"tId",
",",
"long",
"limit",
")",
"{",
"long",
"currentMemUsage",
"=",
"pTree",
".",
"getCumulativeVmem",
"(",
")",
";",
"// as processes begin with an age 1, we want to see if the... | method provided just for easy testing purposes | [
"method",
"provided",
"just",
"for",
"easy",
"testing",
"purposes"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskMemoryManagerThread.java#L473-L481 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.