id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
119,300 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/Journal.java | Journal.syncLog | File syncLog(long stamp, final long startTxId, final URL url, String name, File tmpFile)
throws IOException {
final File[] localPaths = new File[] { tmpFile };
// TODO add security if needed.
LOG.info("Synchronizing log " + name + " from " + url);
boolean success = false;
try {
Transfer... | java | File syncLog(long stamp, final long startTxId, final URL url, String name, File tmpFile)
throws IOException {
final File[] localPaths = new File[] { tmpFile };
// TODO add security if needed.
LOG.info("Synchronizing log " + name + " from " + url);
boolean success = false;
try {
Transfer... | [
"File",
"syncLog",
"(",
"long",
"stamp",
",",
"final",
"long",
"startTxId",
",",
"final",
"URL",
"url",
",",
"String",
"name",
",",
"File",
"tmpFile",
")",
"throws",
"IOException",
"{",
"final",
"File",
"[",
"]",
"localPaths",
"=",
"new",
"File",
"[",
... | Synchronize a log segment from another JournalNode. The log is
downloaded from the provided URL into a temporary location on disk | [
"Synchronize",
"a",
"log",
"segment",
"from",
"another",
"JournalNode",
".",
"The",
"log",
"is",
"downloaded",
"from",
"the",
"provided",
"URL",
"into",
"a",
"temporary",
"location",
"on",
"disk"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/Journal.java#L1178-L1200 |
119,301 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/Journal.java | Journal.completeHalfDoneAcceptRecovery | private void completeHalfDoneAcceptRecovery(
PersistedRecoveryPaxosData paxosData) throws IOException {
if (paxosData == null) {
return;
}
long segmentId = paxosData.getSegmentState().getStartTxId();
long epoch = paxosData.getAcceptedInEpoch();
File tmp = journalStorage.getSyncLogT... | java | private void completeHalfDoneAcceptRecovery(
PersistedRecoveryPaxosData paxosData) throws IOException {
if (paxosData == null) {
return;
}
long segmentId = paxosData.getSegmentState().getStartTxId();
long epoch = paxosData.getAcceptedInEpoch();
File tmp = journalStorage.getSyncLogT... | [
"private",
"void",
"completeHalfDoneAcceptRecovery",
"(",
"PersistedRecoveryPaxosData",
"paxosData",
")",
"throws",
"IOException",
"{",
"if",
"(",
"paxosData",
"==",
"null",
")",
"{",
"return",
";",
"}",
"long",
"segmentId",
"=",
"paxosData",
".",
"getSegmentState",... | In the case the node crashes in between downloading a log segment
and persisting the associated paxos recovery data, the log segment
will be left in its temporary location on disk. Given the paxos data,
we can check if this was indeed the case, and "roll forward"
the atomic operation.
See the inline comments... | [
"In",
"the",
"case",
"the",
"node",
"crashes",
"in",
"between",
"downloading",
"a",
"log",
"segment",
"and",
"persisting",
"the",
"associated",
"paxos",
"recovery",
"data",
"the",
"log",
"segment",
"will",
"be",
"left",
"in",
"its",
"temporary",
"location",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/Journal.java#L1217-L1234 |
119,302 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/Journal.java | Journal.getPersistedPaxosData | private PersistedRecoveryPaxosData getPersistedPaxosData(long segmentTxId)
throws IOException {
File f = journalStorage.getPaxosFile(segmentTxId);
if (!f.exists()) {
// Default instance has no fields filled in (they're optional)
return null;
}
InputStream in = new FileInputStream(... | java | private PersistedRecoveryPaxosData getPersistedPaxosData(long segmentTxId)
throws IOException {
File f = journalStorage.getPaxosFile(segmentTxId);
if (!f.exists()) {
// Default instance has no fields filled in (they're optional)
return null;
}
InputStream in = new FileInputStream(... | [
"private",
"PersistedRecoveryPaxosData",
"getPersistedPaxosData",
"(",
"long",
"segmentTxId",
")",
"throws",
"IOException",
"{",
"File",
"f",
"=",
"journalStorage",
".",
"getPaxosFile",
"(",
"segmentTxId",
")",
";",
"if",
"(",
"!",
"f",
".",
"exists",
"(",
")",
... | Retrieve the persisted data for recovering the given segment from disk. | [
"Retrieve",
"the",
"persisted",
"data",
"for",
"recovering",
"the",
"given",
"segment",
"from",
"disk",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/Journal.java#L1239-L1258 |
119,303 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/Journal.java | Journal.persistPaxosData | private void persistPaxosData(long segmentTxId,
PersistedRecoveryPaxosData newData) throws IOException {
File f = journalStorage.getPaxosFile(segmentTxId);
boolean success = false;
AtomicFileOutputStream fos = new AtomicFileOutputStream(f);
try {
newData.writeDelimitedTo(fos);
fos.writ... | java | private void persistPaxosData(long segmentTxId,
PersistedRecoveryPaxosData newData) throws IOException {
File f = journalStorage.getPaxosFile(segmentTxId);
boolean success = false;
AtomicFileOutputStream fos = new AtomicFileOutputStream(f);
try {
newData.writeDelimitedTo(fos);
fos.writ... | [
"private",
"void",
"persistPaxosData",
"(",
"long",
"segmentTxId",
",",
"PersistedRecoveryPaxosData",
"newData",
")",
"throws",
"IOException",
"{",
"File",
"f",
"=",
"journalStorage",
".",
"getPaxosFile",
"(",
"segmentTxId",
")",
";",
"boolean",
"success",
"=",
"f... | Persist data for recovering the given segment from disk. | [
"Persist",
"data",
"for",
"recovering",
"the",
"given",
"segment",
"from",
"disk",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/Journal.java#L1263-L1288 |
119,304 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/Journal.java | Journal.saveDigestAndRenameCheckpointImage | public void saveDigestAndRenameCheckpointImage(long txid, MD5Hash digest)
throws IOException {
MD5Hash storedDigest = checkpointImageDigests.get(txid);
if (storedDigest == null || !storedDigest.equals(digest)) {
throw new IOException("Digest of data written: " + storedDigest
+ " does not m... | java | public void saveDigestAndRenameCheckpointImage(long txid, MD5Hash digest)
throws IOException {
MD5Hash storedDigest = checkpointImageDigests.get(txid);
if (storedDigest == null || !storedDigest.equals(digest)) {
throw new IOException("Digest of data written: " + storedDigest
+ " does not m... | [
"public",
"void",
"saveDigestAndRenameCheckpointImage",
"(",
"long",
"txid",
",",
"MD5Hash",
"digest",
")",
"throws",
"IOException",
"{",
"MD5Hash",
"storedDigest",
"=",
"checkpointImageDigests",
".",
"get",
"(",
"txid",
")",
";",
"if",
"(",
"storedDigest",
"==",
... | Roll the image. | [
"Roll",
"the",
"image",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/Journal.java#L1293-L1303 |
119,305 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/GetImageServlet.java | GetImageServlet.getThrottler | public static final DataTransferThrottler getThrottler(Configuration conf,
boolean disableThrottler) {
if (disableThrottler) {
return null;
}
long transferBandwidth =
conf.getLong(HdfsConstants.DFS_IMAGE_TRANSFER_RATE_KEY,
HdfsConstants.DFS_IMAGE_TRANSFER_RATE_DEFAULT);
Dat... | java | public static final DataTransferThrottler getThrottler(Configuration conf,
boolean disableThrottler) {
if (disableThrottler) {
return null;
}
long transferBandwidth =
conf.getLong(HdfsConstants.DFS_IMAGE_TRANSFER_RATE_KEY,
HdfsConstants.DFS_IMAGE_TRANSFER_RATE_DEFAULT);
Dat... | [
"public",
"static",
"final",
"DataTransferThrottler",
"getThrottler",
"(",
"Configuration",
"conf",
",",
"boolean",
"disableThrottler",
")",
"{",
"if",
"(",
"disableThrottler",
")",
"{",
"return",
"null",
";",
"}",
"long",
"transferBandwidth",
"=",
"conf",
".",
... | Construct a throttler from conf
@param conf configuration
@return a data transfer throttler | [
"Construct",
"a",
"throttler",
"from",
"conf"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/GetImageServlet.java#L149-L162 |
119,306 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/GetImageServlet.java | GetImageServlet.setVerificationHeaders | public static void setVerificationHeaders(HttpServletResponse response, File file)
throws IOException {
response.setHeader(TransferFsImage.CONTENT_LENGTH,
String.valueOf(file.length()));
MD5Hash hash = MD5FileUtils.readStoredMd5ForFile(file);
if (hash != null) {
response.setHeader(TransferFs... | java | public static void setVerificationHeaders(HttpServletResponse response, File file)
throws IOException {
response.setHeader(TransferFsImage.CONTENT_LENGTH,
String.valueOf(file.length()));
MD5Hash hash = MD5FileUtils.readStoredMd5ForFile(file);
if (hash != null) {
response.setHeader(TransferFs... | [
"public",
"static",
"void",
"setVerificationHeaders",
"(",
"HttpServletResponse",
"response",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"response",
".",
"setHeader",
"(",
"TransferFsImage",
".",
"CONTENT_LENGTH",
",",
"String",
".",
"valueOf",
"(",
"... | Set headers for content length, and, if available, md5.
@throws IOException | [
"Set",
"headers",
"for",
"content",
"length",
"and",
"if",
"available",
"md5",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/GetImageServlet.java#L168-L176 |
119,307 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/InMemoryFileSystem.java | InMemoryFileSystem.reserveSpaceWithCheckSum | public boolean reserveSpaceWithCheckSum(Path f, long size) {
RawInMemoryFileSystem mfs = (RawInMemoryFileSystem)getRawFileSystem();
synchronized(mfs) {
boolean b = mfs.reserveSpace(f, size);
if (b) {
long checksumSize = getChecksumFileLength(f, size);
b = mfs.reserveSpace(getChecksum... | java | public boolean reserveSpaceWithCheckSum(Path f, long size) {
RawInMemoryFileSystem mfs = (RawInMemoryFileSystem)getRawFileSystem();
synchronized(mfs) {
boolean b = mfs.reserveSpace(f, size);
if (b) {
long checksumSize = getChecksumFileLength(f, size);
b = mfs.reserveSpace(getChecksum... | [
"public",
"boolean",
"reserveSpaceWithCheckSum",
"(",
"Path",
"f",
",",
"long",
"size",
")",
"{",
"RawInMemoryFileSystem",
"mfs",
"=",
"(",
"RawInMemoryFileSystem",
")",
"getRawFileSystem",
"(",
")",
";",
"synchronized",
"(",
"mfs",
")",
"{",
"boolean",
"b",
"... | Register a file with its size. This will also register a checksum for the
file that the user is trying to create. This is required since none of
the FileSystem APIs accept the size of the file as argument. But since it
is required for us to apriori know the size of the file we are going to
create, the user must call th... | [
"Register",
"a",
"file",
"with",
"its",
"size",
".",
"This",
"will",
"also",
"register",
"a",
"checksum",
"for",
"the",
"file",
"that",
"the",
"user",
"is",
"trying",
"to",
"create",
".",
"This",
"is",
"required",
"since",
"none",
"of",
"the",
"FileSyste... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/InMemoryFileSystem.java#L416-L429 |
119,308 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/DnsMonitorSecurityManager.java | DnsMonitorSecurityManager.setTheManager | public static void setTheManager() {
if ("true".equalsIgnoreCase(System.getProperty(ACTIVATE_FLAG))) {
if (!(System.getSecurityManager() instanceof DnsMonitorSecurityManager)) {
System.setSecurityManager(theManager);
}
}
} | java | public static void setTheManager() {
if ("true".equalsIgnoreCase(System.getProperty(ACTIVATE_FLAG))) {
if (!(System.getSecurityManager() instanceof DnsMonitorSecurityManager)) {
System.setSecurityManager(theManager);
}
}
} | [
"public",
"static",
"void",
"setTheManager",
"(",
")",
"{",
"if",
"(",
"\"true\"",
".",
"equalsIgnoreCase",
"(",
"System",
".",
"getProperty",
"(",
"ACTIVATE_FLAG",
")",
")",
")",
"{",
"if",
"(",
"!",
"(",
"System",
".",
"getSecurityManager",
"(",
")",
"... | Update's the system's security manager to an instance of this class if
system property dns_call_stack_logging is set to true. | [
"Update",
"s",
"the",
"system",
"s",
"security",
"manager",
"to",
"an",
"instance",
"of",
"this",
"class",
"if",
"system",
"property",
"dns_call_stack_logging",
"is",
"set",
"to",
"true",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DnsMonitorSecurityManager.java#L45-L51 |
119,309 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java | AvatarNodeZkUtil.checkZooKeeperBeforeFailover | static ZookeeperTxId checkZooKeeperBeforeFailover(Configuration startupConf,
Configuration confg, boolean noverification) throws IOException {
AvatarZooKeeperClient zk = null;
String fsname = startupConf.get(NameNode.DFS_NAMENODE_RPC_ADDRESS_KEY);
int maxTries = startupConf.getInt("dfs.avatarnode... | java | static ZookeeperTxId checkZooKeeperBeforeFailover(Configuration startupConf,
Configuration confg, boolean noverification) throws IOException {
AvatarZooKeeperClient zk = null;
String fsname = startupConf.get(NameNode.DFS_NAMENODE_RPC_ADDRESS_KEY);
int maxTries = startupConf.getInt("dfs.avatarnode... | [
"static",
"ZookeeperTxId",
"checkZooKeeperBeforeFailover",
"(",
"Configuration",
"startupConf",
",",
"Configuration",
"confg",
",",
"boolean",
"noverification",
")",
"throws",
"IOException",
"{",
"AvatarZooKeeperClient",
"zk",
"=",
"null",
";",
"String",
"fsname",
"=",
... | Verifies whether we are in a consistent state before we perform a failover
@param startupConf
the startup configuration
@param confg
the current configuration
@param noverification
whether or not to skip some zookeeper based verification
@return the session id and last transaction id information from zookeeper
@throws... | [
"Verifies",
"whether",
"we",
"are",
"in",
"a",
"consistent",
"state",
"before",
"we",
"perform",
"a",
"failover"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java#L54-L98 |
119,310 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java | AvatarNodeZkUtil.writeToZooKeeperAfterFailover | static long writeToZooKeeperAfterFailover(Configuration startupConf,
Configuration confg) throws IOException {
AvatarZooKeeperClient zk = null;
// Register client port address.
String address = startupConf.get(NameNode.DFS_NAMENODE_RPC_ADDRESS_KEY);
String realAddress = confg.get(NameNode.DFS_NAME... | java | static long writeToZooKeeperAfterFailover(Configuration startupConf,
Configuration confg) throws IOException {
AvatarZooKeeperClient zk = null;
// Register client port address.
String address = startupConf.get(NameNode.DFS_NAMENODE_RPC_ADDRESS_KEY);
String realAddress = confg.get(NameNode.DFS_NAME... | [
"static",
"long",
"writeToZooKeeperAfterFailover",
"(",
"Configuration",
"startupConf",
",",
"Configuration",
"confg",
")",
"throws",
"IOException",
"{",
"AvatarZooKeeperClient",
"zk",
"=",
"null",
";",
"// Register client port address.",
"String",
"address",
"=",
"startu... | Performs some operations after failover such as writing a new session id
and registering to zookeeper as the new primary.
@param startupConf
the startup configuration
@param confg
the current configuration
@return the session id for the new node after failover
@throws IOException | [
"Performs",
"some",
"operations",
"after",
"failover",
"such",
"as",
"writing",
"a",
"new",
"session",
"id",
"and",
"registering",
"to",
"zookeeper",
"as",
"the",
"new",
"primary",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java#L111-L138 |
119,311 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java | AvatarNodeZkUtil.writeLastTxidToZookeeper | static void writeLastTxidToZookeeper(long lastTxid, long totalBlocks,
long totalInodes, long ssid, Configuration startupConf,
Configuration confg) throws IOException {
AvatarZooKeeperClient zk = null;
LOG.info("Writing lastTxId: " + lastTxid + ", total blocks: " + totalBlocks
+ ", total inod... | java | static void writeLastTxidToZookeeper(long lastTxid, long totalBlocks,
long totalInodes, long ssid, Configuration startupConf,
Configuration confg) throws IOException {
AvatarZooKeeperClient zk = null;
LOG.info("Writing lastTxId: " + lastTxid + ", total blocks: " + totalBlocks
+ ", total inod... | [
"static",
"void",
"writeLastTxidToZookeeper",
"(",
"long",
"lastTxid",
",",
"long",
"totalBlocks",
",",
"long",
"totalInodes",
",",
"long",
"ssid",
",",
"Configuration",
"startupConf",
",",
"Configuration",
"confg",
")",
"throws",
"IOException",
"{",
"AvatarZooKeepe... | Writes the last transaction id of the primary avatarnode to zookeeper. | [
"Writes",
"the",
"last",
"transaction",
"id",
"of",
"the",
"primary",
"avatarnode",
"to",
"zookeeper",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java#L143-L170 |
119,312 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java | AvatarNodeZkUtil.getPrimaryRegistration | static String getPrimaryRegistration(Configuration startupConf,
Configuration conf, String fsname) throws IOException {
AvatarZooKeeperClient zk = null;
int maxTries = startupConf.getInt("dfs.avatarnode.zk.retries", 3);
for (int i = 0; i < maxTries; i++) {
try {
zk = new AvatarZooKeeperC... | java | static String getPrimaryRegistration(Configuration startupConf,
Configuration conf, String fsname) throws IOException {
AvatarZooKeeperClient zk = null;
int maxTries = startupConf.getInt("dfs.avatarnode.zk.retries", 3);
for (int i = 0; i < maxTries; i++) {
try {
zk = new AvatarZooKeeperC... | [
"static",
"String",
"getPrimaryRegistration",
"(",
"Configuration",
"startupConf",
",",
"Configuration",
"conf",
",",
"String",
"fsname",
")",
"throws",
"IOException",
"{",
"AvatarZooKeeperClient",
"zk",
"=",
"null",
";",
"int",
"maxTries",
"=",
"startupConf",
".",
... | Obtain the registration of the primary from zk. | [
"Obtain",
"the",
"registration",
"of",
"the",
"primary",
"from",
"zk",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java#L217-L235 |
119,313 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java | AvatarNodeZkUtil.registerClientProtocolAddress | private static boolean registerClientProtocolAddress(AvatarZooKeeperClient zk,
Configuration originalConf, Configuration conf, boolean toOverwrite)
throws UnsupportedEncodingException, IOException {
LOG.info("Updating Client Address information in ZooKeeper");
InetSocketAddress addr = NameNode.getCl... | java | private static boolean registerClientProtocolAddress(AvatarZooKeeperClient zk,
Configuration originalConf, Configuration conf, boolean toOverwrite)
throws UnsupportedEncodingException, IOException {
LOG.info("Updating Client Address information in ZooKeeper");
InetSocketAddress addr = NameNode.getCl... | [
"private",
"static",
"boolean",
"registerClientProtocolAddress",
"(",
"AvatarZooKeeperClient",
"zk",
",",
"Configuration",
"originalConf",
",",
"Configuration",
"conf",
",",
"boolean",
"toOverwrite",
")",
"throws",
"UnsupportedEncodingException",
",",
"IOException",
"{",
... | Registers namenode's address in zookeeper | [
"Registers",
"namenode",
"s",
"address",
"in",
"zookeeper"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java#L300-L323 |
119,314 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java | AvatarNodeZkUtil.registerDnProtocolAddress | private static void registerDnProtocolAddress(AvatarZooKeeperClient zk,
Configuration originalConf, Configuration conf, boolean toOverwrite)
throws UnsupportedEncodingException, IOException {
LOG.info("Updating Service Address information in ZooKeeper");
registerSocketAddress(zk,
originalCon... | java | private static void registerDnProtocolAddress(AvatarZooKeeperClient zk,
Configuration originalConf, Configuration conf, boolean toOverwrite)
throws UnsupportedEncodingException, IOException {
LOG.info("Updating Service Address information in ZooKeeper");
registerSocketAddress(zk,
originalCon... | [
"private",
"static",
"void",
"registerDnProtocolAddress",
"(",
"AvatarZooKeeperClient",
"zk",
",",
"Configuration",
"originalConf",
",",
"Configuration",
"conf",
",",
"boolean",
"toOverwrite",
")",
"throws",
"UnsupportedEncodingException",
",",
"IOException",
"{",
"LOG",
... | Registers the datanode protocol address in the zookeeper | [
"Registers",
"the",
"datanode",
"protocol",
"address",
"in",
"the",
"zookeeper"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java#L328-L337 |
119,315 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java | AvatarNodeZkUtil.registerHttpAddress | private static void registerHttpAddress(AvatarZooKeeperClient zk, Configuration originalConf,
Configuration conf, boolean toOverwrite) throws UnsupportedEncodingException, IOException {
LOG.info("Updating Http Address information in ZooKeeper");
String addr = conf.get(FSConstants.DFS_NAMENODE_HTTP_ADDRESS... | java | private static void registerHttpAddress(AvatarZooKeeperClient zk, Configuration originalConf,
Configuration conf, boolean toOverwrite) throws UnsupportedEncodingException, IOException {
LOG.info("Updating Http Address information in ZooKeeper");
String addr = conf.get(FSConstants.DFS_NAMENODE_HTTP_ADDRESS... | [
"private",
"static",
"void",
"registerHttpAddress",
"(",
"AvatarZooKeeperClient",
"zk",
",",
"Configuration",
"originalConf",
",",
"Configuration",
"conf",
",",
"boolean",
"toOverwrite",
")",
"throws",
"UnsupportedEncodingException",
",",
"IOException",
"{",
"LOG",
".",... | Registers the http address of the namenode in the zookeeper | [
"Registers",
"the",
"http",
"address",
"of",
"the",
"namenode",
"in",
"the",
"zookeeper"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java#L342-L350 |
119,316 | facebookarchive/hadoop-20 | src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/ServerRegistry.java | ServerRegistry.load | private synchronized void load() {
Map<String, HadoopServer> map = new TreeMap<String, HadoopServer>();
for (File file : saveDir.listFiles()) {
try {
HadoopServer server = new HadoopServer(file);
map.put(server.getLocationName(), server);
} catch (Exception exn) {
System.err... | java | private synchronized void load() {
Map<String, HadoopServer> map = new TreeMap<String, HadoopServer>();
for (File file : saveDir.listFiles()) {
try {
HadoopServer server = new HadoopServer(file);
map.put(server.getLocationName(), server);
} catch (Exception exn) {
System.err... | [
"private",
"synchronized",
"void",
"load",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"HadoopServer",
">",
"map",
"=",
"new",
"TreeMap",
"<",
"String",
",",
"HadoopServer",
">",
"(",
")",
";",
"for",
"(",
"File",
"file",
":",
"saveDir",
".",
"listFiles"... | Load all available locations from the workspace configuration directory. | [
"Load",
"all",
"available",
"locations",
"from",
"the",
"workspace",
"configuration",
"directory",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/ServerRegistry.java#L87-L99 |
119,317 | facebookarchive/hadoop-20 | src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/ServerRegistry.java | ServerRegistry.updateServer | public synchronized void updateServer(String originalName,
HadoopServer server) {
// Update the map if the location name has changed
if (!server.getLocationName().equals(originalName)) {
servers.remove(originalName);
servers.put(server.getLocationName(), server);
}
store();
fireLi... | java | public synchronized void updateServer(String originalName,
HadoopServer server) {
// Update the map if the location name has changed
if (!server.getLocationName().equals(originalName)) {
servers.remove(originalName);
servers.put(server.getLocationName(), server);
}
store();
fireLi... | [
"public",
"synchronized",
"void",
"updateServer",
"(",
"String",
"originalName",
",",
"HadoopServer",
"server",
")",
"{",
"// Update the map if the location name has changed",
"if",
"(",
"!",
"server",
".",
"getLocationName",
"(",
")",
".",
"equals",
"(",
"originalNam... | Update one Hadoop location
@param originalName the original location name (might have changed)
@param server the location | [
"Update",
"one",
"Hadoop",
"location"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/ServerRegistry.java#L192-L202 |
119,318 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java | JournalSet.selectInputStreams | synchronized public boolean selectInputStreams(
Collection<EditLogInputStream> streams, long fromTxId,
boolean inProgressOk, boolean validateInProgressSegments,
int minRedundancy) throws IOException {
final PriorityQueue<EditLogInputStream> allStreams =
new PriorityQueue<EditLogInputStrea... | java | synchronized public boolean selectInputStreams(
Collection<EditLogInputStream> streams, long fromTxId,
boolean inProgressOk, boolean validateInProgressSegments,
int minRedundancy) throws IOException {
final PriorityQueue<EditLogInputStream> allStreams =
new PriorityQueue<EditLogInputStrea... | [
"synchronized",
"public",
"boolean",
"selectInputStreams",
"(",
"Collection",
"<",
"EditLogInputStream",
">",
"streams",
",",
"long",
"fromTxId",
",",
"boolean",
"inProgressOk",
",",
"boolean",
"validateInProgressSegments",
",",
"int",
"minRedundancy",
")",
"throws",
... | Selects input streams. Returns true if each stream meets min redundancy,
false otherwise. | [
"Selects",
"input",
"streams",
".",
"Returns",
"true",
"if",
"each",
"stream",
"meets",
"min",
"redundancy",
"false",
"otherwise",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java#L305-L327 |
119,319 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java | JournalSet.hasUnfinalizedSegments | synchronized boolean hasUnfinalizedSegments(long fromTxId) {
List<EditLogInputStream> streams = new ArrayList<EditLogInputStream>();
for (JournalAndStream jas : journals) {
if (jas.isDisabled()) {
continue;
}
try {
// get all streams, including inProgress ones.
jas.getM... | java | synchronized boolean hasUnfinalizedSegments(long fromTxId) {
List<EditLogInputStream> streams = new ArrayList<EditLogInputStream>();
for (JournalAndStream jas : journals) {
if (jas.isDisabled()) {
continue;
}
try {
// get all streams, including inProgress ones.
jas.getM... | [
"synchronized",
"boolean",
"hasUnfinalizedSegments",
"(",
"long",
"fromTxId",
")",
"{",
"List",
"<",
"EditLogInputStream",
">",
"streams",
"=",
"new",
"ArrayList",
"<",
"EditLogInputStream",
">",
"(",
")",
";",
"for",
"(",
"JournalAndStream",
"jas",
":",
"journa... | Check if any journal manager has unfinalized segments.
@param fromTxId starting txid | [
"Check",
"if",
"any",
"journal",
"manager",
"has",
"unfinalized",
"segments",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java#L333-L355 |
119,320 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java | JournalSet.isLocalJournal | private static boolean isLocalJournal(JournalManager jm) {
if (jm == null || (!(jm instanceof FileJournalManager))) {
return false;
}
return NNStorage.isPreferred(StorageLocationType.LOCAL,
((FileJournalManager) jm).getStorageDirectory());
} | java | private static boolean isLocalJournal(JournalManager jm) {
if (jm == null || (!(jm instanceof FileJournalManager))) {
return false;
}
return NNStorage.isPreferred(StorageLocationType.LOCAL,
((FileJournalManager) jm).getStorageDirectory());
} | [
"private",
"static",
"boolean",
"isLocalJournal",
"(",
"JournalManager",
"jm",
")",
"{",
"if",
"(",
"jm",
"==",
"null",
"||",
"(",
"!",
"(",
"jm",
"instanceof",
"FileJournalManager",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"NNStorage",
... | Check if the given journal is local. | [
"Check",
"if",
"the",
"given",
"journal",
"is",
"local",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java#L446-L452 |
119,321 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java | JournalSet.disableAndReportErrorOnJournals | private void disableAndReportErrorOnJournals(
List<JournalAndStream> badJournals, String status) throws IOException {
if (badJournals == null || badJournals.isEmpty()) {
if (forceJournalCheck) {
// check status here, because maybe some other operation
// (e.g., rollEditLog failed and dis... | java | private void disableAndReportErrorOnJournals(
List<JournalAndStream> badJournals, String status) throws IOException {
if (badJournals == null || badJournals.isEmpty()) {
if (forceJournalCheck) {
// check status here, because maybe some other operation
// (e.g., rollEditLog failed and dis... | [
"private",
"void",
"disableAndReportErrorOnJournals",
"(",
"List",
"<",
"JournalAndStream",
">",
"badJournals",
",",
"String",
"status",
")",
"throws",
"IOException",
"{",
"if",
"(",
"badJournals",
"==",
"null",
"||",
"badJournals",
".",
"isEmpty",
"(",
")",
")"... | Called when some journals experience an error in some operation. | [
"Called",
"when",
"some",
"journals",
"experience",
"an",
"error",
"in",
"some",
"operation",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java#L468-L504 |
119,322 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java | JournalSet.mapJournalsAndReportErrors | private void mapJournalsAndReportErrors(
JournalClosure closure, String status) throws IOException{
List<JournalAndStream> badJAS = null;
for (JournalAndStream jas : journals) {
try {
closure.apply(jas);
} catch (Throwable t) {
if (badJAS == null)
badJAS = new LinkedL... | java | private void mapJournalsAndReportErrors(
JournalClosure closure, String status) throws IOException{
List<JournalAndStream> badJAS = null;
for (JournalAndStream jas : journals) {
try {
closure.apply(jas);
} catch (Throwable t) {
if (badJAS == null)
badJAS = new LinkedL... | [
"private",
"void",
"mapJournalsAndReportErrors",
"(",
"JournalClosure",
"closure",
",",
"String",
"status",
")",
"throws",
"IOException",
"{",
"List",
"<",
"JournalAndStream",
">",
"badJAS",
"=",
"null",
";",
"for",
"(",
"JournalAndStream",
"jas",
":",
"journals",... | Apply the given operation across all of the journal managers, disabling
any for which the closure throws an IOException.
@param closure {@link JournalClosure} object encapsulating the operation.
@param status message used for logging errors (e.g. "opening journal")
@throws IOException If the operation fails on all the ... | [
"Apply",
"the",
"given",
"operation",
"across",
"all",
"of",
"the",
"journal",
"managers",
"disabling",
"any",
"for",
"which",
"the",
"closure",
"throws",
"an",
"IOException",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java#L527-L541 |
119,323 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java | JournalSet.mapJournalsAndReportErrorsParallel | private void mapJournalsAndReportErrorsParallel(JournalClosure closure,
String status) throws IOException {
// set-up calls
List<Future<JournalAndStream>> jasResponeses = new ArrayList<Future<JournalAndStream>>(
journals.size());
for (JournalAndStream jas : journals) {
jasResponeses.ad... | java | private void mapJournalsAndReportErrorsParallel(JournalClosure closure,
String status) throws IOException {
// set-up calls
List<Future<JournalAndStream>> jasResponeses = new ArrayList<Future<JournalAndStream>>(
journals.size());
for (JournalAndStream jas : journals) {
jasResponeses.ad... | [
"private",
"void",
"mapJournalsAndReportErrorsParallel",
"(",
"JournalClosure",
"closure",
",",
"String",
"status",
")",
"throws",
"IOException",
"{",
"// set-up calls",
"List",
"<",
"Future",
"<",
"JournalAndStream",
">>",
"jasResponeses",
"=",
"new",
"ArrayList",
"<... | Apply the given operation across all of the journal managers, disabling
any for which the closure throws an IOException. Do it in parallel.
@param closure {@link JournalClosure} object encapsulating the operation.
@param status message used for logging errors (e.g. "opening journal")
@throws IOException If the operatio... | [
"Apply",
"the",
"given",
"operation",
"across",
"all",
"of",
"the",
"journal",
"managers",
"disabling",
"any",
"for",
"which",
"the",
"closure",
"throws",
"an",
"IOException",
".",
"Do",
"it",
"in",
"parallel",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java#L550-L585 |
119,324 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java | JournalSet.updateJournalMetrics | void updateJournalMetrics() {
if (metrics == null) {
return;
}
int failedJournals = 0;
for(JournalAndStream jas : journals) {
if(jas.isDisabled()) {
failedJournals++;
}
}
metrics.journalsFailed.set(failedJournals);
} | java | void updateJournalMetrics() {
if (metrics == null) {
return;
}
int failedJournals = 0;
for(JournalAndStream jas : journals) {
if(jas.isDisabled()) {
failedJournals++;
}
}
metrics.journalsFailed.set(failedJournals);
} | [
"void",
"updateJournalMetrics",
"(",
")",
"{",
"if",
"(",
"metrics",
"==",
"null",
")",
"{",
"return",
";",
"}",
"int",
"failedJournals",
"=",
"0",
";",
"for",
"(",
"JournalAndStream",
"jas",
":",
"journals",
")",
"{",
"if",
"(",
"jas",
".",
"isDisable... | Get the number of available journals. | [
"Get",
"the",
"number",
"of",
"available",
"journals",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java#L590-L601 |
119,325 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java | JournalSet.checkJournals | protected int checkJournals(String status) throws IOException {
boolean abort = false;
int journalsAvailable = 0;
int nonLocalJournalsAvailable = 0;
for(JournalAndStream jas : journals) {
if(jas.isDisabled() && jas.isRequired()) {
abort = true;
} else if (jas.isResourceAvailable()) {... | java | protected int checkJournals(String status) throws IOException {
boolean abort = false;
int journalsAvailable = 0;
int nonLocalJournalsAvailable = 0;
for(JournalAndStream jas : journals) {
if(jas.isDisabled() && jas.isRequired()) {
abort = true;
} else if (jas.isResourceAvailable()) {... | [
"protected",
"int",
"checkJournals",
"(",
"String",
"status",
")",
"throws",
"IOException",
"{",
"boolean",
"abort",
"=",
"false",
";",
"int",
"journalsAvailable",
"=",
"0",
";",
"int",
"nonLocalJournalsAvailable",
"=",
"0",
";",
"for",
"(",
"JournalAndStream",
... | Checks if the number of journals available is not below
minimum. Only invoked at errors. | [
"Checks",
"if",
"the",
"number",
"of",
"journals",
"available",
"is",
"not",
"below",
"minimum",
".",
"Only",
"invoked",
"at",
"errors",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java#L614-L641 |
119,326 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java | JournalSet.getEditLogManifest | public synchronized RemoteEditLogManifest getEditLogManifest(long fromTxId) {
// Collect RemoteEditLogs available from each FileJournalManager
List<RemoteEditLog> allLogs = new ArrayList<RemoteEditLog>();
for (JournalAndStream j : journals) {
JournalManager jm = j.getManager();
try {
all... | java | public synchronized RemoteEditLogManifest getEditLogManifest(long fromTxId) {
// Collect RemoteEditLogs available from each FileJournalManager
List<RemoteEditLog> allLogs = new ArrayList<RemoteEditLog>();
for (JournalAndStream j : journals) {
JournalManager jm = j.getManager();
try {
all... | [
"public",
"synchronized",
"RemoteEditLogManifest",
"getEditLogManifest",
"(",
"long",
"fromTxId",
")",
"{",
"// Collect RemoteEditLogs available from each FileJournalManager",
"List",
"<",
"RemoteEditLog",
">",
"allLogs",
"=",
"new",
"ArrayList",
"<",
"RemoteEditLog",
">",
... | Return a manifest of what edit logs are available. All available
edit logs are returned starting from the transaction id passed,
including inprogress segments.
@param fromTxId Starting transaction id to read the logs.
@return RemoteEditLogManifest object. | [
"Return",
"a",
"manifest",
"of",
"what",
"edit",
"logs",
"are",
"available",
".",
"All",
"available",
"edit",
"logs",
"are",
"returned",
"starting",
"from",
"the",
"transaction",
"id",
"passed",
"including",
"inprogress",
"segments",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java#L888-L943 |
119,327 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java | JournalSet.getSyncTimes | String getSyncTimes() {
StringBuilder buf = new StringBuilder();
for (JournalAndStream jas : journals) {
if (jas.isActive()) {
buf.append(jas.getCurrentStream().getTotalSyncTime());
buf.append(" ");
}
}
return buf.toString();
} | java | String getSyncTimes() {
StringBuilder buf = new StringBuilder();
for (JournalAndStream jas : journals) {
if (jas.isActive()) {
buf.append(jas.getCurrentStream().getTotalSyncTime());
buf.append(" ");
}
}
return buf.toString();
} | [
"String",
"getSyncTimes",
"(",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"JournalAndStream",
"jas",
":",
"journals",
")",
"{",
"if",
"(",
"jas",
".",
"isActive",
"(",
")",
")",
"{",
"buf",
".",
"append",
... | Add sync times to the buffer. | [
"Add",
"sync",
"times",
"to",
"the",
"buffer",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java#L948-L957 |
119,328 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java | JournalSet.transitionNonFileJournals | public void transitionNonFileJournals(StorageInfo nsInfo, boolean checkEmpty,
Transition transition, StartupOption startOpt)
throws IOException {
for (JournalManager jm : getJournalManagers()) {
if (!(jm instanceof FileJournalManager)) {
if (checkEmpty && jm.hasSomeJournalData()) {
... | java | public void transitionNonFileJournals(StorageInfo nsInfo, boolean checkEmpty,
Transition transition, StartupOption startOpt)
throws IOException {
for (JournalManager jm : getJournalManagers()) {
if (!(jm instanceof FileJournalManager)) {
if (checkEmpty && jm.hasSomeJournalData()) {
... | [
"public",
"void",
"transitionNonFileJournals",
"(",
"StorageInfo",
"nsInfo",
",",
"boolean",
"checkEmpty",
",",
"Transition",
"transition",
",",
"StartupOption",
"startOpt",
")",
"throws",
"IOException",
"{",
"for",
"(",
"JournalManager",
"jm",
":",
"getJournalManager... | Transition the non-file journals. | [
"Transition",
"the",
"non",
"-",
"file",
"journals",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java#L969-L982 |
119,329 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java | JournalSet.getInputStream | public static EditLogInputStream getInputStream(JournalManager jm, long txid)
throws IOException {
List<EditLogInputStream> streams = new ArrayList<EditLogInputStream>();
jm.selectInputStreams(streams, txid, true, false);
if (streams.size() < 1) {
throw new IOException("Cannot obtain stream for ... | java | public static EditLogInputStream getInputStream(JournalManager jm, long txid)
throws IOException {
List<EditLogInputStream> streams = new ArrayList<EditLogInputStream>();
jm.selectInputStreams(streams, txid, true, false);
if (streams.size() < 1) {
throw new IOException("Cannot obtain stream for ... | [
"public",
"static",
"EditLogInputStream",
"getInputStream",
"(",
"JournalManager",
"jm",
",",
"long",
"txid",
")",
"throws",
"IOException",
"{",
"List",
"<",
"EditLogInputStream",
">",
"streams",
"=",
"new",
"ArrayList",
"<",
"EditLogInputStream",
">",
"(",
")",
... | Get input stream from the given journal starting at txid.
Does not perform validation of the streams.
This should only be used for tailing inprogress streams!!! | [
"Get",
"input",
"stream",
"from",
"the",
"given",
"journal",
"starting",
"at",
"txid",
".",
"Does",
"not",
"perform",
"validation",
"of",
"the",
"streams",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java#L1004-L1026 |
119,330 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java | JournalSet.getNonFileJournalManagers | public List<JournalManager> getNonFileJournalManagers() {
List<JournalManager> list = new ArrayList<JournalManager>();
for (JournalManager jm : getJournalManagers()) {
if (!(jm instanceof FileJournalManager)) {
list.add(jm);
}
}
return list;
} | java | public List<JournalManager> getNonFileJournalManagers() {
List<JournalManager> list = new ArrayList<JournalManager>();
for (JournalManager jm : getJournalManagers()) {
if (!(jm instanceof FileJournalManager)) {
list.add(jm);
}
}
return list;
} | [
"public",
"List",
"<",
"JournalManager",
">",
"getNonFileJournalManagers",
"(",
")",
"{",
"List",
"<",
"JournalManager",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"JournalManager",
">",
"(",
")",
";",
"for",
"(",
"JournalManager",
"jm",
":",
"getJournalManage... | Return all non-file journal managers. | [
"Return",
"all",
"non",
"-",
"file",
"journal",
"managers",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java#L1042-L1050 |
119,331 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.attemptRestoreRemovedStorage | void attemptRestoreRemovedStorage() {
// if directory is "alive" - copy the images there...
if(removedStorageDirs.size() == 0)
return; //nothing to restore
/* We don't want more than one thread trying to restore at a time */
synchronized (this.restorationLock) {
LOG.info("attemptRestoreRemo... | java | void attemptRestoreRemovedStorage() {
// if directory is "alive" - copy the images there...
if(removedStorageDirs.size() == 0)
return; //nothing to restore
/* We don't want more than one thread trying to restore at a time */
synchronized (this.restorationLock) {
LOG.info("attemptRestoreRemo... | [
"void",
"attemptRestoreRemovedStorage",
"(",
")",
"{",
"// if directory is \"alive\" - copy the images there...",
"if",
"(",
"removedStorageDirs",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
";",
"//nothing to restore",
"/* We don't want more than one thread trying to rest... | See if any of removed storages is "writable" again, and can be returned
into service. | [
"See",
"if",
"any",
"of",
"removed",
"storages",
"is",
"writable",
"again",
"and",
"can",
"be",
"returned",
"into",
"service",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L246-L279 |
119,332 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.getStorageDirectory | StorageDirectory getStorageDirectory(URI uri) {
try {
uri = Util.fileAsURI(new File(uri));
Iterator<StorageDirectory> it = dirIterator();
for (; it.hasNext(); ) {
StorageDirectory sd = it.next();
if (Util.fileAsURI(sd.getRoot()).equals(uri)) {
return sd;
}
}... | java | StorageDirectory getStorageDirectory(URI uri) {
try {
uri = Util.fileAsURI(new File(uri));
Iterator<StorageDirectory> it = dirIterator();
for (; it.hasNext(); ) {
StorageDirectory sd = it.next();
if (Util.fileAsURI(sd.getRoot()).equals(uri)) {
return sd;
}
}... | [
"StorageDirectory",
"getStorageDirectory",
"(",
"URI",
"uri",
")",
"{",
"try",
"{",
"uri",
"=",
"Util",
".",
"fileAsURI",
"(",
"new",
"File",
"(",
"uri",
")",
")",
";",
"Iterator",
"<",
"StorageDirectory",
">",
"it",
"=",
"dirIterator",
"(",
")",
";",
... | Return the storage directory corresponding to the passed URI
@param uri URI of a storage directory
@return The matching storage directory or null if none found | [
"Return",
"the",
"storage",
"directory",
"corresponding",
"to",
"the",
"passed",
"URI"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L352-L366 |
119,333 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.checkSchemeConsistency | private static void checkSchemeConsistency(URI u) throws IOException {
String scheme = u.getScheme();
// the URI should have a proper scheme
if(scheme == null) {
throw new IOException("Undefined scheme for " + u);
}
} | java | private static void checkSchemeConsistency(URI u) throws IOException {
String scheme = u.getScheme();
// the URI should have a proper scheme
if(scheme == null) {
throw new IOException("Undefined scheme for " + u);
}
} | [
"private",
"static",
"void",
"checkSchemeConsistency",
"(",
"URI",
"u",
")",
"throws",
"IOException",
"{",
"String",
"scheme",
"=",
"u",
".",
"getScheme",
"(",
")",
";",
"// the URI should have a proper scheme",
"if",
"(",
"scheme",
"==",
"null",
")",
"{",
"th... | Checks the consistency of a URI, in particular if the scheme
is specified
@param u URI whose consistency is being checked. | [
"Checks",
"the",
"consistency",
"of",
"a",
"URI",
"in",
"particular",
"if",
"the",
"scheme",
"is",
"specified"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L373-L379 |
119,334 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.getNumStorageDirs | int getNumStorageDirs(NameNodeDirType dirType) {
if(dirType == null)
return getNumStorageDirs();
Iterator<StorageDirectory> it = dirIterator(dirType);
int numDirs = 0;
for(; it.hasNext(); it.next())
numDirs++;
return numDirs;
} | java | int getNumStorageDirs(NameNodeDirType dirType) {
if(dirType == null)
return getNumStorageDirs();
Iterator<StorageDirectory> it = dirIterator(dirType);
int numDirs = 0;
for(; it.hasNext(); it.next())
numDirs++;
return numDirs;
} | [
"int",
"getNumStorageDirs",
"(",
"NameNodeDirType",
"dirType",
")",
"{",
"if",
"(",
"dirType",
"==",
"null",
")",
"return",
"getNumStorageDirs",
"(",
")",
";",
"Iterator",
"<",
"StorageDirectory",
">",
"it",
"=",
"dirIterator",
"(",
"dirType",
")",
";",
"int... | Return number of storage directories of the given type.
@param dirType directory type
@return number of storage directories of type dirType | [
"Return",
"number",
"of",
"storage",
"directories",
"of",
"the",
"given",
"type",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L404-L412 |
119,335 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.getDirectories | Collection<File> getDirectories(NameNodeDirType dirType)
throws IOException {
ArrayList<File> list = new ArrayList<File>();
Iterator<StorageDirectory> it = (dirType == null) ? dirIterator() :
dirIterator(dirType);
for ( ;it.hasNext(); ) {
StorageDirectory sd =... | java | Collection<File> getDirectories(NameNodeDirType dirType)
throws IOException {
ArrayList<File> list = new ArrayList<File>();
Iterator<StorageDirectory> it = (dirType == null) ? dirIterator() :
dirIterator(dirType);
for ( ;it.hasNext(); ) {
StorageDirectory sd =... | [
"Collection",
"<",
"File",
">",
"getDirectories",
"(",
"NameNodeDirType",
"dirType",
")",
"throws",
"IOException",
"{",
"ArrayList",
"<",
"File",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"Iterator",
"<",
"StorageDirectory",
">",... | Return the list of locations being used for a specific purpose.
i.e. Image or edit log storage.
@param dirType Purpose of locations requested.
@throws IOException | [
"Return",
"the",
"list",
"of",
"locations",
"being",
"used",
"for",
"a",
"specific",
"purpose",
".",
"i",
".",
"e",
".",
"Image",
"or",
"edit",
"log",
"storage",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L421-L431 |
119,336 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.readTransactionIdFile | static long readTransactionIdFile(StorageDirectory sd) throws IOException {
File txidFile = getStorageFile(sd, NameNodeFile.SEEN_TXID);
long txid = 0L;
if (txidFile.exists() && txidFile.canRead()) {
BufferedReader br = new BufferedReader(new FileReader(txidFile));
try {
txid = Long.value... | java | static long readTransactionIdFile(StorageDirectory sd) throws IOException {
File txidFile = getStorageFile(sd, NameNodeFile.SEEN_TXID);
long txid = 0L;
if (txidFile.exists() && txidFile.canRead()) {
BufferedReader br = new BufferedReader(new FileReader(txidFile));
try {
txid = Long.value... | [
"static",
"long",
"readTransactionIdFile",
"(",
"StorageDirectory",
"sd",
")",
"throws",
"IOException",
"{",
"File",
"txidFile",
"=",
"getStorageFile",
"(",
"sd",
",",
"NameNodeFile",
".",
"SEEN_TXID",
")",
";",
"long",
"txid",
"=",
"0L",
";",
"if",
"(",
"tx... | Determine the last transaction ID noted in this storage directory.
This txid is stored in a special seen_txid file since it might not
correspond to the latest image or edit log. For example, an image-only
directory will have this txid incremented when edits logs roll, even
though the edits logs are in a different direc... | [
"Determine",
"the",
"last",
"transaction",
"ID",
"noted",
"in",
"this",
"storage",
"directory",
".",
"This",
"txid",
"is",
"stored",
"in",
"a",
"special",
"seen_txid",
"file",
"since",
"it",
"might",
"not",
"correspond",
"to",
"the",
"latest",
"image",
"or",... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L444-L458 |
119,337 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.writeTransactionIdFile | void writeTransactionIdFile(StorageDirectory sd, long txid) throws IOException {
if (txid < -1) {
// -1 is valid when formatting
throw new IOException("Bad txid: " + txid);
}
File txIdFile = getStorageFile(sd, NameNodeFile.SEEN_TXID);
OutputStream fos = new AtomicFileOutputStream(txIdFile);
... | java | void writeTransactionIdFile(StorageDirectory sd, long txid) throws IOException {
if (txid < -1) {
// -1 is valid when formatting
throw new IOException("Bad txid: " + txid);
}
File txIdFile = getStorageFile(sd, NameNodeFile.SEEN_TXID);
OutputStream fos = new AtomicFileOutputStream(txIdFile);
... | [
"void",
"writeTransactionIdFile",
"(",
"StorageDirectory",
"sd",
",",
"long",
"txid",
")",
"throws",
"IOException",
"{",
"if",
"(",
"txid",
"<",
"-",
"1",
")",
"{",
"// -1 is valid when formatting",
"throw",
"new",
"IOException",
"(",
"\"Bad txid: \"",
"+",
"txi... | Write last checkpoint time into a separate file.
@param sd
@throws IOException | [
"Write",
"last",
"checkpoint",
"time",
"into",
"a",
"separate",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L466-L481 |
119,338 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.writeTransactionIdFileToStorage | public void writeTransactionIdFileToStorage(long txid, FSImage image)
throws IOException {
// Write txid marker in all storage directories
List<StorageDirectory> badSDs = new ArrayList<StorageDirectory>();
for (StorageDirectory sd : storageDirs) {
try {
writeTransactionIdFile(sd, txid);
... | java | public void writeTransactionIdFileToStorage(long txid, FSImage image)
throws IOException {
// Write txid marker in all storage directories
List<StorageDirectory> badSDs = new ArrayList<StorageDirectory>();
for (StorageDirectory sd : storageDirs) {
try {
writeTransactionIdFile(sd, txid);
... | [
"public",
"void",
"writeTransactionIdFileToStorage",
"(",
"long",
"txid",
",",
"FSImage",
"image",
")",
"throws",
"IOException",
"{",
"// Write txid marker in all storage directories",
"List",
"<",
"StorageDirectory",
">",
"badSDs",
"=",
"new",
"ArrayList",
"<",
"Storag... | Write a small file in all available storage directories that
indicates that the namespace has reached some given transaction ID.
This is used when the image is loaded to avoid accidental rollbacks
in the case where an edit log is fully deleted but there is no
checkpoint. See TestNameEditsConfigs.testNameEditsConfigsFa... | [
"Write",
"a",
"small",
"file",
"in",
"all",
"available",
"storage",
"directories",
"that",
"indicates",
"that",
"the",
"namespace",
"has",
"reached",
"some",
"given",
"transaction",
"ID",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L516-L534 |
119,339 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.getFsImageNameCheckpoint | public File[] getFsImageNameCheckpoint(long txid) {
ArrayList<File> list = new ArrayList<File>();
for (Iterator<StorageDirectory> it =
dirIterator(NameNodeDirType.IMAGE); it.hasNext();) {
list.add(getStorageFile(it.next(), NameNodeFile.IMAGE_NEW, txid));
}
return list.toArray(new ... | java | public File[] getFsImageNameCheckpoint(long txid) {
ArrayList<File> list = new ArrayList<File>();
for (Iterator<StorageDirectory> it =
dirIterator(NameNodeDirType.IMAGE); it.hasNext();) {
list.add(getStorageFile(it.next(), NameNodeFile.IMAGE_NEW, txid));
}
return list.toArray(new ... | [
"public",
"File",
"[",
"]",
"getFsImageNameCheckpoint",
"(",
"long",
"txid",
")",
"{",
"ArrayList",
"<",
"File",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"for",
"(",
"Iterator",
"<",
"StorageDirectory",
">",
"it",
"=",
"di... | Return the name of the image file that is uploaded by periodic
checkpointing
@return List of filenames to save checkpoints to. | [
"Return",
"the",
"name",
"of",
"the",
"image",
"file",
"that",
"is",
"uploaded",
"by",
"periodic",
"checkpointing"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L542-L549 |
119,340 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.getFsImageName | public File getFsImageName(StorageLocationType type, long txid) {
File lastCandidate = null;
for (Iterator<StorageDirectory> it =
dirIterator(NameNodeDirType.IMAGE); it.hasNext();) {
StorageDirectory sd = it.next();
File fsImage = getStorageFile(sd, NameNodeFile.IMAGE, txid);
if(sd.getRo... | java | public File getFsImageName(StorageLocationType type, long txid) {
File lastCandidate = null;
for (Iterator<StorageDirectory> it =
dirIterator(NameNodeDirType.IMAGE); it.hasNext();) {
StorageDirectory sd = it.next();
File fsImage = getStorageFile(sd, NameNodeFile.IMAGE, txid);
if(sd.getRo... | [
"public",
"File",
"getFsImageName",
"(",
"StorageLocationType",
"type",
",",
"long",
"txid",
")",
"{",
"File",
"lastCandidate",
"=",
"null",
";",
"for",
"(",
"Iterator",
"<",
"StorageDirectory",
">",
"it",
"=",
"dirIterator",
"(",
"NameNodeDirType",
".",
"IMAG... | Return the name of the image file, preferring
"type" images. Otherwise, return any image.
@return The name of the image file. | [
"Return",
"the",
"name",
"of",
"the",
"image",
"file",
"preferring",
"type",
"images",
".",
"Otherwise",
"return",
"any",
"image",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L557-L571 |
119,341 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.format | public void format() throws IOException {
this.layoutVersion = FSConstants.LAYOUT_VERSION;
this.namespaceID = newNamespaceID();
this.cTime = 0L;
for (Iterator<StorageDirectory> it =
dirIterator(); it.hasNext();) {
StorageDirectory sd = it.next();
format(sd);
}
... | java | public void format() throws IOException {
this.layoutVersion = FSConstants.LAYOUT_VERSION;
this.namespaceID = newNamespaceID();
this.cTime = 0L;
for (Iterator<StorageDirectory> it =
dirIterator(); it.hasNext();) {
StorageDirectory sd = it.next();
format(sd);
}
... | [
"public",
"void",
"format",
"(",
")",
"throws",
"IOException",
"{",
"this",
".",
"layoutVersion",
"=",
"FSConstants",
".",
"LAYOUT_VERSION",
";",
"this",
".",
"namespaceID",
"=",
"newNamespaceID",
"(",
")",
";",
"this",
".",
"cTime",
"=",
"0L",
";",
"for",... | Format all available storage directories. | [
"Format",
"all",
"available",
"storage",
"directories",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L593-L602 |
119,342 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.newNamespaceID | static int newNamespaceID() {
Random r = new Random();
r.setSeed(FSNamesystem.now());
int newID = 0;
while(newID == 0)
newID = r.nextInt(0x7FFFFFFF); // use 31 bits only
return newID;
} | java | static int newNamespaceID() {
Random r = new Random();
r.setSeed(FSNamesystem.now());
int newID = 0;
while(newID == 0)
newID = r.nextInt(0x7FFFFFFF); // use 31 bits only
return newID;
} | [
"static",
"int",
"newNamespaceID",
"(",
")",
"{",
"Random",
"r",
"=",
"new",
"Random",
"(",
")",
";",
"r",
".",
"setSeed",
"(",
"FSNamesystem",
".",
"now",
"(",
")",
")",
";",
"int",
"newID",
"=",
"0",
";",
"while",
"(",
"newID",
"==",
"0",
")",
... | Generate new namespaceID.
namespaceID is a persistent attribute of the namespace.
It is generated when the namenode is formatted and remains the same
during the life cycle of the namenode.
When a datanodes register they receive it as the registrationID,
which is checked every time the datanode is communicating with th... | [
"Generate",
"new",
"namespaceID",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L627-L634 |
119,343 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.getDeprecatedProperty | String getDeprecatedProperty(String prop) {
assert getLayoutVersion() > FSConstants.LAYOUT_VERSION :
"getDeprecatedProperty should only be done when loading " +
"storage from past versions during upgrade.";
return deprecatedProperties.get(prop);
} | java | String getDeprecatedProperty(String prop) {
assert getLayoutVersion() > FSConstants.LAYOUT_VERSION :
"getDeprecatedProperty should only be done when loading " +
"storage from past versions during upgrade.";
return deprecatedProperties.get(prop);
} | [
"String",
"getDeprecatedProperty",
"(",
"String",
"prop",
")",
"{",
"assert",
"getLayoutVersion",
"(",
")",
">",
"FSConstants",
".",
"LAYOUT_VERSION",
":",
"\"getDeprecatedProperty should only be done when loading \"",
"+",
"\"storage from past versions during upgrade.\"",
";",... | Return a property that was stored in an earlier version of HDFS.
This should only be used during upgrades. | [
"Return",
"a",
"property",
"that",
"was",
"stored",
"in",
"an",
"earlier",
"version",
"of",
"HDFS",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L658-L663 |
119,344 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.setFields | @Override // Storage
protected void setFields(Properties props, StorageDirectory sd)
throws IOException {
super.setFields(props, sd);
boolean uState = getDistributedUpgradeState();
int uVersion = getDistributedUpgradeVersion();
if (uState && uVersion != getLayoutVersion()) {
props.setPro... | java | @Override // Storage
protected void setFields(Properties props, StorageDirectory sd)
throws IOException {
super.setFields(props, sd);
boolean uState = getDistributedUpgradeState();
int uVersion = getDistributedUpgradeVersion();
if (uState && uVersion != getLayoutVersion()) {
props.setPro... | [
"@",
"Override",
"// Storage ",
"protected",
"void",
"setFields",
"(",
"Properties",
"props",
",",
"StorageDirectory",
"sd",
")",
"throws",
"IOException",
"{",
"super",
".",
"setFields",
"(",
"props",
",",
"sd",
")",
";",
"boolean",
"uState",
"=",
"getDistrib... | Write version file into the storage directory.
The version file should always be written last.
Missing or corrupted version file indicates that
the checkpoint is not valid.
@param sd storage directory
@throws IOException | [
"Write",
"version",
"file",
"into",
"the",
"storage",
"directory",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L675-L686 |
119,345 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.setDeprecatedPropertiesForUpgrade | private void setDeprecatedPropertiesForUpgrade(Properties props) {
deprecatedProperties = new HashMap<String, String>();
String md5 = props.getProperty(MESSAGE_DIGEST_PROPERTY);
if (md5 != null) {
deprecatedProperties.put(MESSAGE_DIGEST_PROPERTY, md5);
}
} | java | private void setDeprecatedPropertiesForUpgrade(Properties props) {
deprecatedProperties = new HashMap<String, String>();
String md5 = props.getProperty(MESSAGE_DIGEST_PROPERTY);
if (md5 != null) {
deprecatedProperties.put(MESSAGE_DIGEST_PROPERTY, md5);
}
} | [
"private",
"void",
"setDeprecatedPropertiesForUpgrade",
"(",
"Properties",
"props",
")",
"{",
"deprecatedProperties",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"String",
"md5",
"=",
"props",
".",
"getProperty",
"(",
"MESSAGE_DIGEST... | Pull any properties out of the VERSION file that are from older
versions of HDFS and only necessary during upgrade. | [
"Pull",
"any",
"properties",
"out",
"of",
"the",
"VERSION",
"file",
"that",
"are",
"from",
"older",
"versions",
"of",
"HDFS",
"and",
"only",
"necessary",
"during",
"upgrade",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L692-L698 |
119,346 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.findFinalizedEditsFile | File findFinalizedEditsFile(long startTxId, long endTxId)
throws IOException {
File ret = findFile(NameNodeDirType.EDITS,
getFinalizedEditsFileName(startTxId, endTxId));
if (ret == null) {
throw new IOException(
"No edits file for txid " + startTxId + "-" + endTxId + " exists!");
}... | java | File findFinalizedEditsFile(long startTxId, long endTxId)
throws IOException {
File ret = findFile(NameNodeDirType.EDITS,
getFinalizedEditsFileName(startTxId, endTxId));
if (ret == null) {
throw new IOException(
"No edits file for txid " + startTxId + "-" + endTxId + " exists!");
}... | [
"File",
"findFinalizedEditsFile",
"(",
"long",
"startTxId",
",",
"long",
"endTxId",
")",
"throws",
"IOException",
"{",
"File",
"ret",
"=",
"findFile",
"(",
"NameNodeDirType",
".",
"EDITS",
",",
"getFinalizedEditsFileName",
"(",
"startTxId",
",",
"endTxId",
")",
... | Return the first readable finalized edits file for the given txid. | [
"Return",
"the",
"first",
"readable",
"finalized",
"edits",
"file",
"for",
"the",
"given",
"txid",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L762-L771 |
119,347 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.findInProgressEditsFile | File findInProgressEditsFile(long startTxId)
throws IOException {
File ret = findFile(NameNodeDirType.EDITS,
getInProgressEditsFileName(startTxId));
if (ret == null) {
throw new IOException(
"No edits file for txid " + startTxId + "-in progress");
}
return ret;
} | java | File findInProgressEditsFile(long startTxId)
throws IOException {
File ret = findFile(NameNodeDirType.EDITS,
getInProgressEditsFileName(startTxId));
if (ret == null) {
throw new IOException(
"No edits file for txid " + startTxId + "-in progress");
}
return ret;
} | [
"File",
"findInProgressEditsFile",
"(",
"long",
"startTxId",
")",
"throws",
"IOException",
"{",
"File",
"ret",
"=",
"findFile",
"(",
"NameNodeDirType",
".",
"EDITS",
",",
"getInProgressEditsFileName",
"(",
"startTxId",
")",
")",
";",
"if",
"(",
"ret",
"==",
"n... | Return the first readable inprogress edits file for the given txid. | [
"Return",
"the",
"first",
"readable",
"inprogress",
"edits",
"file",
"for",
"the",
"given",
"txid",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L776-L785 |
119,348 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.findFile | private File findFile(NameNodeDirType dirType, String name) {
for (StorageDirectory sd : dirIterable(dirType)) {
File candidate = new File(sd.getCurrentDir(), name);
if (sd.getCurrentDir().canRead() &&
candidate.exists()) {
return candidate;
}
}
return null;
} | java | private File findFile(NameNodeDirType dirType, String name) {
for (StorageDirectory sd : dirIterable(dirType)) {
File candidate = new File(sd.getCurrentDir(), name);
if (sd.getCurrentDir().canRead() &&
candidate.exists()) {
return candidate;
}
}
return null;
} | [
"private",
"File",
"findFile",
"(",
"NameNodeDirType",
"dirType",
",",
"String",
"name",
")",
"{",
"for",
"(",
"StorageDirectory",
"sd",
":",
"dirIterable",
"(",
"dirType",
")",
")",
"{",
"File",
"candidate",
"=",
"new",
"File",
"(",
"sd",
".",
"getCurrent... | Return the first readable storage file of the given name
across any of the 'current' directories in SDs of the
given type, or null if no such file exists. | [
"Return",
"the",
"first",
"readable",
"storage",
"file",
"of",
"the",
"given",
"name",
"across",
"any",
"of",
"the",
"current",
"directories",
"in",
"SDs",
"of",
"the",
"given",
"type",
"or",
"null",
"if",
"no",
"such",
"file",
"exists",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L801-L810 |
119,349 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.isPreferred | static boolean isPreferred(StorageLocationType type, StorageDirectory sd) {
if ((sd instanceof NNStorageDirectory)) {
return ((NNStorageDirectory) sd).type == type;
}
// by default all are preferred
return true;
} | java | static boolean isPreferred(StorageLocationType type, StorageDirectory sd) {
if ((sd instanceof NNStorageDirectory)) {
return ((NNStorageDirectory) sd).type == type;
}
// by default all are preferred
return true;
} | [
"static",
"boolean",
"isPreferred",
"(",
"StorageLocationType",
"type",
",",
"StorageDirectory",
"sd",
")",
"{",
"if",
"(",
"(",
"sd",
"instanceof",
"NNStorageDirectory",
")",
")",
"{",
"return",
"(",
"(",
"NNStorageDirectory",
")",
"sd",
")",
".",
"type",
"... | Checks if we have information about this directory
that it is preferred.
@param type preferred type
@param sd storage directory | [
"Checks",
"if",
"we",
"have",
"information",
"about",
"this",
"directory",
"that",
"it",
"is",
"preferred",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L818-L824 |
119,350 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.getType | static StorageLocationType getType(StorageDirectory sd) {
if ((sd instanceof NNStorageDirectory)) {
return ((NNStorageDirectory) sd).type;
}
// by default all are local
return StorageLocationType.LOCAL;
} | java | static StorageLocationType getType(StorageDirectory sd) {
if ((sd instanceof NNStorageDirectory)) {
return ((NNStorageDirectory) sd).type;
}
// by default all are local
return StorageLocationType.LOCAL;
} | [
"static",
"StorageLocationType",
"getType",
"(",
"StorageDirectory",
"sd",
")",
"{",
"if",
"(",
"(",
"sd",
"instanceof",
"NNStorageDirectory",
")",
")",
"{",
"return",
"(",
"(",
"NNStorageDirectory",
")",
"sd",
")",
".",
"type",
";",
"}",
"// by default all ar... | Get the type of given directory. | [
"Get",
"the",
"type",
"of",
"given",
"directory",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L829-L835 |
119,351 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.verifyDistributedUpgradeProgress | void verifyDistributedUpgradeProgress(StartupOption startOpt
) throws IOException {
if(startOpt == StartupOption.ROLLBACK || startOpt == StartupOption.IMPORT)
return;
assert upgradeManager != null : "FSNameSystem.upgradeManager is null.";
if(startOpt != Startup... | java | void verifyDistributedUpgradeProgress(StartupOption startOpt
) throws IOException {
if(startOpt == StartupOption.ROLLBACK || startOpt == StartupOption.IMPORT)
return;
assert upgradeManager != null : "FSNameSystem.upgradeManager is null.";
if(startOpt != Startup... | [
"void",
"verifyDistributedUpgradeProgress",
"(",
"StartupOption",
"startOpt",
")",
"throws",
"IOException",
"{",
"if",
"(",
"startOpt",
"==",
"StartupOption",
".",
"ROLLBACK",
"||",
"startOpt",
"==",
"StartupOption",
".",
"IMPORT",
")",
"return",
";",
"assert",
"u... | Verify that the distributed upgrade state is valid.
@param startOpt the option the namenode was started with. | [
"Verify",
"that",
"the",
"distributed",
"upgrade",
"state",
"is",
"valid",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L888-L906 |
119,352 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.initializeDistributedUpgrade | void initializeDistributedUpgrade() throws IOException {
if(! upgradeManager.initializeUpgrade())
return;
// write new upgrade state into disk
writeAll();
LOG.info("\n Distributed upgrade for NameNode version "
+ upgradeManager.getUpgradeVersion() + " to current LV "
+ ... | java | void initializeDistributedUpgrade() throws IOException {
if(! upgradeManager.initializeUpgrade())
return;
// write new upgrade state into disk
writeAll();
LOG.info("\n Distributed upgrade for NameNode version "
+ upgradeManager.getUpgradeVersion() + " to current LV "
+ ... | [
"void",
"initializeDistributedUpgrade",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"upgradeManager",
".",
"initializeUpgrade",
"(",
")",
")",
"return",
";",
"// write new upgrade state into disk",
"writeAll",
"(",
")",
";",
"LOG",
".",
"info",
"(",
... | Initialize a distributed upgrade. | [
"Initialize",
"a",
"distributed",
"upgrade",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L911-L919 |
119,353 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.reportErrorsOnDirectories | synchronized void reportErrorsOnDirectories(List<StorageDirectory> sds,
FSImage image) throws IOException {
for (StorageDirectory sd : sds) {
reportErrorsOnDirectory(sd, image);
}
// check image managers (this will update image metrics)
if (image != null) {
image.checkImageManager... | java | synchronized void reportErrorsOnDirectories(List<StorageDirectory> sds,
FSImage image) throws IOException {
for (StorageDirectory sd : sds) {
reportErrorsOnDirectory(sd, image);
}
// check image managers (this will update image metrics)
if (image != null) {
image.checkImageManager... | [
"synchronized",
"void",
"reportErrorsOnDirectories",
"(",
"List",
"<",
"StorageDirectory",
">",
"sds",
",",
"FSImage",
"image",
")",
"throws",
"IOException",
"{",
"for",
"(",
"StorageDirectory",
"sd",
":",
"sds",
")",
"{",
"reportErrorsOnDirectory",
"(",
"sd",
"... | Marks a list of directories as having experienced an error.
@param sds A list of storage directories to mark as errored.
@throws IOException | [
"Marks",
"a",
"list",
"of",
"directories",
"as",
"having",
"experienced",
"an",
"error",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L935-L955 |
119,354 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.reportErrorsOnDirectory | synchronized void reportErrorsOnDirectory(StorageDirectory sd,
FSImage image) {
String lsd = listStorageDirectories();
LOG.info("reportErrorsOnDirectory: Current list of storage dirs:" + lsd);
LOG.error("reportErrorsOnDirectory: Error reported on storage directory "
+ sd.getRoot());
if ... | java | synchronized void reportErrorsOnDirectory(StorageDirectory sd,
FSImage image) {
String lsd = listStorageDirectories();
LOG.info("reportErrorsOnDirectory: Current list of storage dirs:" + lsd);
LOG.error("reportErrorsOnDirectory: Error reported on storage directory "
+ sd.getRoot());
if ... | [
"synchronized",
"void",
"reportErrorsOnDirectory",
"(",
"StorageDirectory",
"sd",
",",
"FSImage",
"image",
")",
"{",
"String",
"lsd",
"=",
"listStorageDirectories",
"(",
")",
";",
"LOG",
".",
"info",
"(",
"\"reportErrorsOnDirectory: Current list of storage dirs:\"",
"+"... | Reports that a directory has experienced an error.
Notifies listeners that the directory is no longer
available.
@param sd A storage directory to mark as errored.
@throws IOException | [
"Reports",
"that",
"a",
"directory",
"has",
"experienced",
"an",
"error",
".",
"Notifies",
"listeners",
"that",
"the",
"directory",
"is",
"no",
"longer",
"available",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L965-L989 |
119,355 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.reportErrorOnFile | public void reportErrorOnFile(File f) {
// We use getAbsolutePath here instead of getCanonicalPath since we know
// that there is some IO problem on that drive.
// getCanonicalPath may need to call stat() or readlink() and it's likely
// those calls would fail due to the same underlying IO problem.
... | java | public void reportErrorOnFile(File f) {
// We use getAbsolutePath here instead of getCanonicalPath since we know
// that there is some IO problem on that drive.
// getCanonicalPath may need to call stat() or readlink() and it's likely
// those calls would fail due to the same underlying IO problem.
... | [
"public",
"void",
"reportErrorOnFile",
"(",
"File",
"f",
")",
"{",
"// We use getAbsolutePath here instead of getCanonicalPath since we know",
"// that there is some IO problem on that drive.",
"// getCanonicalPath may need to call stat() or readlink() and it's likely",
"// those calls would f... | Report that an IOE has occurred on some file which may
or may not be within one of the NN image storage directories. | [
"Report",
"that",
"an",
"IOE",
"has",
"occurred",
"on",
"some",
"file",
"which",
"may",
"or",
"may",
"not",
"be",
"within",
"one",
"of",
"the",
"NN",
"image",
"storage",
"directories",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L995-L1012 |
119,356 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.inspectStorageDirs | void inspectStorageDirs(FSImageStorageInspector inspector)
throws IOException {
// Process each of the storage directories to find the pair of
// newest image file and edit file
for (Iterator<StorageDirectory> it = dirIterator(); it.hasNext();) {
StorageDirectory sd = it.next();
inspector... | java | void inspectStorageDirs(FSImageStorageInspector inspector)
throws IOException {
// Process each of the storage directories to find the pair of
// newest image file and edit file
for (Iterator<StorageDirectory> it = dirIterator(); it.hasNext();) {
StorageDirectory sd = it.next();
inspector... | [
"void",
"inspectStorageDirs",
"(",
"FSImageStorageInspector",
"inspector",
")",
"throws",
"IOException",
"{",
"// Process each of the storage directories to find the pair of",
"// newest image file and edit file",
"for",
"(",
"Iterator",
"<",
"StorageDirectory",
">",
"it",
"=",
... | Iterate over all current storage directories, inspecting them
with the given inspector. | [
"Iterate",
"over",
"all",
"current",
"storage",
"directories",
"inspecting",
"them",
"with",
"the",
"given",
"inspector",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L1018-L1027 |
119,357 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java | NNStorage.readAndInspectDirs | FSImageStorageInspector readAndInspectDirs()
throws IOException {
int minLayoutVersion = Integer.MAX_VALUE; // the newest
int maxLayoutVersion = Integer.MIN_VALUE; // the oldest
// First determine what range of layout versions we're going to inspect
for (Iterator<StorageDirectory> it = dirIte... | java | FSImageStorageInspector readAndInspectDirs()
throws IOException {
int minLayoutVersion = Integer.MAX_VALUE; // the newest
int maxLayoutVersion = Integer.MIN_VALUE; // the oldest
// First determine what range of layout versions we're going to inspect
for (Iterator<StorageDirectory> it = dirIte... | [
"FSImageStorageInspector",
"readAndInspectDirs",
"(",
")",
"throws",
"IOException",
"{",
"int",
"minLayoutVersion",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"// the newest",
"int",
"maxLayoutVersion",
"=",
"Integer",
".",
"MIN_VALUE",
";",
"// the oldest",
"// First deter... | Iterate over all of the storage dirs, reading their contents to determine
their layout versions. Returns an FSImageStorageInspector which has
inspected each directory.
<b>Note:</b> this can mutate the storage info fields (ctime, version, etc).
@throws IOException if no valid storage dirs are found | [
"Iterate",
"over",
"all",
"of",
"the",
"storage",
"dirs",
"reading",
"their",
"contents",
"to",
"determine",
"their",
"layout",
"versions",
".",
"Returns",
"an",
"FSImageStorageInspector",
"which",
"has",
"inspected",
"each",
"directory",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L1037-L1075 |
119,358 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java | ProcfsBasedProcessTree.isAvailable | public static boolean isAvailable() {
try {
String osName = System.getProperty("os.name");
if (!osName.startsWith("Linux")) {
LOG.info("ProcfsBasedProcessTree currently is supported only on "
+ "Linux.");
return false;
}
} catch (SecurityException se) {
LOG.wa... | java | public static boolean isAvailable() {
try {
String osName = System.getProperty("os.name");
if (!osName.startsWith("Linux")) {
LOG.info("ProcfsBasedProcessTree currently is supported only on "
+ "Linux.");
return false;
}
} catch (SecurityException se) {
LOG.wa... | [
"public",
"static",
"boolean",
"isAvailable",
"(",
")",
"{",
"try",
"{",
"String",
"osName",
"=",
"System",
".",
"getProperty",
"(",
"\"os.name\"",
")",
";",
"if",
"(",
"!",
"osName",
".",
"startsWith",
"(",
"\"Linux\"",
")",
")",
"{",
"LOG",
".",
"inf... | Checks if the ProcfsBasedProcessTree is available on this system.
@return true if ProcfsBasedProcessTree is available. False otherwise. | [
"Checks",
"if",
"the",
"ProcfsBasedProcessTree",
"is",
"available",
"on",
"this",
"system",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java#L144-L157 |
119,359 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java | ProcfsBasedProcessTree.getProcessTree | public ProcfsBasedProcessTree getProcessTree() {
if (pid != -1) {
// Get the list of processes
List<Integer> processList = getProcessList();
Map<Integer, ProcessInfo> allProcessInfo = new HashMap<Integer, ProcessInfo>();
// cache the processTree to get the age for processes
Map... | java | public ProcfsBasedProcessTree getProcessTree() {
if (pid != -1) {
// Get the list of processes
List<Integer> processList = getProcessList();
Map<Integer, ProcessInfo> allProcessInfo = new HashMap<Integer, ProcessInfo>();
// cache the processTree to get the age for processes
Map... | [
"public",
"ProcfsBasedProcessTree",
"getProcessTree",
"(",
")",
"{",
"if",
"(",
"pid",
"!=",
"-",
"1",
")",
"{",
"// Get the list of processes",
"List",
"<",
"Integer",
">",
"processList",
"=",
"getProcessList",
"(",
")",
";",
"Map",
"<",
"Integer",
",",
"Pr... | Get the process-tree with latest state. If the root-process is not alive,
an empty tree will be returned.
@return the process-tree with latest state. | [
"Get",
"the",
"process",
"-",
"tree",
"with",
"latest",
"state",
".",
"If",
"the",
"root",
"-",
"process",
"is",
"not",
"alive",
"an",
"empty",
"tree",
"will",
"be",
"returned",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java#L165-L234 |
119,360 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java | ProcfsBasedProcessTree.isAnyProcessInTreeAlive | public boolean isAnyProcessInTreeAlive() {
for (Integer pId : processTree.keySet()) {
if (isAlive(pId.toString())) {
return true;
}
}
return false;
} | java | public boolean isAnyProcessInTreeAlive() {
for (Integer pId : processTree.keySet()) {
if (isAlive(pId.toString())) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"isAnyProcessInTreeAlive",
"(",
")",
"{",
"for",
"(",
"Integer",
"pId",
":",
"processTree",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"isAlive",
"(",
"pId",
".",
"toString",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}"... | Is any of the subprocesses in the process-tree alive?
@return true if any of the processes in the process-tree is
alive, false otherwise. | [
"Is",
"any",
"of",
"the",
"subprocesses",
"in",
"the",
"process",
"-",
"tree",
"alive?"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java#L255-L262 |
119,361 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java | ProcfsBasedProcessTree.checkPidPgrpidForMatch | static boolean checkPidPgrpidForMatch(String pidStr, String procfsDir) {
Integer pId = Integer.parseInt(pidStr);
// Get information for this process
ProcessInfo pInfo = new ProcessInfo(pId);
pInfo = constructProcessInfo(pInfo, procfsDir);
if (pInfo == null) {
// process group leader may have f... | java | static boolean checkPidPgrpidForMatch(String pidStr, String procfsDir) {
Integer pId = Integer.parseInt(pidStr);
// Get information for this process
ProcessInfo pInfo = new ProcessInfo(pId);
pInfo = constructProcessInfo(pInfo, procfsDir);
if (pInfo == null) {
// process group leader may have f... | [
"static",
"boolean",
"checkPidPgrpidForMatch",
"(",
"String",
"pidStr",
",",
"String",
"procfsDir",
")",
"{",
"Integer",
"pId",
"=",
"Integer",
".",
"parseInt",
"(",
"pidStr",
")",
";",
"// Get information for this process",
"ProcessInfo",
"pInfo",
"=",
"new",
"Pr... | Verify that the given process id is same as its process group id.
@param pidStr Process id of the to-be-verified-process
@param procfsDir Procfs root dir | [
"Verify",
"that",
"the",
"given",
"process",
"id",
"is",
"same",
"as",
"its",
"process",
"group",
"id",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java#L268-L289 |
119,362 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java | ProcfsBasedProcessTree.assertAndDestroyProcessGroup | public static void assertAndDestroyProcessGroup(String pgrpId, long interval,
boolean inBackground)
throws IOException {
// Make sure that the pid given is a process group leader
if (!checkPidPgrpidForMatch(pgrpId, PROCFS)) {
throw new IOException("Process with PID " + pgrp... | java | public static void assertAndDestroyProcessGroup(String pgrpId, long interval,
boolean inBackground)
throws IOException {
// Make sure that the pid given is a process group leader
if (!checkPidPgrpidForMatch(pgrpId, PROCFS)) {
throw new IOException("Process with PID " + pgrp... | [
"public",
"static",
"void",
"assertAndDestroyProcessGroup",
"(",
"String",
"pgrpId",
",",
"long",
"interval",
",",
"boolean",
"inBackground",
")",
"throws",
"IOException",
"{",
"// Make sure that the pid given is a process group leader",
"if",
"(",
"!",
"checkPidPgrpidForMa... | Make sure that the given pid is a process group leader and then
destroy the process group.
@param pgrpId Process group id of to-be-killed-processes
@param interval The time to wait before sending SIGKILL
after sending SIGTERM
@param inBackground Process is to be killed in the back ground with
a separate thread | [
"Make",
"sure",
"that",
"the",
"given",
"pid",
"is",
"a",
"process",
"group",
"leader",
"and",
"then",
"destroy",
"the",
"process",
"group",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java#L299-L308 |
119,363 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java | ProcfsBasedProcessTree.getProcessTreeDump | public String getProcessTreeDump() {
StringBuilder ret = new StringBuilder();
// The header.
ret.append(String.format("\t|- PID PPID PGRPID SESSID CMD_NAME "
+ "USER_MODE_TIME(MILLIS) SYSTEM_TIME(MILLIS) VMEM_USAGE(BYTES) "
+ "RSSMEM_USAGE(PAGES) FULL_CMD_LINE\n"));
for (ProcessInfo p : ... | java | public String getProcessTreeDump() {
StringBuilder ret = new StringBuilder();
// The header.
ret.append(String.format("\t|- PID PPID PGRPID SESSID CMD_NAME "
+ "USER_MODE_TIME(MILLIS) SYSTEM_TIME(MILLIS) VMEM_USAGE(BYTES) "
+ "RSSMEM_USAGE(PAGES) FULL_CMD_LINE\n"));
for (ProcessInfo p : ... | [
"public",
"String",
"getProcessTreeDump",
"(",
")",
"{",
"StringBuilder",
"ret",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"// The header.",
"ret",
".",
"append",
"(",
"String",
".",
"format",
"(",
"\"\\t|- PID PPID PGRPID SESSID CMD_NAME \"",
"+",
"\"USER_MODE_TI... | Get a dump of the process-tree.
@return a string concatenating the dump of information of all the processes
in the process-tree | [
"Get",
"a",
"dump",
"of",
"the",
"process",
"-",
"tree",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java#L355-L370 |
119,364 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java | ProcfsBasedProcessTree.getProcessNameContainsCount | public Collection<String> getProcessNameContainsCount(String name) {
List<String> retProcessList = new ArrayList<String>();
// Get the list of processes
List<Integer> processList = getProcessList();
for (Integer proc : processList) {
// Get information for each process
ProcessInfo p = new P... | java | public Collection<String> getProcessNameContainsCount(String name) {
List<String> retProcessList = new ArrayList<String>();
// Get the list of processes
List<Integer> processList = getProcessList();
for (Integer proc : processList) {
// Get information for each process
ProcessInfo p = new P... | [
"public",
"Collection",
"<",
"String",
">",
"getProcessNameContainsCount",
"(",
"String",
"name",
")",
"{",
"List",
"<",
"String",
">",
"retProcessList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"// Get the list of processes",
"List",
"<",
"... | Get a count of the number of processes that have a commandline that
matches a name.
@param name Name to check the commandline contains
@return Collection of strings concatenating the dump of information
of all the processes in the process-tree that match the
name | [
"Get",
"a",
"count",
"of",
"the",
"number",
"of",
"processes",
"that",
"have",
"a",
"commandline",
"that",
"matches",
"a",
"name",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java#L381-L402 |
119,365 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java | ProcfsBasedProcessTree.getCumulativeVmem | public long getCumulativeVmem(int olderThanAge) {
long total = 0;
for (ProcessInfo p : processTree.values()) {
if ((p != null) && (p.getAge() > olderThanAge)) {
total += p.getVmem();
}
}
return total;
} | java | public long getCumulativeVmem(int olderThanAge) {
long total = 0;
for (ProcessInfo p : processTree.values()) {
if ((p != null) && (p.getAge() > olderThanAge)) {
total += p.getVmem();
}
}
return total;
} | [
"public",
"long",
"getCumulativeVmem",
"(",
"int",
"olderThanAge",
")",
"{",
"long",
"total",
"=",
"0",
";",
"for",
"(",
"ProcessInfo",
"p",
":",
"processTree",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"(",
"p",
"!=",
"null",
")",
"&&",
"(",
"... | Get the cumulative virtual memory used by all the processes in the
process-tree that are older than the passed in age.
@param olderThanAge processes above this age are included in the
memory addition
@return cumulative virtual memory used by the process-tree in bytes,
for processes older than this age. | [
"Get",
"the",
"cumulative",
"virtual",
"memory",
"used",
"by",
"all",
"the",
"processes",
"in",
"the",
"process",
"-",
"tree",
"that",
"are",
"older",
"than",
"the",
"passed",
"in",
"age",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java#L436-L444 |
119,366 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java | ProcfsBasedProcessTree.getCumulativeCpuTime | public long getCumulativeCpuTime() {
if (JIFFY_LENGTH_IN_MILLIS < 0) {
return 0;
}
long incJiffies = 0;
for (ProcessInfo p : processTree.values()) {
if (p != null) {
incJiffies += p.dtime;
}
}
if (incJiffies * JIFFY_LENGTH_IN_MILLIS < Integer.MAX_VALUE) {
// Ignor... | java | public long getCumulativeCpuTime() {
if (JIFFY_LENGTH_IN_MILLIS < 0) {
return 0;
}
long incJiffies = 0;
for (ProcessInfo p : processTree.values()) {
if (p != null) {
incJiffies += p.dtime;
}
}
if (incJiffies * JIFFY_LENGTH_IN_MILLIS < Integer.MAX_VALUE) {
// Ignor... | [
"public",
"long",
"getCumulativeCpuTime",
"(",
")",
"{",
"if",
"(",
"JIFFY_LENGTH_IN_MILLIS",
"<",
"0",
")",
"{",
"return",
"0",
";",
"}",
"long",
"incJiffies",
"=",
"0",
";",
"for",
"(",
"ProcessInfo",
"p",
":",
"processTree",
".",
"values",
"(",
")",
... | Get the CPU time in millisecond used by all the processes in the
process-tree since the process-tree created
@return cumulative CPU time in millisecond since the process-tree created
return 0 if it cannot be calculated | [
"Get",
"the",
"CPU",
"time",
"in",
"millisecond",
"used",
"by",
"all",
"the",
"processes",
"in",
"the",
"process",
"-",
"tree",
"since",
"the",
"process",
"-",
"tree",
"created"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java#L476-L492 |
119,367 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java | ProcfsBasedProcessTree.getProcessList | private List<Integer> getProcessList() {
String[] processDirs = (new File(procfsDir)).list();
List<Integer> processList = new ArrayList<Integer>();
for (String dir : processDirs) {
try {
int pd = Integer.parseInt(dir);
if ((new File(procfsDir, dir)).isDirectory()) {
processL... | java | private List<Integer> getProcessList() {
String[] processDirs = (new File(procfsDir)).list();
List<Integer> processList = new ArrayList<Integer>();
for (String dir : processDirs) {
try {
int pd = Integer.parseInt(dir);
if ((new File(procfsDir, dir)).isDirectory()) {
processL... | [
"private",
"List",
"<",
"Integer",
">",
"getProcessList",
"(",
")",
"{",
"String",
"[",
"]",
"processDirs",
"=",
"(",
"new",
"File",
"(",
"procfsDir",
")",
")",
".",
"list",
"(",
")",
";",
"List",
"<",
"Integer",
">",
"processList",
"=",
"new",
"Arra... | Get the list of all processes in the system. | [
"Get",
"the",
"list",
"of",
"all",
"processes",
"in",
"the",
"system",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java#L510-L527 |
119,368 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java | ProcfsBasedProcessTree.constructProcessInfo | private static ProcessInfo constructProcessInfo(ProcessInfo pinfo,
String procfsDir) {
ProcessInfo ret = null;
// Read "procfsDir/<pid>/stat" file - typically /proc/<pid>/stat
BufferedReader in = null;
FileReader fReader = null;
try {
File p... | java | private static ProcessInfo constructProcessInfo(ProcessInfo pinfo,
String procfsDir) {
ProcessInfo ret = null;
// Read "procfsDir/<pid>/stat" file - typically /proc/<pid>/stat
BufferedReader in = null;
FileReader fReader = null;
try {
File p... | [
"private",
"static",
"ProcessInfo",
"constructProcessInfo",
"(",
"ProcessInfo",
"pinfo",
",",
"String",
"procfsDir",
")",
"{",
"ProcessInfo",
"ret",
"=",
"null",
";",
"// Read \"procfsDir/<pid>/stat\" file - typically /proc/<pid>/stat",
"BufferedReader",
"in",
"=",
"null",
... | Construct the ProcessInfo using the process' PID and procfs rooted at the
specified directory and return the same. It is provided mainly to assist
testing purposes.
Returns null on failing to read from procfs,
@param pinfo ProcessInfo that needs to be updated
@param procfsDir root of the proc file system
@return upda... | [
"Construct",
"the",
"ProcessInfo",
"using",
"the",
"process",
"PID",
"and",
"procfs",
"rooted",
"at",
"the",
"specified",
"directory",
"and",
"return",
"the",
"same",
".",
"It",
"is",
"provided",
"mainly",
"to",
"assist",
"testing",
"purposes",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java#L540-L591 |
119,369 | facebookarchive/hadoop-20 | src/benchmarks/mstress/MStress_Client.java | MStress_Client.parseOptions | private static void parseOptions(String args[])
{
if (!(args.length == 14 || args.length == 12 || args.length == 5)) {
usage();
}
/*
* As described in usage():
* -s dfs-server
* -p dfs-port [-t [create|create-write|stat|readdir|read|rename|delete]
* -a planfile-path
* -c ho... | java | private static void parseOptions(String args[])
{
if (!(args.length == 14 || args.length == 12 || args.length == 5)) {
usage();
}
/*
* As described in usage():
* -s dfs-server
* -p dfs-port [-t [create|create-write|stat|readdir|read|rename|delete]
* -a planfile-path
* -c ho... | [
"private",
"static",
"void",
"parseOptions",
"(",
"String",
"args",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"(",
"args",
".",
"length",
"==",
"14",
"||",
"args",
".",
"length",
"==",
"12",
"||",
"args",
".",
"length",
"==",
"5",
")",
")",
"{",
"usage... | Parses command line options.
the hostName, processName are used to namespace the files created by this
instance of the benchmark. | [
"Parses",
"command",
"line",
"options",
".",
"the",
"hostName",
"processName",
"are",
"used",
"to",
"namespace",
"the",
"files",
"created",
"by",
"this",
"instance",
"of",
"the",
"benchmark",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/benchmarks/mstress/MStress_Client.java#L178-L237 |
119,370 | facebookarchive/hadoop-20 | src/benchmarks/mstress/MStress_Client.java | MStress_Client.usage | private static void usage()
{
String className = MStress_Client.class.getName();
System.out.printf("Usage: java %s -s dfs-server -p dfs-port" +
"[-t [create|stat|read|readdir|delete|rename] -a planfile-path -c host -n process-name" +
" -P prefix]\n",
className);
System.ou... | java | private static void usage()
{
String className = MStress_Client.class.getName();
System.out.printf("Usage: java %s -s dfs-server -p dfs-port" +
"[-t [create|stat|read|readdir|delete|rename] -a planfile-path -c host -n process-name" +
" -P prefix]\n",
className);
System.ou... | [
"private",
"static",
"void",
"usage",
"(",
")",
"{",
"String",
"className",
"=",
"MStress_Client",
".",
"class",
".",
"getName",
"(",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"Usage: java %s -s dfs-server -p dfs-port\"",
"+",
"\"[-t [create|stat|read|... | Prints usage information to standard out. | [
"Prints",
"usage",
"information",
"to",
"standard",
"out",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/benchmarks/mstress/MStress_Client.java#L242-L255 |
119,371 | facebookarchive/hadoop-20 | src/benchmarks/mstress/MStress_Client.java | MStress_Client.parsePlanFile | private static int parsePlanFile()
{
int ret = -1;
try {
FileInputStream fis = new FileInputStream(planfilePath_);
DataInputStream dis = new DataInputStream(fis);
BufferedReader br = new BufferedReader(new InputStreamReader(dis));
if (prefix_.isEmpty()) {
prefix_ = "PATH_PREFI... | java | private static int parsePlanFile()
{
int ret = -1;
try {
FileInputStream fis = new FileInputStream(planfilePath_);
DataInputStream dis = new DataInputStream(fis);
BufferedReader br = new BufferedReader(new InputStreamReader(dis));
if (prefix_.isEmpty()) {
prefix_ = "PATH_PREFI... | [
"private",
"static",
"int",
"parsePlanFile",
"(",
")",
"{",
"int",
"ret",
"=",
"-",
"1",
";",
"try",
"{",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"planfilePath_",
")",
";",
"DataInputStream",
"dis",
"=",
"new",
"DataInputStream",
"(",
... | Parses the plan file that contains parameters for the benchmark. | [
"Parses",
"the",
"plan",
"file",
"that",
"contains",
"parameters",
"for",
"the",
"benchmark",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/benchmarks/mstress/MStress_Client.java#L260-L302 |
119,372 | facebookarchive/hadoop-20 | src/benchmarks/mstress/MStress_Client.java | MStress_Client.CreateDFSPaths | private static int CreateDFSPaths(int level, String parentPath) {
Boolean isLeaf = false;
Boolean isDir = false;
if (level + 1 >= levels_) {
isLeaf = true;
}
if (isLeaf) {
if (type_.equals("dir")) {
isDir = true;
} else {
isDir = false;
}
} else {
is... | java | private static int CreateDFSPaths(int level, String parentPath) {
Boolean isLeaf = false;
Boolean isDir = false;
if (level + 1 >= levels_) {
isLeaf = true;
}
if (isLeaf) {
if (type_.equals("dir")) {
isDir = true;
} else {
isDir = false;
}
} else {
is... | [
"private",
"static",
"int",
"CreateDFSPaths",
"(",
"int",
"level",
",",
"String",
"parentPath",
")",
"{",
"Boolean",
"isLeaf",
"=",
"false",
";",
"Boolean",
"isDir",
"=",
"false",
";",
"if",
"(",
"level",
"+",
"1",
">=",
"levels_",
")",
"{",
"isLeaf",
... | Recursively creates directories and files.
@param level current level of depth
@param parentPath the prefix to the path we have traversed into so far
@return -1 on error, 0 on success | [
"Recursively",
"creates",
"directories",
"and",
"files",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/benchmarks/mstress/MStress_Client.java#L318-L386 |
119,373 | facebookarchive/hadoop-20 | src/benchmarks/mstress/MStress_Client.java | MStress_Client.createWriteDFSPaths | private static int createWriteDFSPaths()
{
if (createDFSPaths() != 0) {
return -1;
}
try {
// write to all the files!
for (Map.Entry<String, OutputStream> file : files_.entrySet()) {
OutputStream os = file.getValue();
long startTime = System.nanoTime();
os.write(data_.getByte... | java | private static int createWriteDFSPaths()
{
if (createDFSPaths() != 0) {
return -1;
}
try {
// write to all the files!
for (Map.Entry<String, OutputStream> file : files_.entrySet()) {
OutputStream os = file.getValue();
long startTime = System.nanoTime();
os.write(data_.getByte... | [
"private",
"static",
"int",
"createWriteDFSPaths",
"(",
")",
"{",
"if",
"(",
"createDFSPaths",
"(",
")",
"!=",
"0",
")",
"{",
"return",
"-",
"1",
";",
"}",
"try",
"{",
"// write to all the files!",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"... | This creates DFS paths and writes data_ to them in one go.
@return -1 on error, 0 on success | [
"This",
"creates",
"DFS",
"paths",
"and",
"writes",
"data_",
"to",
"them",
"in",
"one",
"go",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/benchmarks/mstress/MStress_Client.java#L425-L449 |
119,374 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobTrackerRunner.java | CoronaJobTrackerRunner.localizeTaskConfiguration | @SuppressWarnings("deprecation")
private void localizeTaskConfiguration(TaskTracker tracker, JobConf ttConf,
String workDir, Task t, JobID jobID) throws IOException {
Path jobFile = new Path(t.getJobFile());
FileSystem systemFS = tracker.systemFS;
this.localizedJobFile = new Path(workDir, jobID + ".... | java | @SuppressWarnings("deprecation")
private void localizeTaskConfiguration(TaskTracker tracker, JobConf ttConf,
String workDir, Task t, JobID jobID) throws IOException {
Path jobFile = new Path(t.getJobFile());
FileSystem systemFS = tracker.systemFS;
this.localizedJobFile = new Path(workDir, jobID + ".... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"void",
"localizeTaskConfiguration",
"(",
"TaskTracker",
"tracker",
",",
"JobConf",
"ttConf",
",",
"String",
"workDir",
",",
"Task",
"t",
",",
"JobID",
"jobID",
")",
"throws",
"IOException",
"{",
"... | Copies the job file to the working directory of the process that will be
started. | [
"Copies",
"the",
"job",
"file",
"to",
"the",
"working",
"directory",
"of",
"the",
"process",
"that",
"will",
"be",
"started",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobTrackerRunner.java#L58-L81 |
119,375 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobTrackerRunner.java | CoronaJobTrackerRunner.prepare | @Override
public boolean prepare() throws IOException {
if (!super.prepare()) {
return false;
}
mapOutputFile.removeAll(getTask().getTaskID());
return true;
} | java | @Override
public boolean prepare() throws IOException {
if (!super.prepare()) {
return false;
}
mapOutputFile.removeAll(getTask().getTaskID());
return true;
} | [
"@",
"Override",
"public",
"boolean",
"prepare",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"super",
".",
"prepare",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"mapOutputFile",
".",
"removeAll",
"(",
"getTask",
"(",
")",
".",
"getTas... | Delete any temporary files from previous failed attempts. | [
"Delete",
"any",
"temporary",
"files",
"from",
"previous",
"failed",
"attempts",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobTrackerRunner.java#L84-L92 |
119,376 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/join/CompositeInputFormat.java | CompositeInputFormat.addDefaults | protected void addDefaults() {
try {
Parser.CNode.addIdentifier("inner", InnerJoinRecordReader.class);
Parser.CNode.addIdentifier("outer", OuterJoinRecordReader.class);
Parser.CNode.addIdentifier("override", OverrideRecordReader.class);
Parser.WNode.addIdentifier("tbl", WrappedRecordReader.c... | java | protected void addDefaults() {
try {
Parser.CNode.addIdentifier("inner", InnerJoinRecordReader.class);
Parser.CNode.addIdentifier("outer", OuterJoinRecordReader.class);
Parser.CNode.addIdentifier("override", OverrideRecordReader.class);
Parser.WNode.addIdentifier("tbl", WrappedRecordReader.c... | [
"protected",
"void",
"addDefaults",
"(",
")",
"{",
"try",
"{",
"Parser",
".",
"CNode",
".",
"addIdentifier",
"(",
"\"inner\"",
",",
"InnerJoinRecordReader",
".",
"class",
")",
";",
"Parser",
".",
"CNode",
".",
"addIdentifier",
"(",
"\"outer\"",
",",
"OuterJo... | Adds the default set of identifiers to the parser. | [
"Adds",
"the",
"default",
"set",
"of",
"identifiers",
"to",
"the",
"parser",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/join/CompositeInputFormat.java#L80-L89 |
119,377 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/join/CompositeInputFormat.java | CompositeInputFormat.addUserIdentifiers | private void addUserIdentifiers(JobConf job) throws IOException {
Pattern x = Pattern.compile("^mapred\\.join\\.define\\.(\\w+)$");
for (Map.Entry<String,String> kv : job) {
Matcher m = x.matcher(kv.getKey());
if (m.matches()) {
try {
Parser.CNode.addIdentifier(m.group(1),
... | java | private void addUserIdentifiers(JobConf job) throws IOException {
Pattern x = Pattern.compile("^mapred\\.join\\.define\\.(\\w+)$");
for (Map.Entry<String,String> kv : job) {
Matcher m = x.matcher(kv.getKey());
if (m.matches()) {
try {
Parser.CNode.addIdentifier(m.group(1),
... | [
"private",
"void",
"addUserIdentifiers",
"(",
"JobConf",
"job",
")",
"throws",
"IOException",
"{",
"Pattern",
"x",
"=",
"Pattern",
".",
"compile",
"(",
"\"^mapred\\\\.join\\\\.define\\\\.(\\\\w+)$\"",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
","... | Inform the parser of user-defined types. | [
"Inform",
"the",
"parser",
"of",
"user",
"-",
"defined",
"types",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/join/CompositeInputFormat.java#L94-L108 |
119,378 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/join/CompositeInputFormat.java | CompositeInputFormat.getSplits | public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException {
setFormat(job);
job.setLong("mapred.min.split.size", Long.MAX_VALUE);
return root.getSplits(job, numSplits);
} | java | public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException {
setFormat(job);
job.setLong("mapred.min.split.size", Long.MAX_VALUE);
return root.getSplits(job, numSplits);
} | [
"public",
"InputSplit",
"[",
"]",
"getSplits",
"(",
"JobConf",
"job",
",",
"int",
"numSplits",
")",
"throws",
"IOException",
"{",
"setFormat",
"(",
"job",
")",
";",
"job",
".",
"setLong",
"(",
"\"mapred.min.split.size\"",
",",
"Long",
".",
"MAX_VALUE",
")",
... | Build a CompositeInputSplit from the child InputFormats by assigning the
ith split from each child to the ith composite split. | [
"Build",
"a",
"CompositeInputSplit",
"from",
"the",
"child",
"InputFormats",
"by",
"assigning",
"the",
"ith",
"split",
"from",
"each",
"child",
"to",
"the",
"ith",
"composite",
"split",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/join/CompositeInputFormat.java#L114-L118 |
119,379 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/join/CompositeInputFormat.java | CompositeInputFormat.getRecordReader | @SuppressWarnings("unchecked") // child types unknown
public ComposableRecordReader<K,TupleWritable> getRecordReader(
InputSplit split, JobConf job, Reporter reporter) throws IOException {
setFormat(job);
return root.getRecordReader(split, job, reporter);
} | java | @SuppressWarnings("unchecked") // child types unknown
public ComposableRecordReader<K,TupleWritable> getRecordReader(
InputSplit split, JobConf job, Reporter reporter) throws IOException {
setFormat(job);
return root.getRecordReader(split, job, reporter);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"// child types unknown",
"public",
"ComposableRecordReader",
"<",
"K",
",",
"TupleWritable",
">",
"getRecordReader",
"(",
"InputSplit",
"split",
",",
"JobConf",
"job",
",",
"Reporter",
"reporter",
")",
"throws",
"... | Construct a CompositeRecordReader for the children of this InputFormat
as defined in the init expression.
The outermost join need only be composable, not necessarily a composite.
Mandating TupleWritable isn't strictly correct. | [
"Construct",
"a",
"CompositeRecordReader",
"for",
"the",
"children",
"of",
"this",
"InputFormat",
"as",
"defined",
"in",
"the",
"init",
"expression",
".",
"The",
"outermost",
"join",
"need",
"only",
"be",
"composable",
"not",
"necessarily",
"a",
"composite",
"."... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/join/CompositeInputFormat.java#L126-L131 |
119,380 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/log/LogLevel.java | LogLevel.main | public static void main(String[] args) {
if (args.length == 3 && "-getlevel".equals(args[0])) {
process("http://" + args[1] + "/logLevel?log=" + args[2]);
return;
}
else if (args.length == 4 && "-setlevel".equals(args[0])) {
process("http://" + args[1] + "/logLevel?log=" + args[2]
... | java | public static void main(String[] args) {
if (args.length == 3 && "-getlevel".equals(args[0])) {
process("http://" + args[1] + "/logLevel?log=" + args[2]);
return;
}
else if (args.length == 4 && "-setlevel".equals(args[0])) {
process("http://" + args[1] + "/logLevel?log=" + args[2]
... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"args",
".",
"length",
"==",
"3",
"&&",
"\"-getlevel\"",
".",
"equals",
"(",
"args",
"[",
"0",
"]",
")",
")",
"{",
"process",
"(",
"\"http://\"",
"+",
"args",... | A command line implementation | [
"A",
"command",
"line",
"implementation"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/log/LogLevel.java#L44-L57 |
119,381 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/s3/S3FileSystem.java | S3FileSystem.getFileStatus | @Override
public FileStatus getFileStatus(Path f) throws IOException {
INode inode = store.retrieveINode(makeAbsolute(f));
if (inode == null) {
throw new FileNotFoundException(f + ": No such file or directory.");
}
return new S3FileStatus(f.makeQualified(this), inode);
} | java | @Override
public FileStatus getFileStatus(Path f) throws IOException {
INode inode = store.retrieveINode(makeAbsolute(f));
if (inode == null) {
throw new FileNotFoundException(f + ": No such file or directory.");
}
return new S3FileStatus(f.makeQualified(this), inode);
} | [
"@",
"Override",
"public",
"FileStatus",
"getFileStatus",
"(",
"Path",
"f",
")",
"throws",
"IOException",
"{",
"INode",
"inode",
"=",
"store",
".",
"retrieveINode",
"(",
"makeAbsolute",
"(",
"f",
")",
")",
";",
"if",
"(",
"inode",
"==",
"null",
")",
"{",... | FileStatus for S3 file systems. | [
"FileStatus",
"for",
"S3",
"file",
"systems",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/s3/S3FileSystem.java#L330-L337 |
119,382 | facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerDispatcher.java | ServerDispatcher.assignClient | @Override
public void assignClient(long clientId) {
LOG.info("Assigning client " + clientId + " ...");
synchronized (clientModificationsLock) {
newlyAssignedClients.add(clientId);
}
} | java | @Override
public void assignClient(long clientId) {
LOG.info("Assigning client " + clientId + " ...");
synchronized (clientModificationsLock) {
newlyAssignedClients.add(clientId);
}
} | [
"@",
"Override",
"public",
"void",
"assignClient",
"(",
"long",
"clientId",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Assigning client \"",
"+",
"clientId",
"+",
"\" ...\"",
")",
";",
"synchronized",
"(",
"clientModificationsLock",
")",
"{",
"newlyAssignedClients",
... | Assigns a client to this dispatcher. If a notification fails to be sent
to a client, then it will be placed in a queue and the assigned
dispatcher for each client will try to re-send notifications from that
queue.
@param clientId the id of the assigned client. | [
"Assigns",
"a",
"client",
"to",
"this",
"dispatcher",
".",
"If",
"a",
"notification",
"fails",
"to",
"be",
"sent",
"to",
"a",
"client",
"then",
"it",
"will",
"be",
"placed",
"in",
"a",
"queue",
"and",
"the",
"assigned",
"dispatcher",
"for",
"each",
"clie... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerDispatcher.java#L165-L171 |
119,383 | facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerDispatcher.java | ServerDispatcher.handleFailedDispatch | @Override
public void handleFailedDispatch(long clientId, long failedTime) {
ClientData clientData = core.getClientData(clientId);
if (failedTime == -1 || clientData == null)
return;
// We only add it and don't update it because we are interested in
// keeping track of the first moment it f... | java | @Override
public void handleFailedDispatch(long clientId, long failedTime) {
ClientData clientData = core.getClientData(clientId);
if (failedTime == -1 || clientData == null)
return;
// We only add it and don't update it because we are interested in
// keeping track of the first moment it f... | [
"@",
"Override",
"public",
"void",
"handleFailedDispatch",
"(",
"long",
"clientId",
",",
"long",
"failedTime",
")",
"{",
"ClientData",
"clientData",
"=",
"core",
".",
"getClientData",
"(",
"clientId",
")",
";",
"if",
"(",
"failedTime",
"==",
"-",
"1",
"||",
... | Called each time a handleNotification or heartbeat Thrift
call fails.
@param clientId the id of the client on which the call failed.
@param failedTime the time at which the call was made. If
this is -1, then nothing will be updated. | [
"Called",
"each",
"time",
"a",
"handleNotification",
"or",
"heartbeat",
"Thrift",
"call",
"fails",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerDispatcher.java#L390-L404 |
119,384 | facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerDispatcher.java | ServerDispatcher.handleSuccessfulDispatch | @Override
public void handleSuccessfulDispatch(long clientId, long sentTime) {
ClientData clientData = core.getClientData(clientId);
if (sentTime == -1 || clientData == null)
return;
clientData.markedAsFailedTime = -1;
if (clientData.markedAsFailedTime != -1) {
LOG.info("Unmarking " +... | java | @Override
public void handleSuccessfulDispatch(long clientId, long sentTime) {
ClientData clientData = core.getClientData(clientId);
if (sentTime == -1 || clientData == null)
return;
clientData.markedAsFailedTime = -1;
if (clientData.markedAsFailedTime != -1) {
LOG.info("Unmarking " +... | [
"@",
"Override",
"public",
"void",
"handleSuccessfulDispatch",
"(",
"long",
"clientId",
",",
"long",
"sentTime",
")",
"{",
"ClientData",
"clientData",
"=",
"core",
".",
"getClientData",
"(",
"clientId",
")",
";",
"if",
"(",
"sentTime",
"==",
"-",
"1",
"||",
... | Called each time a handleNotification or heartbeat Thrift
call is successful.
@param clientId the id of the client on which the call was successful.
@param sentTime the time at which the call was made. Nothing
happens if this is -1. | [
"Called",
"each",
"time",
"a",
"handleNotification",
"or",
"heartbeat",
"Thrift",
"call",
"is",
"successful",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerDispatcher.java#L414-L426 |
119,385 | facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerDispatcher.java | ServerDispatcher.updateClients | private void updateClients() {
assignedClients.addAll(newlyAssignedClients);
assignedClients.removeAll(removedClients);
newlyAssignedClients.clear();
removedClients.clear();
} | java | private void updateClients() {
assignedClients.addAll(newlyAssignedClients);
assignedClients.removeAll(removedClients);
newlyAssignedClients.clear();
removedClients.clear();
} | [
"private",
"void",
"updateClients",
"(",
")",
"{",
"assignedClients",
".",
"addAll",
"(",
"newlyAssignedClients",
")",
";",
"assignedClients",
".",
"removeAll",
"(",
"removedClients",
")",
";",
"newlyAssignedClients",
".",
"clear",
"(",
")",
";",
"removedClients",... | Must be called with the clientsModificationLock hold. | [
"Must",
"be",
"called",
"with",
"the",
"clientsModificationLock",
"hold",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerDispatcher.java#L432-L438 |
119,386 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/DBCountPageView.java | DBCountPageView.populateAccess | private void populateAccess() throws SQLException {
PreparedStatement statement = null ;
try {
statement = connection.prepareStatement(
"INSERT INTO Access(url, referrer, time)" +
" VALUES (?, ?, ?)");
Random random = new Random();
int time = random.nextInt(50) + 50;
... | java | private void populateAccess() throws SQLException {
PreparedStatement statement = null ;
try {
statement = connection.prepareStatement(
"INSERT INTO Access(url, referrer, time)" +
" VALUES (?, ?, ?)");
Random random = new Random();
int time = random.nextInt(50) + 50;
... | [
"private",
"void",
"populateAccess",
"(",
")",
"throws",
"SQLException",
"{",
"PreparedStatement",
"statement",
"=",
"null",
";",
"try",
"{",
"statement",
"=",
"connection",
".",
"prepareStatement",
"(",
"\"INSERT INTO Access(url, referrer, time)\"",
"+",
"\" VALUES (?,... | Populates the Access table with generated records. | [
"Populates",
"the",
"Access",
"table",
"with",
"generated",
"records",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/DBCountPageView.java#L179-L236 |
119,387 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/DBCountPageView.java | DBCountPageView.verify | private boolean verify() throws SQLException {
//check total num pageview
String countAccessQuery = "SELECT COUNT(*) FROM Access";
String sumPageviewQuery = "SELECT SUM(pageview) FROM Pageview";
Statement st = null;
ResultSet rs = null;
try {
st = connection.createStatement();
rs = s... | java | private boolean verify() throws SQLException {
//check total num pageview
String countAccessQuery = "SELECT COUNT(*) FROM Access";
String sumPageviewQuery = "SELECT SUM(pageview) FROM Pageview";
Statement st = null;
ResultSet rs = null;
try {
st = connection.createStatement();
rs = s... | [
"private",
"boolean",
"verify",
"(",
")",
"throws",
"SQLException",
"{",
"//check total num pageview",
"String",
"countAccessQuery",
"=",
"\"SELECT COUNT(*) FROM Access\"",
";",
"String",
"sumPageviewQuery",
"=",
"\"SELECT SUM(pageview) FROM Pageview\"",
";",
"Statement",
"st... | Verifies the results are correct | [
"Verifies",
"the",
"results",
"are",
"correct"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/DBCountPageView.java#L239-L265 |
119,388 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/VolumeMap.java | VolumeMap.get | DatanodeBlockInfo get(int namespaceId, Block block) {
checkBlock(block);
NamespaceMap nm = getNamespaceMap(namespaceId);
if (nm == null) {
return null;
}
return nm.getBlockInfo(block);
} | java | DatanodeBlockInfo get(int namespaceId, Block block) {
checkBlock(block);
NamespaceMap nm = getNamespaceMap(namespaceId);
if (nm == null) {
return null;
}
return nm.getBlockInfo(block);
} | [
"DatanodeBlockInfo",
"get",
"(",
"int",
"namespaceId",
",",
"Block",
"block",
")",
"{",
"checkBlock",
"(",
"block",
")",
";",
"NamespaceMap",
"nm",
"=",
"getNamespaceMap",
"(",
"namespaceId",
")",
";",
"if",
"(",
"nm",
"==",
"null",
")",
"{",
"return",
"... | Get the meta information of the replica that matches both block id and
generation stamp
@param namespaceId
@param block
block with its id as the key
@return the replica's meta information
@throws IllegalArgumentException
if the input block or block pool is null | [
"Get",
"the",
"meta",
"information",
"of",
"the",
"replica",
"that",
"matches",
"both",
"block",
"id",
"and",
"generation",
"stamp"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/VolumeMap.java#L114-L121 |
119,389 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/VolumeMap.java | VolumeMap.remove | DatanodeBlockInfo remove(int namespaceId, Block block) {
NamespaceMap nm = getNamespaceMap(namespaceId);
if (nm == null) {
return null;
}
if (datasetDelta != null) {
datasetDelta.removeBlock(namespaceId, block);
}
return nm.removeBlockInfo(block);
} | java | DatanodeBlockInfo remove(int namespaceId, Block block) {
NamespaceMap nm = getNamespaceMap(namespaceId);
if (nm == null) {
return null;
}
if (datasetDelta != null) {
datasetDelta.removeBlock(namespaceId, block);
}
return nm.removeBlockInfo(block);
} | [
"DatanodeBlockInfo",
"remove",
"(",
"int",
"namespaceId",
",",
"Block",
"block",
")",
"{",
"NamespaceMap",
"nm",
"=",
"getNamespaceMap",
"(",
"namespaceId",
")",
";",
"if",
"(",
"nm",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"datase... | Remove the replica's meta information from the map that matches the input
block's id and generation stamp
@param namespaceId
@param block
block with its id as the key
@return the removed replica's meta information
@throws IllegalArgumentException
if the input block is null | [
"Remove",
"the",
"replica",
"s",
"meta",
"information",
"from",
"the",
"map",
"that",
"matches",
"the",
"input",
"block",
"s",
"id",
"and",
"generation",
"stamp"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/VolumeMap.java#L169-L178 |
119,390 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/VolumeMap.java | VolumeMap.size | int size(int namespaceId) {
NamespaceMap nm = getNamespaceMap(namespaceId);
if (nm == null) {
return 0;
}
return nm.size();
} | java | int size(int namespaceId) {
NamespaceMap nm = getNamespaceMap(namespaceId);
if (nm == null) {
return 0;
}
return nm.size();
} | [
"int",
"size",
"(",
"int",
"namespaceId",
")",
"{",
"NamespaceMap",
"nm",
"=",
"getNamespaceMap",
"(",
"namespaceId",
")",
";",
"if",
"(",
"nm",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"return",
"nm",
".",
"size",
"(",
")",
";",
"}"
] | Get the size of the map for given namespace
@param namespaceId
@return the number of replicas in the map | [
"Get",
"the",
"size",
"of",
"the",
"map",
"for",
"given",
"namespace"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/VolumeMap.java#L186-L192 |
119,391 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/VolumeMap.java | VolumeMap.getOngoingCreates | ActiveFile getOngoingCreates(int namespaceId, Block block) {
checkBlock(block);
NamespaceMap nm = getNamespaceMap(namespaceId);
if (nm == null) {
return null;
}
return nm.getOngoingCreates(block);
} | java | ActiveFile getOngoingCreates(int namespaceId, Block block) {
checkBlock(block);
NamespaceMap nm = getNamespaceMap(namespaceId);
if (nm == null) {
return null;
}
return nm.getOngoingCreates(block);
} | [
"ActiveFile",
"getOngoingCreates",
"(",
"int",
"namespaceId",
",",
"Block",
"block",
")",
"{",
"checkBlock",
"(",
"block",
")",
";",
"NamespaceMap",
"nm",
"=",
"getNamespaceMap",
"(",
"namespaceId",
")",
";",
"if",
"(",
"nm",
"==",
"null",
")",
"{",
"retur... | for ongoing creates | [
"for",
"ongoing",
"creates"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/VolumeMap.java#L209-L216 |
119,392 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/DefaultJobHistoryParser.java | DefaultJobHistoryParser.parseJobTasks | public static void parseJobTasks(String jobHistoryFile,
JobHistory.JobInfo job, FileSystem fs)
throws IOException {
JobHistory.parseHistoryFromFS(jobHistoryFile,
new JobTasksParseListener(job), fs);
} | java | public static void parseJobTasks(String jobHistoryFile,
JobHistory.JobInfo job, FileSystem fs)
throws IOException {
JobHistory.parseHistoryFromFS(jobHistoryFile,
new JobTasksParseListener(job), fs);
} | [
"public",
"static",
"void",
"parseJobTasks",
"(",
"String",
"jobHistoryFile",
",",
"JobHistory",
".",
"JobInfo",
"job",
",",
"FileSystem",
"fs",
")",
"throws",
"IOException",
"{",
"JobHistory",
".",
"parseHistoryFromFS",
"(",
"jobHistoryFile",
",",
"new",
"JobTask... | Populates a JobInfo object from the job's history log file.
@param jobHistoryFile history file for this job.
@param job a precreated JobInfo object, should be non-null.
@param fs FileSystem where historyFile is present.
@throws IOException | [
"Populates",
"a",
"JobInfo",
"object",
"from",
"the",
"job",
"s",
"history",
"log",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/DefaultJobHistoryParser.java#L47-L52 |
119,393 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/hightidenode/ConfigManager.java | ConfigManager.validateAllPolicies | private void validateAllPolicies(Collection<PolicyInfo> all)
throws IOException, NumberFormatException {
for (PolicyInfo pinfo: all) {
Path srcPath = pinfo.getSrcPath();
if (srcPath == null) {
throw new IOException("Unable to find srcPath in policy.");
}
if (pinfo.getProperty("r... | java | private void validateAllPolicies(Collection<PolicyInfo> all)
throws IOException, NumberFormatException {
for (PolicyInfo pinfo: all) {
Path srcPath = pinfo.getSrcPath();
if (srcPath == null) {
throw new IOException("Unable to find srcPath in policy.");
}
if (pinfo.getProperty("r... | [
"private",
"void",
"validateAllPolicies",
"(",
"Collection",
"<",
"PolicyInfo",
">",
"all",
")",
"throws",
"IOException",
",",
"NumberFormatException",
"{",
"for",
"(",
"PolicyInfo",
"pinfo",
":",
"all",
")",
"{",
"Path",
"srcPath",
"=",
"pinfo",
".",
"getSrcP... | Validate a collection of policies | [
"Validate",
"a",
"collection",
"of",
"policies"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/hightidenode/ConfigManager.java#L317-L350 |
119,394 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/raid/PurgeMonitor.java | PurgeMonitor.purgeDirectories | private void purgeDirectories(FileSystem fs, Path root) throws IOException {
DirectoryTraversal traversal =
DirectoryTraversal.directoryRetriever(Arrays.asList(root), fs,
directoryTraversalThreads, directoryTraversalShuffle);
String prefix = root.toUri().getPath();
FileStatus dir;
... | java | private void purgeDirectories(FileSystem fs, Path root) throws IOException {
DirectoryTraversal traversal =
DirectoryTraversal.directoryRetriever(Arrays.asList(root), fs,
directoryTraversalThreads, directoryTraversalShuffle);
String prefix = root.toUri().getPath();
FileStatus dir;
... | [
"private",
"void",
"purgeDirectories",
"(",
"FileSystem",
"fs",
",",
"Path",
"root",
")",
"throws",
"IOException",
"{",
"DirectoryTraversal",
"traversal",
"=",
"DirectoryTraversal",
".",
"directoryRetriever",
"(",
"Arrays",
".",
"asList",
"(",
"root",
")",
",",
... | Traverse the parity destination directory, removing directories that
no longer existing in the source.
@throws IOException | [
"Traverse",
"the",
"parity",
"destination",
"directory",
"removing",
"directories",
"that",
"no",
"longer",
"existing",
"in",
"the",
"source",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/PurgeMonitor.java#L101-L125 |
119,395 | facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/raid/PurgeMonitor.java | PurgeMonitor.existsBetterParityFile | private static boolean existsBetterParityFile(
Codec codec, FileStatus srcStat, Configuration conf) throws IOException {
for (Codec c : Codec.getCodecs()) {
if (c.priority > codec.priority) {
ParityFilePair ppair = ParityFilePair.getParityFile(
c, srcStat, conf);
if (ppair !=... | java | private static boolean existsBetterParityFile(
Codec codec, FileStatus srcStat, Configuration conf) throws IOException {
for (Codec c : Codec.getCodecs()) {
if (c.priority > codec.priority) {
ParityFilePair ppair = ParityFilePair.getParityFile(
c, srcStat, conf);
if (ppair !=... | [
"private",
"static",
"boolean",
"existsBetterParityFile",
"(",
"Codec",
"codec",
",",
"FileStatus",
"srcStat",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"for",
"(",
"Codec",
"c",
":",
"Codec",
".",
"getCodecs",
"(",
")",
")",
"{",
"if"... | Is there a parity file which has a codec with higher priority? | [
"Is",
"there",
"a",
"parity",
"file",
"which",
"has",
"a",
"codec",
"with",
"higher",
"priority?"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/PurgeMonitor.java#L406-L418 |
119,396 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/BytesWritable.java | BytesWritable.copyTo | public int copyTo(byte[] dest, int start)
throws BufferTooSmallException {
if (size > (dest.length - start)) {
throw new BufferTooSmallException("size is " + size
+ ", buffer availabe size is " + (dest.length - start));
}
if (size > 0) {
System.arraycopy(bytes, 0, dest, start, si... | java | public int copyTo(byte[] dest, int start)
throws BufferTooSmallException {
if (size > (dest.length - start)) {
throw new BufferTooSmallException("size is " + size
+ ", buffer availabe size is " + (dest.length - start));
}
if (size > 0) {
System.arraycopy(bytes, 0, dest, start, si... | [
"public",
"int",
"copyTo",
"(",
"byte",
"[",
"]",
"dest",
",",
"int",
"start",
")",
"throws",
"BufferTooSmallException",
"{",
"if",
"(",
"size",
">",
"(",
"dest",
".",
"length",
"-",
"start",
")",
")",
"{",
"throw",
"new",
"BufferTooSmallException",
"(",... | copy the byte array to the dest array, and return the number of bytes
copied.
@param dest
@param maxLen
@param start
@return | [
"copy",
"the",
"byte",
"array",
"to",
"the",
"dest",
"array",
"and",
"return",
"the",
"number",
"of",
"bytes",
"copied",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/BytesWritable.java#L74-L84 |
119,397 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/BytesWritable.java | BytesWritable.setCapacity | public void setCapacity(int new_cap) {
if (new_cap != getCapacity()) {
byte[] new_data = new byte[new_cap];
if (new_cap < size) {
size = new_cap;
}
if (size != 0) {
System.arraycopy(bytes, 0, new_data, 0, size);
}
bytes = new_data;
}
} | java | public void setCapacity(int new_cap) {
if (new_cap != getCapacity()) {
byte[] new_data = new byte[new_cap];
if (new_cap < size) {
size = new_cap;
}
if (size != 0) {
System.arraycopy(bytes, 0, new_data, 0, size);
}
bytes = new_data;
}
} | [
"public",
"void",
"setCapacity",
"(",
"int",
"new_cap",
")",
"{",
"if",
"(",
"new_cap",
"!=",
"getCapacity",
"(",
")",
")",
"{",
"byte",
"[",
"]",
"new_data",
"=",
"new",
"byte",
"[",
"new_cap",
"]",
";",
"if",
"(",
"new_cap",
"<",
"size",
")",
"{"... | Change the capacity of the backing storage.
The data is preserved.
@param new_cap The new capacity in bytes. | [
"Change",
"the",
"capacity",
"of",
"the",
"backing",
"storage",
".",
"The",
"data",
"is",
"preserved",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/BytesWritable.java#L138-L149 |
119,398 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/BytesWritable.java | BytesWritable.set | public void set(byte[] newData, int offset, int length) {
setSize(0);
setSize(length);
System.arraycopy(newData, offset, bytes, 0, size);
} | java | public void set(byte[] newData, int offset, int length) {
setSize(0);
setSize(length);
System.arraycopy(newData, offset, bytes, 0, size);
} | [
"public",
"void",
"set",
"(",
"byte",
"[",
"]",
"newData",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"setSize",
"(",
"0",
")",
";",
"setSize",
"(",
"length",
")",
";",
"System",
".",
"arraycopy",
"(",
"newData",
",",
"offset",
",",
"byt... | Set the value to a copy of the given byte range
@param newData the new values to copy in
@param offset the offset in newData to start at
@param length the number of bytes to copy | [
"Set",
"the",
"value",
"to",
"a",
"copy",
"of",
"the",
"given",
"byte",
"range"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/BytesWritable.java#L165-L169 |
119,399 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/DataTransferHeaderOptions.java | DataTransferHeaderOptions.setBits | protected static long setBits(long num, int start, int len, long value){
// Get rid of illegal bits of value:
value = value & ((1L<<len)-1);
long val_mask = value << start;
long zero_mask = ~( ((1L << len) -1) << start );
return ( num & zero_mask ) | val_mask;
} | java | protected static long setBits(long num, int start, int len, long value){
// Get rid of illegal bits of value:
value = value & ((1L<<len)-1);
long val_mask = value << start;
long zero_mask = ~( ((1L << len) -1) << start );
return ( num & zero_mask ) | val_mask;
} | [
"protected",
"static",
"long",
"setBits",
"(",
"long",
"num",
",",
"int",
"start",
",",
"int",
"len",
",",
"long",
"value",
")",
"{",
"// Get rid of illegal bits of value:",
"value",
"=",
"value",
"&",
"(",
"(",
"1L",
"<<",
"len",
")",
"-",
"1",
")",
"... | Sets specific bits of a specific number.
@param num The number to set bits.
@param start Index of the rightmost bit we want to set. 0-based.
@param len How many bits we want to set.
@param value The value we want to set to.
@return The number after changing specific bits. | [
"Sets",
"specific",
"bits",
"of",
"a",
"specific",
"number",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/DataTransferHeaderOptions.java#L136-L143 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.