id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
117,700 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java | DatanodeDescriptor.moveBlockToHead | void moveBlockToHead(BlockInfo b) {
blockList = b.listRemove(blockList, this);
blockList = b.listInsert(blockList, this, -1);
} | java | void moveBlockToHead(BlockInfo b) {
blockList = b.listRemove(blockList, this);
blockList = b.listInsert(blockList, this, -1);
} | [
"void",
"moveBlockToHead",
"(",
"BlockInfo",
"b",
")",
"{",
"blockList",
"=",
"b",
".",
"listRemove",
"(",
"blockList",
",",
"this",
")",
";",
"blockList",
"=",
"b",
".",
"listInsert",
"(",
"blockList",
",",
"this",
",",
"-",
"1",
")",
";",
"}"
] | Move block to the head of the list of blocks belonging to the data-node. | [
"Move",
"block",
"to",
"the",
"head",
"of",
"the",
"list",
"of",
"blocks",
"belonging",
"to",
"the",
"data",
"-",
"node",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java#L313-L316 |
117,701 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java | DatanodeDescriptor.listMoveToHead | protected BlockInfo listMoveToHead(BlockInfo block, BlockInfo head,
DatanodeIndex indexes) {
assert head != null : "Head can not be null";
if (head == block) {
return head;
}
BlockInfo next = block.getSetNext(indexes.currentIndex, head);
BlockInfo prev = block.getSetPrevious(indexes.curr... | java | protected BlockInfo listMoveToHead(BlockInfo block, BlockInfo head,
DatanodeIndex indexes) {
assert head != null : "Head can not be null";
if (head == block) {
return head;
}
BlockInfo next = block.getSetNext(indexes.currentIndex, head);
BlockInfo prev = block.getSetPrevious(indexes.curr... | [
"protected",
"BlockInfo",
"listMoveToHead",
"(",
"BlockInfo",
"block",
",",
"BlockInfo",
"head",
",",
"DatanodeIndex",
"indexes",
")",
"{",
"assert",
"head",
"!=",
"null",
":",
"\"Head can not be null\"",
";",
"if",
"(",
"head",
"==",
"block",
")",
"{",
"retur... | Remove block from the list and insert
into the head of the list of blocks
related to the specified DatanodeDescriptor.
If the head is null then form a new list.
@return current block as the new head of the list. | [
"Remove",
"block",
"from",
"the",
"list",
"and",
"insert",
"into",
"the",
"head",
"of",
"the",
"list",
"of",
"blocks",
"related",
"to",
"the",
"specified",
"DatanodeDescriptor",
".",
"If",
"the",
"head",
"is",
"null",
"then",
"form",
"a",
"new",
"list",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java#L325-L340 |
117,702 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java | DatanodeDescriptor.addBlockToBeReplicated | void addBlockToBeReplicated(Block block, DatanodeDescriptor[] targets) {
assert(block != null && targets != null && targets.length > 0);
replicateBlocks.offer(block, targets);
} | java | void addBlockToBeReplicated(Block block, DatanodeDescriptor[] targets) {
assert(block != null && targets != null && targets.length > 0);
replicateBlocks.offer(block, targets);
} | [
"void",
"addBlockToBeReplicated",
"(",
"Block",
"block",
",",
"DatanodeDescriptor",
"[",
"]",
"targets",
")",
"{",
"assert",
"(",
"block",
"!=",
"null",
"&&",
"targets",
"!=",
"null",
"&&",
"targets",
".",
"length",
">",
"0",
")",
";",
"replicateBlocks",
"... | Store block replication work. | [
"Store",
"block",
"replication",
"work",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java#L477-L480 |
117,703 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java | DatanodeDescriptor.addBlockToBeRecovered | void addBlockToBeRecovered(Block block, DatanodeDescriptor[] targets) {
assert(block != null && targets != null && targets.length > 0);
recoverBlocks.offer(block, targets);
} | java | void addBlockToBeRecovered(Block block, DatanodeDescriptor[] targets) {
assert(block != null && targets != null && targets.length > 0);
recoverBlocks.offer(block, targets);
} | [
"void",
"addBlockToBeRecovered",
"(",
"Block",
"block",
",",
"DatanodeDescriptor",
"[",
"]",
"targets",
")",
"{",
"assert",
"(",
"block",
"!=",
"null",
"&&",
"targets",
"!=",
"null",
"&&",
"targets",
".",
"length",
">",
"0",
")",
";",
"recoverBlocks",
".",... | Store block recovery work. | [
"Store",
"block",
"recovery",
"work",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java#L485-L488 |
117,704 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java | DatanodeDescriptor.addBlocksToBeInvalidated | void addBlocksToBeInvalidated(List<Block> blocklist) {
assert(blocklist != null && blocklist.size() > 0);
synchronized (invalidateBlocks) {
for(Block blk : blocklist) {
invalidateBlocks.add(blk);
}
}
} | java | void addBlocksToBeInvalidated(List<Block> blocklist) {
assert(blocklist != null && blocklist.size() > 0);
synchronized (invalidateBlocks) {
for(Block blk : blocklist) {
invalidateBlocks.add(blk);
}
}
} | [
"void",
"addBlocksToBeInvalidated",
"(",
"List",
"<",
"Block",
">",
"blocklist",
")",
"{",
"assert",
"(",
"blocklist",
"!=",
"null",
"&&",
"blocklist",
".",
"size",
"(",
")",
">",
"0",
")",
";",
"synchronized",
"(",
"invalidateBlocks",
")",
"{",
"for",
"... | Store block invalidation work. | [
"Store",
"block",
"invalidation",
"work",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java#L493-L500 |
117,705 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java | DatanodeDescriptor.getInvalidateBlocks | BlockCommand getInvalidateBlocks(int maxblocks) {
Block[] deleteList = null;
synchronized (invalidateBlocks) {
deleteList = invalidateBlocks.pollToArray(new Block[Math.min(
invalidateBlocks.size(), maxblocks)]);
}
return (deleteList == null || deleteList.length == 0) ?
null: new... | java | BlockCommand getInvalidateBlocks(int maxblocks) {
Block[] deleteList = null;
synchronized (invalidateBlocks) {
deleteList = invalidateBlocks.pollToArray(new Block[Math.min(
invalidateBlocks.size(), maxblocks)]);
}
return (deleteList == null || deleteList.length == 0) ?
null: new... | [
"BlockCommand",
"getInvalidateBlocks",
"(",
"int",
"maxblocks",
")",
"{",
"Block",
"[",
"]",
"deleteList",
"=",
"null",
";",
"synchronized",
"(",
"invalidateBlocks",
")",
"{",
"deleteList",
"=",
"invalidateBlocks",
".",
"pollToArray",
"(",
"new",
"Block",
"[",
... | Remove the specified number of blocks to be invalidated | [
"Remove",
"the",
"specified",
"number",
"of",
"blocks",
"to",
"be",
"invalidated"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java#L534-L542 |
117,706 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java | DatanodeDescriptor.readFieldsFromFSEditLog | void readFieldsFromFSEditLog(DataInput in) throws IOException {
this.name = UTF8.readString(in);
this.storageID = UTF8.readString(in);
this.infoPort = in.readShort() & 0x0000ffff;
this.capacity = in.readLong();
this.dfsUsed = in.readLong();
this.remaining = in.readLong();
this.lastUpdate = ... | java | void readFieldsFromFSEditLog(DataInput in) throws IOException {
this.name = UTF8.readString(in);
this.storageID = UTF8.readString(in);
this.infoPort = in.readShort() & 0x0000ffff;
this.capacity = in.readLong();
this.dfsUsed = in.readLong();
this.remaining = in.readLong();
this.lastUpdate = ... | [
"void",
"readFieldsFromFSEditLog",
"(",
"DataInput",
"in",
")",
"throws",
"IOException",
"{",
"this",
".",
"name",
"=",
"UTF8",
".",
"readString",
"(",
"in",
")",
";",
"this",
".",
"storageID",
"=",
"UTF8",
".",
"readString",
"(",
"in",
")",
";",
"this",... | Serialization for FSEditLog | [
"Serialization",
"for",
"FSEditLog"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java#L626-L639 |
117,707 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java | DatanodeDescriptor.rollBlocksScheduled | private void rollBlocksScheduled(long now) {
if ((now - lastBlocksScheduledRollTime) >
BLOCKS_SCHEDULED_ROLL_INTERVAL) {
prevApproxBlocksScheduled = currApproxBlocksScheduled;
currApproxBlocksScheduled = 0;
lastBlocksScheduledRollTime = now;
}
} | java | private void rollBlocksScheduled(long now) {
if ((now - lastBlocksScheduledRollTime) >
BLOCKS_SCHEDULED_ROLL_INTERVAL) {
prevApproxBlocksScheduled = currApproxBlocksScheduled;
currApproxBlocksScheduled = 0;
lastBlocksScheduledRollTime = now;
}
} | [
"private",
"void",
"rollBlocksScheduled",
"(",
"long",
"now",
")",
"{",
"if",
"(",
"(",
"now",
"-",
"lastBlocksScheduledRollTime",
")",
">",
"BLOCKS_SCHEDULED_ROLL_INTERVAL",
")",
"{",
"prevApproxBlocksScheduled",
"=",
"currApproxBlocksScheduled",
";",
"currApproxBlocks... | Adjusts curr and prev number of blocks scheduled every few minutes. | [
"Adjusts",
"curr",
"and",
"prev",
"number",
"of",
"blocks",
"scheduled",
"every",
"few",
"minutes",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java#L679-L686 |
117,708 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapreduce/lib/input/InvalidInputException.java | InvalidInputException.getMessage | public String getMessage() {
StringBuffer result = new StringBuffer();
Iterator<IOException> itr = problems.iterator();
while(itr.hasNext()) {
result.append(itr.next().getMessage());
if (itr.hasNext()) {
result.append("\n");
}
}
return result.toString();
} | java | public String getMessage() {
StringBuffer result = new StringBuffer();
Iterator<IOException> itr = problems.iterator();
while(itr.hasNext()) {
result.append(itr.next().getMessage());
if (itr.hasNext()) {
result.append("\n");
}
}
return result.toString();
} | [
"public",
"String",
"getMessage",
"(",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"Iterator",
"<",
"IOException",
">",
"itr",
"=",
"problems",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"itr",
".",
"hasNext",
"(",
... | Get a summary message of the problems found.
@return the concatenated messages from all of the problems. | [
"Get",
"a",
"summary",
"message",
"of",
"the",
"problems",
"found",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/lib/input/InvalidInputException.java#L53-L63 |
117,709 | facebookarchive/hadoop-20 | src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/ImageLibrary.java | ImageLibrary.newImage | private boolean newImage(String name, String filename) {
ImageDescriptor id;
boolean success;
try {
URL fileURL =
FileLocator.find(bundle, new Path(RESOURCE_DIR + filename), null);
id = ImageDescriptor.createFromURL(FileLocator.toFileURL(fileURL));
success = true;
} catch (... | java | private boolean newImage(String name, String filename) {
ImageDescriptor id;
boolean success;
try {
URL fileURL =
FileLocator.find(bundle, new Path(RESOURCE_DIR + filename), null);
id = ImageDescriptor.createFromURL(FileLocator.toFileURL(fileURL));
success = true;
} catch (... | [
"private",
"boolean",
"newImage",
"(",
"String",
"name",
",",
"String",
"filename",
")",
"{",
"ImageDescriptor",
"id",
";",
"boolean",
"success",
";",
"try",
"{",
"URL",
"fileURL",
"=",
"FileLocator",
".",
"find",
"(",
"bundle",
",",
"new",
"Path",
"(",
... | Load and register a new image. If the image resource does not exist or
fails to load, a default "error" resource is supplied.
@param name name of the image
@param filename name of the file containing the image
@return whether the image has correctly been loaded | [
"Load",
"and",
"register",
"a",
"new",
"image",
".",
"If",
"the",
"image",
"resource",
"does",
"not",
"exist",
"or",
"fails",
"to",
"load",
"a",
"default",
"error",
"resource",
"is",
"supplied",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/ImageLibrary.java#L176-L198 |
117,710 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumException.java | QuorumException.create | public static <K, V> QuorumException create(
String simpleMsg,
Map<K, V> successes,
Map<K, Throwable> exceptions) {
Preconditions.checkArgument(!exceptions.isEmpty(),
"Must pass exceptions");
StringBuilder msg = new StringBuilder();
msg.append(simpleMsg).append(". ");
if (... | java | public static <K, V> QuorumException create(
String simpleMsg,
Map<K, V> successes,
Map<K, Throwable> exceptions) {
Preconditions.checkArgument(!exceptions.isEmpty(),
"Must pass exceptions");
StringBuilder msg = new StringBuilder();
msg.append(simpleMsg).append(". ");
if (... | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"QuorumException",
"create",
"(",
"String",
"simpleMsg",
",",
"Map",
"<",
"K",
",",
"V",
">",
"successes",
",",
"Map",
"<",
"K",
",",
"Throwable",
">",
"exceptions",
")",
"{",
"Preconditions",
".",
"checkArg... | Create a QuorumException instance with a descriptive message detailing
the underlying exceptions, as well as any successful responses which
were returned.
@param <K> the keys for the quorum calls
@param <V> the success response type
@param successes any successful responses returned
@param exceptions the exceptions ret... | [
"Create",
"a",
"QuorumException",
"instance",
"with",
"a",
"descriptive",
"message",
"detailing",
"the",
"underlying",
"exceptions",
"as",
"well",
"as",
"any",
"successful",
"responses",
"which",
"were",
"returned",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumException.java#L43-L82 |
117,711 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/DefaultStringifier.java | DefaultStringifier.store | public static <K> void store(Configuration conf, K item, String keyName)
throws IOException {
DefaultStringifier<K> stringifier = new DefaultStringifier<K>(conf,
GenericsUtil.getClass(item));
conf.set(keyName, stringifier.toString(item));
stringifier.close();
} | java | public static <K> void store(Configuration conf, K item, String keyName)
throws IOException {
DefaultStringifier<K> stringifier = new DefaultStringifier<K>(conf,
GenericsUtil.getClass(item));
conf.set(keyName, stringifier.toString(item));
stringifier.close();
} | [
"public",
"static",
"<",
"K",
">",
"void",
"store",
"(",
"Configuration",
"conf",
",",
"K",
"item",
",",
"String",
"keyName",
")",
"throws",
"IOException",
"{",
"DefaultStringifier",
"<",
"K",
">",
"stringifier",
"=",
"new",
"DefaultStringifier",
"<",
"K",
... | Stores the item in the configuration with the given keyName.
@param <K> the class of the item
@param conf the configuration to store
@param item the object to be stored
@param keyName the name of the key to use
@throws IOException : forwards Exceptions from the underlying
{@link Serialization} classes. | [
"Stores",
"the",
"item",
"in",
"the",
"configuration",
"with",
"the",
"given",
"keyName",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/DefaultStringifier.java#L107-L114 |
117,712 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/DefaultStringifier.java | DefaultStringifier.load | public static <K> K load(Configuration conf, String keyName,
Class<K> itemClass) throws IOException {
DefaultStringifier<K> stringifier = new DefaultStringifier<K>(conf,
itemClass);
try {
String itemStr = conf.get(keyName);
return stringifier.fromString(itemStr);
} finally {
... | java | public static <K> K load(Configuration conf, String keyName,
Class<K> itemClass) throws IOException {
DefaultStringifier<K> stringifier = new DefaultStringifier<K>(conf,
itemClass);
try {
String itemStr = conf.get(keyName);
return stringifier.fromString(itemStr);
} finally {
... | [
"public",
"static",
"<",
"K",
">",
"K",
"load",
"(",
"Configuration",
"conf",
",",
"String",
"keyName",
",",
"Class",
"<",
"K",
">",
"itemClass",
")",
"throws",
"IOException",
"{",
"DefaultStringifier",
"<",
"K",
">",
"stringifier",
"=",
"new",
"DefaultStr... | Restores the object from the configuration.
@param <K> the class of the item
@param conf the configuration to use
@param keyName the name of the key to use
@param itemClass the class of the item
@return restored object
@throws IOException : forwards Exceptions from the underlying
{@link Serialization} classes. | [
"Restores",
"the",
"object",
"from",
"the",
"configuration",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/DefaultStringifier.java#L127-L137 |
117,713 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/DefaultStringifier.java | DefaultStringifier.storeArray | public static <K> void storeArray(Configuration conf, K[] items,
String keyName) throws IOException {
DefaultStringifier<K> stringifier = new DefaultStringifier<K>(conf,
GenericsUtil.getClass(items[0]));
try {
StringBuilder builder = new StringBuilder();
for (K item : items) {
... | java | public static <K> void storeArray(Configuration conf, K[] items,
String keyName) throws IOException {
DefaultStringifier<K> stringifier = new DefaultStringifier<K>(conf,
GenericsUtil.getClass(items[0]));
try {
StringBuilder builder = new StringBuilder();
for (K item : items) {
... | [
"public",
"static",
"<",
"K",
">",
"void",
"storeArray",
"(",
"Configuration",
"conf",
",",
"K",
"[",
"]",
"items",
",",
"String",
"keyName",
")",
"throws",
"IOException",
"{",
"DefaultStringifier",
"<",
"K",
">",
"stringifier",
"=",
"new",
"DefaultStringifi... | Stores the array of items in the configuration with the given keyName.
@param <K> the class of the item
@param conf the configuration to use
@param items the objects to be stored
@param keyName the name of the key to use
@throws IndexOutOfBoundsException if the items array is empty
@throws IOException : forwards Excep... | [
"Stores",
"the",
"array",
"of",
"items",
"in",
"the",
"configuration",
"with",
"the",
"given",
"keyName",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/DefaultStringifier.java#L150-L165 |
117,714 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/DefaultStringifier.java | DefaultStringifier.loadArray | public static <K> K[] loadArray(Configuration conf, String keyName,
Class<K> itemClass) throws IOException {
DefaultStringifier<K> stringifier = new DefaultStringifier<K>(conf,
itemClass);
try {
String itemStr = conf.get(keyName);
ArrayList<K> list = new ArrayList<K>();
String[] ... | java | public static <K> K[] loadArray(Configuration conf, String keyName,
Class<K> itemClass) throws IOException {
DefaultStringifier<K> stringifier = new DefaultStringifier<K>(conf,
itemClass);
try {
String itemStr = conf.get(keyName);
ArrayList<K> list = new ArrayList<K>();
String[] ... | [
"public",
"static",
"<",
"K",
">",
"K",
"[",
"]",
"loadArray",
"(",
"Configuration",
"conf",
",",
"String",
"keyName",
",",
"Class",
"<",
"K",
">",
"itemClass",
")",
"throws",
"IOException",
"{",
"DefaultStringifier",
"<",
"K",
">",
"stringifier",
"=",
"... | Restores the array of objects from the configuration.
@param <K> the class of the item
@param conf the configuration to use
@param keyName the name of the key to use
@param itemClass the class of the item
@return restored object
@throws IOException : forwards Exceptions from the underlying
{@link Serialization} classe... | [
"Restores",
"the",
"array",
"of",
"objects",
"from",
"the",
"configuration",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/DefaultStringifier.java#L178-L197 |
117,715 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/INodeFile.java | INodeFile.getBlockReplication | public short getBlockReplication(BlockInfo block) {
if (storage.isSourceBlock(block)) {
return getReplication();
} else {
if (storage.getStorageType() == StorageType.RAID_STORAGE) {
return ((INodeRaidStorage)storage).getCodec().parityReplication;
} else {
throw new IllegalState... | java | public short getBlockReplication(BlockInfo block) {
if (storage.isSourceBlock(block)) {
return getReplication();
} else {
if (storage.getStorageType() == StorageType.RAID_STORAGE) {
return ((INodeRaidStorage)storage).getCodec().parityReplication;
} else {
throw new IllegalState... | [
"public",
"short",
"getBlockReplication",
"(",
"BlockInfo",
"block",
")",
"{",
"if",
"(",
"storage",
".",
"isSourceBlock",
"(",
"block",
")",
")",
"{",
"return",
"getReplication",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"storage",
".",
"getStorageType"... | may have different replication | [
"may",
"have",
"different",
"replication"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/INodeFile.java#L113-L124 |
117,716 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/StandbySafeMode.java | StandbySafeMode.reportRegister | protected void reportRegister(DatanodeID node) {
if (node != null
&& shouldUpdateNodes()) {
if (!liveDatanodes.contains(node)) {
// A new node has checked in, we want to send a ClearPrimary command to
// it as well.
outStandingHeartbeats.add(node);
liveDatanodes.add(nod... | java | protected void reportRegister(DatanodeID node) {
if (node != null
&& shouldUpdateNodes()) {
if (!liveDatanodes.contains(node)) {
// A new node has checked in, we want to send a ClearPrimary command to
// it as well.
outStandingHeartbeats.add(node);
liveDatanodes.add(nod... | [
"protected",
"void",
"reportRegister",
"(",
"DatanodeID",
"node",
")",
"{",
"if",
"(",
"node",
"!=",
"null",
"&&",
"shouldUpdateNodes",
"(",
")",
")",
"{",
"if",
"(",
"!",
"liveDatanodes",
".",
"contains",
"(",
"node",
")",
")",
"{",
"// A new node has che... | Processes a register from the datanode. First, we will
await a heartbeat, and later for a incremental block
report.
@param node
the datanode that has reported | [
"Processes",
"a",
"register",
"from",
"the",
"datanode",
".",
"First",
"we",
"will",
"await",
"a",
"heartbeat",
"and",
"later",
"for",
"a",
"incremental",
"block",
"report",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/StandbySafeMode.java#L111-L121 |
117,717 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/StandbySafeMode.java | StandbySafeMode.reportHeartBeat | protected boolean reportHeartBeat(DatanodeID node) {
if (node != null && shouldUpdateNodes()) {
reportRegister(node);
synchronized(this) {
if (outStandingHeartbeats.remove(node)) {
outStandingReports.add(node);
return true;
}
}
}
return false;
} | java | protected boolean reportHeartBeat(DatanodeID node) {
if (node != null && shouldUpdateNodes()) {
reportRegister(node);
synchronized(this) {
if (outStandingHeartbeats.remove(node)) {
outStandingReports.add(node);
return true;
}
}
}
return false;
} | [
"protected",
"boolean",
"reportHeartBeat",
"(",
"DatanodeID",
"node",
")",
"{",
"if",
"(",
"node",
"!=",
"null",
"&&",
"shouldUpdateNodes",
"(",
")",
")",
"{",
"reportRegister",
"(",
"node",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"ou... | Processes a heartbeat from the datanode and determines whether we should
send a ClearPrimary command to it.
@param node
the datanode that has reported
@return whether or not we should send a ClearPrimary command to this
datanode | [
"Processes",
"a",
"heartbeat",
"from",
"the",
"datanode",
"and",
"determines",
"whether",
"we",
"should",
"send",
"a",
"ClearPrimary",
"command",
"to",
"it",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/StandbySafeMode.java#L142-L153 |
117,718 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/StandbySafeMode.java | StandbySafeMode.reportPrimaryCleared | protected void reportPrimaryCleared(DatanodeID node) {
if (node != null && shouldUpdateNodes()) {
if (outStandingReports.remove(node)) {
LOG.info("Failover: Outstanding reports: " + outStandingReports.size());
}
}
} | java | protected void reportPrimaryCleared(DatanodeID node) {
if (node != null && shouldUpdateNodes()) {
if (outStandingReports.remove(node)) {
LOG.info("Failover: Outstanding reports: " + outStandingReports.size());
}
}
} | [
"protected",
"void",
"reportPrimaryCleared",
"(",
"DatanodeID",
"node",
")",
"{",
"if",
"(",
"node",
"!=",
"null",
"&&",
"shouldUpdateNodes",
"(",
")",
")",
"{",
"if",
"(",
"outStandingReports",
".",
"remove",
"(",
"node",
")",
")",
"{",
"LOG",
".",
"inf... | Report that the given datanode has cleared the primary.
It is fully aware of the failover, and it has sent the
incremental block report.
@param node
the datanode that has reported | [
"Report",
"that",
"the",
"given",
"datanode",
"has",
"cleared",
"the",
"primary",
".",
"It",
"is",
"fully",
"aware",
"of",
"the",
"failover",
"and",
"it",
"has",
"sent",
"the",
"incremental",
"block",
"report",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/StandbySafeMode.java#L163-L169 |
117,719 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/StandbySafeMode.java | StandbySafeMode.triggerFailover | protected void triggerFailover() throws IOException {
clearDataStructures();
// stop sending PREPARE_FAILOVER command
// we are performing failover now
prepareFailover = false;
for (DatanodeInfo node : namesystem.datanodeReport(DatanodeReportType.LIVE)) {
liveDatanodes.add(node);
... | java | protected void triggerFailover() throws IOException {
clearDataStructures();
// stop sending PREPARE_FAILOVER command
// we are performing failover now
prepareFailover = false;
for (DatanodeInfo node : namesystem.datanodeReport(DatanodeReportType.LIVE)) {
liveDatanodes.add(node);
... | [
"protected",
"void",
"triggerFailover",
"(",
")",
"throws",
"IOException",
"{",
"clearDataStructures",
"(",
")",
";",
"// stop sending PREPARE_FAILOVER command",
"// we are performing failover now",
"prepareFailover",
"=",
"false",
";",
"for",
"(",
"DatanodeInfo",
"node",
... | Triggers failover processing for safe mode and blocks until we have left
safe mode.
@throws IOException | [
"Triggers",
"failover",
"processing",
"for",
"safe",
"mode",
"and",
"blocks",
"until",
"we",
"have",
"left",
"safe",
"mode",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/StandbySafeMode.java#L177-L203 |
117,720 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/StandbySafeMode.java | StandbySafeMode.datanodeReportsReceived | private synchronized boolean datanodeReportsReceived(boolean checkDatanodes) {
try {
boolean received = this.getDatanodeReportRatio() >=
this.outStandingReportThreshold;
if (!received && checkDatanodes) {
checkDatanodes();
return this.getDatanodeReportRatio() >= this.outStandingR... | java | private synchronized boolean datanodeReportsReceived(boolean checkDatanodes) {
try {
boolean received = this.getDatanodeReportRatio() >=
this.outStandingReportThreshold;
if (!received && checkDatanodes) {
checkDatanodes();
return this.getDatanodeReportRatio() >= this.outStandingR... | [
"private",
"synchronized",
"boolean",
"datanodeReportsReceived",
"(",
"boolean",
"checkDatanodes",
")",
"{",
"try",
"{",
"boolean",
"received",
"=",
"this",
".",
"getDatanodeReportRatio",
"(",
")",
">=",
"this",
".",
"outStandingReportThreshold",
";",
"if",
"(",
"... | Checks if the datanode reports have been received
@param checkDatanodes whether it should actively remove dead datanodes
@return true if the datanode reports have been received | [
"Checks",
"if",
"the",
"datanode",
"reports",
"have",
"been",
"received"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/StandbySafeMode.java#L518-L531 |
117,721 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/conf/NameSpaceAddressManager.java | NameSpaceAddressManager.setPrimary | public void setPrimary(InstanceId ofPrimary) throws IOException {
if (ofPrimary == null) {
// failover in progress
primaryNode = null;
standbyNode = null;
return;
}
switch (ofPrimary) {
case NODEZERO:
primaryNode = getNodeZero();
standbyNode = getNodeOne();
... | java | public void setPrimary(InstanceId ofPrimary) throws IOException {
if (ofPrimary == null) {
// failover in progress
primaryNode = null;
standbyNode = null;
return;
}
switch (ofPrimary) {
case NODEZERO:
primaryNode = getNodeZero();
standbyNode = getNodeOne();
... | [
"public",
"void",
"setPrimary",
"(",
"InstanceId",
"ofPrimary",
")",
"throws",
"IOException",
"{",
"if",
"(",
"ofPrimary",
"==",
"null",
")",
"{",
"// failover in progress",
"primaryNode",
"=",
"null",
";",
"standbyNode",
"=",
"null",
";",
"return",
";",
"}",
... | The purpose of this method is to update in memory references to primary
and standby. Please override this method and do the zookeeper specific
logic in the method and call this method on successful zookeeper write. | [
"The",
"purpose",
"of",
"this",
"method",
"is",
"to",
"update",
"in",
"memory",
"references",
"to",
"primary",
"and",
"standby",
".",
"Please",
"override",
"this",
"method",
"and",
"do",
"the",
"zookeeper",
"specific",
"logic",
"in",
"the",
"method",
"and",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/conf/NameSpaceAddressManager.java#L61-L76 |
117,722 | facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/conf/NameSpaceAddressManager.java | NameSpaceAddressManager.setConfSource | public void setConfSource(Configurable src) {
validateConfigFile(src.getConf());
confSrc = src;
zkClient = new AvatarZooKeeperClient(confSrc.getConf(), null, true);
} | java | public void setConfSource(Configurable src) {
validateConfigFile(src.getConf());
confSrc = src;
zkClient = new AvatarZooKeeperClient(confSrc.getConf(), null, true);
} | [
"public",
"void",
"setConfSource",
"(",
"Configurable",
"src",
")",
"{",
"validateConfigFile",
"(",
"src",
".",
"getConf",
"(",
")",
")",
";",
"confSrc",
"=",
"src",
";",
"zkClient",
"=",
"new",
"AvatarZooKeeperClient",
"(",
"confSrc",
".",
"getConf",
"(",
... | Sets the backing configuration source | [
"Sets",
"the",
"backing",
"configuration",
"source"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/conf/NameSpaceAddressManager.java#L93-L97 |
117,723 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java | LookasideCache.addCache | void addCache(Path hdfsPath, Path localPath, long size) throws IOException {
localMetrics.numAdd++;
CacheEntry c = new CacheEntry(hdfsPath, localPath, size);
CacheEntry found = cacheMap.putIfAbsent(hdfsPath, c);
if (found != null) {
// If entry was already in the cache, update its timestamp
... | java | void addCache(Path hdfsPath, Path localPath, long size) throws IOException {
localMetrics.numAdd++;
CacheEntry c = new CacheEntry(hdfsPath, localPath, size);
CacheEntry found = cacheMap.putIfAbsent(hdfsPath, c);
if (found != null) {
// If entry was already in the cache, update its timestamp
... | [
"void",
"addCache",
"(",
"Path",
"hdfsPath",
",",
"Path",
"localPath",
",",
"long",
"size",
")",
"throws",
"IOException",
"{",
"localMetrics",
".",
"numAdd",
"++",
";",
"CacheEntry",
"c",
"=",
"new",
"CacheEntry",
"(",
"hdfsPath",
",",
"localPath",
",",
"s... | Adds an entry into the cache.
The size is the virtual size of this entry. | [
"Adds",
"an",
"entry",
"into",
"the",
"cache",
".",
"The",
"size",
"is",
"the",
"virtual",
"size",
"of",
"this",
"entry",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java#L199-L227 |
117,724 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java | LookasideCache.renameCache | void renameCache(Path oldhdfsPath, Path newhdfsPath,
Path localPath) throws IOException {
CacheEntry found = cacheMap.remove(oldhdfsPath);
if (found == null) {
String msg = "LookasideCache error renaming path: " + oldhdfsPath +
" to: " + newhdfsPath +
" Path " + n... | java | void renameCache(Path oldhdfsPath, Path newhdfsPath,
Path localPath) throws IOException {
CacheEntry found = cacheMap.remove(oldhdfsPath);
if (found == null) {
String msg = "LookasideCache error renaming path: " + oldhdfsPath +
" to: " + newhdfsPath +
" Path " + n... | [
"void",
"renameCache",
"(",
"Path",
"oldhdfsPath",
",",
"Path",
"newhdfsPath",
",",
"Path",
"localPath",
")",
"throws",
"IOException",
"{",
"CacheEntry",
"found",
"=",
"cacheMap",
".",
"remove",
"(",
"oldhdfsPath",
")",
";",
"if",
"(",
"found",
"==",
"null",... | Change the localPath in the cache. The size remains the
same. The accesstime is updated. | [
"Change",
"the",
"localPath",
"in",
"the",
"cache",
".",
"The",
"size",
"remains",
"the",
"same",
".",
"The",
"accesstime",
"is",
"updated",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java#L233-L265 |
117,725 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java | LookasideCache.removeCache | void removeCache(Path hdfsPath) {
CacheEntry c = cacheMap.remove(hdfsPath);
if (c != null) {
cacheSize.addAndGet(-c.entrySize);
localMetrics.numRemove++;
if (LOG.isDebugEnabled()) {
LOG.debug("LookasideCache removed path:" + hdfsPath +
" freed up size: " + c.entrySize... | java | void removeCache(Path hdfsPath) {
CacheEntry c = cacheMap.remove(hdfsPath);
if (c != null) {
cacheSize.addAndGet(-c.entrySize);
localMetrics.numRemove++;
if (LOG.isDebugEnabled()) {
LOG.debug("LookasideCache removed path:" + hdfsPath +
" freed up size: " + c.entrySize... | [
"void",
"removeCache",
"(",
"Path",
"hdfsPath",
")",
"{",
"CacheEntry",
"c",
"=",
"cacheMap",
".",
"remove",
"(",
"hdfsPath",
")",
";",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"cacheSize",
".",
"addAndGet",
"(",
"-",
"c",
".",
"entrySize",
")",
";",
... | Delete an entry from the cache. | [
"Delete",
"an",
"entry",
"from",
"the",
"cache",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java#L270-L280 |
117,726 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java | LookasideCache.evictCache | void evictCache(Path hdfsPath) throws IOException {
CacheEntry c = cacheMap.remove(hdfsPath);
if (c != null) {
cacheSize.addAndGet(-c.entrySize);
if (evictionIface != null) {
evictionIface.evictCache(c.hdfsPath, c.localPath, c.entrySize);
}
localMetrics.numEvict++;
if (LOG.... | java | void evictCache(Path hdfsPath) throws IOException {
CacheEntry c = cacheMap.remove(hdfsPath);
if (c != null) {
cacheSize.addAndGet(-c.entrySize);
if (evictionIface != null) {
evictionIface.evictCache(c.hdfsPath, c.localPath, c.entrySize);
}
localMetrics.numEvict++;
if (LOG.... | [
"void",
"evictCache",
"(",
"Path",
"hdfsPath",
")",
"throws",
"IOException",
"{",
"CacheEntry",
"c",
"=",
"cacheMap",
".",
"remove",
"(",
"hdfsPath",
")",
";",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"cacheSize",
".",
"addAndGet",
"(",
"-",
"c",
".",
... | Evicts an entry from the cache. This calls back into
the application to indicate that a cache entry has been
reclaimed. | [
"Evicts",
"an",
"entry",
"from",
"the",
"cache",
".",
"This",
"calls",
"back",
"into",
"the",
"application",
"to",
"indicate",
"that",
"a",
"cache",
"entry",
"has",
"been",
"reclaimed",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java#L287-L300 |
117,727 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java | LookasideCache.getCache | Path getCache(Path hdfsPath) {
CacheEntry c = cacheMap.get(hdfsPath);
localMetrics.numGetAttempts++;
if (c != null) {
// update the accessTime before returning to caller
c.setGenstamp(globalStamp.incrementAndGet());
localMetrics.numGetHits++;
return c.localPath;
}
return null... | java | Path getCache(Path hdfsPath) {
CacheEntry c = cacheMap.get(hdfsPath);
localMetrics.numGetAttempts++;
if (c != null) {
// update the accessTime before returning to caller
c.setGenstamp(globalStamp.incrementAndGet());
localMetrics.numGetHits++;
return c.localPath;
}
return null... | [
"Path",
"getCache",
"(",
"Path",
"hdfsPath",
")",
"{",
"CacheEntry",
"c",
"=",
"cacheMap",
".",
"get",
"(",
"hdfsPath",
")",
";",
"localMetrics",
".",
"numGetAttempts",
"++",
";",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"// update the accessTime before retur... | Maps the hdfs pathname to a local pathname. Returns null
if this is not found in the cache. | [
"Maps",
"the",
"hdfs",
"pathname",
"to",
"a",
"local",
"pathname",
".",
"Returns",
"null",
"if",
"this",
"is",
"not",
"found",
"in",
"the",
"cache",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java#L306-L316 |
117,728 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java | LookasideCache.checkEvict | synchronized void checkEvict() throws IOException {
if (cacheSize.get() < cacheSizeMax) {
return; // nothing to do, plenty of free space
}
// Only one thread should be doing the eviction. Do not block
// current thread, it is ok to oversubscribe the cache size
// temporarily.
if (e... | java | synchronized void checkEvict() throws IOException {
if (cacheSize.get() < cacheSizeMax) {
return; // nothing to do, plenty of free space
}
// Only one thread should be doing the eviction. Do not block
// current thread, it is ok to oversubscribe the cache size
// temporarily.
if (e... | [
"synchronized",
"void",
"checkEvict",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"cacheSize",
".",
"get",
"(",
")",
"<",
"cacheSizeMax",
")",
"{",
"return",
";",
"// nothing to do, plenty of free space",
"}",
"// Only one thread should be doing the eviction. Do ... | Eviction occurs if the cache is full, we free up a specified
percentage of the cache on every run. This method is synchronized
so that only one thread is doing the eviction. | [
"Eviction",
"occurs",
"if",
"the",
"cache",
"is",
"full",
"we",
"free",
"up",
"a",
"specified",
"percentage",
"of",
"the",
"cache",
"on",
"every",
"run",
".",
"This",
"method",
"is",
"synchronized",
"so",
"that",
"only",
"one",
"thread",
"is",
"doing",
"... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/LookasideCache.java#L323-L372 |
117,729 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.getSecureRandom | public synchronized static Random getSecureRandom() {
if (cachedSecureRandom != null)
return cachedSecureRandom;
try {
return SecureRandom.getInstance("SHA1PRNG");
} catch (NoSuchAlgorithmException e) {
return R;
}
} | java | public synchronized static Random getSecureRandom() {
if (cachedSecureRandom != null)
return cachedSecureRandom;
try {
return SecureRandom.getInstance("SHA1PRNG");
} catch (NoSuchAlgorithmException e) {
return R;
}
} | [
"public",
"synchronized",
"static",
"Random",
"getSecureRandom",
"(",
")",
"{",
"if",
"(",
"cachedSecureRandom",
"!=",
"null",
")",
"return",
"cachedSecureRandom",
";",
"try",
"{",
"return",
"SecureRandom",
".",
"getInstance",
"(",
"\"SHA1PRNG\"",
")",
";",
"}",... | get an instance of a SecureRandom for creating storageid | [
"get",
"an",
"instance",
"of",
"a",
"SecureRandom",
"for",
"creating",
"storageid"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L203-L211 |
117,730 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.initGlobalSetting | protected void initGlobalSetting(Configuration conf,
AbstractList<File> dataDirs) throws IOException {
this.dataDirs = dataDirs;
this.conf = conf;
storage = new DataStorage(this);
// global DN settings
initConfig(conf);
registerMXBean();
initDataXceiver(conf);
startInfoServer(... | java | protected void initGlobalSetting(Configuration conf,
AbstractList<File> dataDirs) throws IOException {
this.dataDirs = dataDirs;
this.conf = conf;
storage = new DataStorage(this);
// global DN settings
initConfig(conf);
registerMXBean();
initDataXceiver(conf);
startInfoServer(... | [
"protected",
"void",
"initGlobalSetting",
"(",
"Configuration",
"conf",
",",
"AbstractList",
"<",
"File",
">",
"dataDirs",
")",
"throws",
"IOException",
"{",
"this",
".",
"dataDirs",
"=",
"dataDirs",
";",
"this",
".",
"conf",
"=",
"conf",
";",
"storage",
"="... | Initialize global settings for DN | [
"Initialize",
"global",
"settings",
"for",
"DN"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L355-L373 |
117,731 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.initDataSetAndScanner | protected void initDataSetAndScanner(Configuration conf,
AbstractList<File> dataDirs, int numOfNameSpaces) throws IOException {
initFsDataSet(conf, dataDirs, numOfNameSpaces);
initDataBlockScanner(conf);
initDirectoryScanner(conf);
} | java | protected void initDataSetAndScanner(Configuration conf,
AbstractList<File> dataDirs, int numOfNameSpaces) throws IOException {
initFsDataSet(conf, dataDirs, numOfNameSpaces);
initDataBlockScanner(conf);
initDirectoryScanner(conf);
} | [
"protected",
"void",
"initDataSetAndScanner",
"(",
"Configuration",
"conf",
",",
"AbstractList",
"<",
"File",
">",
"dataDirs",
",",
"int",
"numOfNameSpaces",
")",
"throws",
"IOException",
"{",
"initFsDataSet",
"(",
"conf",
",",
"dataDirs",
",",
"numOfNameSpaces",
... | Initialize dataset and block scanner
@param conf Configuration
@param dataDirs data directories
@param numOfNameSpaces number of name spaces
@throws IOException | [
"Initialize",
"dataset",
"and",
"block",
"scanner"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L383-L388 |
117,732 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.startDataNode | void startDataNode(Configuration conf,
AbstractList<File> dataDirs
) throws IOException {
initGlobalSetting(conf, dataDirs);
/* Initialize namespace manager */
List<InetSocketAddress> nameNodeAddrs = DFSUtil.getNNServiceRpcAddresses(conf);
//TODO this... | java | void startDataNode(Configuration conf,
AbstractList<File> dataDirs
) throws IOException {
initGlobalSetting(conf, dataDirs);
/* Initialize namespace manager */
List<InetSocketAddress> nameNodeAddrs = DFSUtil.getNNServiceRpcAddresses(conf);
//TODO this... | [
"void",
"startDataNode",
"(",
"Configuration",
"conf",
",",
"AbstractList",
"<",
"File",
">",
"dataDirs",
")",
"throws",
"IOException",
"{",
"initGlobalSetting",
"(",
"conf",
",",
"dataDirs",
")",
";",
"/* Initialize namespace manager */",
"List",
"<",
"InetSocketAd... | This method starts the data node with the specified conf.
@param conf - the configuration
if conf's CONFIG_PROPERTY_SIMULATED property is set
then a simulated storage based data node is created.
@param dataDirs - only for a non-simulated storage data node
@throws IOException | [
"This",
"method",
"starts",
"the",
"data",
"node",
"with",
"the",
"specified",
"conf",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L426-L440 |
117,733 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.getNameNodeAddress | public static InetSocketAddress getNameNodeAddress(Configuration conf) {
InetSocketAddress addr = null;
addr = NameNode.getDNProtocolAddress(conf);
if (addr != null) {
return addr;
}
return NameNode.getClientProtocolAddress(conf);
} | java | public static InetSocketAddress getNameNodeAddress(Configuration conf) {
InetSocketAddress addr = null;
addr = NameNode.getDNProtocolAddress(conf);
if (addr != null) {
return addr;
}
return NameNode.getClientProtocolAddress(conf);
} | [
"public",
"static",
"InetSocketAddress",
"getNameNodeAddress",
"(",
"Configuration",
"conf",
")",
"{",
"InetSocketAddress",
"addr",
"=",
"null",
";",
"addr",
"=",
"NameNode",
".",
"getDNProtocolAddress",
"(",
"conf",
")",
";",
"if",
"(",
"addr",
"!=",
"null",
... | This method returns the address namenode uses to communicate with
datanodes. If this address is not configured the default NameNode
address is used, as it is running only one RPC server.
If it is running multiple servers this address cannot be used by clients!!
Note: If DataNodeProtocolAddress isn't configured, we fa... | [
"This",
"method",
"returns",
"the",
"address",
"namenode",
"uses",
"to",
"communicate",
"with",
"datanodes",
".",
"If",
"this",
"address",
"is",
"not",
"configured",
"the",
"default",
"NameNode",
"address",
"is",
"used",
"as",
"it",
"is",
"running",
"only",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L644-L651 |
117,734 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.getNSNamenode | public DatanodeProtocol getNSNamenode(int namespaceId) throws IOException {
NamespaceService nsos = namespaceManager.get(namespaceId);
if(nsos == null || nsos.getDatanodeProtocol() == null) {
throw new IOException("cannot find a namnode proxy for namespaceId=" + namespaceId);
}
return nsos.getData... | java | public DatanodeProtocol getNSNamenode(int namespaceId) throws IOException {
NamespaceService nsos = namespaceManager.get(namespaceId);
if(nsos == null || nsos.getDatanodeProtocol() == null) {
throw new IOException("cannot find a namnode proxy for namespaceId=" + namespaceId);
}
return nsos.getData... | [
"public",
"DatanodeProtocol",
"getNSNamenode",
"(",
"int",
"namespaceId",
")",
"throws",
"IOException",
"{",
"NamespaceService",
"nsos",
"=",
"namespaceManager",
".",
"get",
"(",
"namespaceId",
")",
";",
"if",
"(",
"nsos",
"==",
"null",
"||",
"nsos",
".",
"get... | Get namenode corresponding to a namespace
@param namespaceId
@return Namenode corresponding to the namespace
@throws IOException | [
"Get",
"namenode",
"corresponding",
"to",
"a",
"namespace"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L664-L670 |
117,735 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.getDNRegistrationForNS | public DatanodeRegistration getDNRegistrationForNS(int namespaceId)
throws IOException {
NamespaceService nsos = namespaceManager.get(namespaceId);
if(nsos==null || nsos.getNsRegistration()==null) {
throw new IOException("cannot find NSOfferService for namespaceId="+namespaceId);
}
return nsos.... | java | public DatanodeRegistration getDNRegistrationForNS(int namespaceId)
throws IOException {
NamespaceService nsos = namespaceManager.get(namespaceId);
if(nsos==null || nsos.getNsRegistration()==null) {
throw new IOException("cannot find NSOfferService for namespaceId="+namespaceId);
}
return nsos.... | [
"public",
"DatanodeRegistration",
"getDNRegistrationForNS",
"(",
"int",
"namespaceId",
")",
"throws",
"IOException",
"{",
"NamespaceService",
"nsos",
"=",
"namespaceManager",
".",
"get",
"(",
"namespaceId",
")",
";",
"if",
"(",
"nsos",
"==",
"null",
"||",
"nsos",
... | get datanode registration by namespace id
@param namespaceId
@return datanode registration object
@throws IOException | [
"get",
"datanode",
"registration",
"by",
"namespace",
"id"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L690-L697 |
117,736 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.shutdown | public void shutdown() {
if (this.shuttingDown.getAndSet(true)) {
// Already being shut down
LOG.warn("DataNode.shutdown() was called while shutting down.");
return;
}
if (infoServer != null) {
try {
infoServer.stop();
} catch (Exception e) {
LOG.warn("Exception... | java | public void shutdown() {
if (this.shuttingDown.getAndSet(true)) {
// Already being shut down
LOG.warn("DataNode.shutdown() was called while shutting down.");
return;
}
if (infoServer != null) {
try {
infoServer.stop();
} catch (Exception e) {
LOG.warn("Exception... | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"if",
"(",
"this",
".",
"shuttingDown",
".",
"getAndSet",
"(",
"true",
")",
")",
"{",
"// Already being shut down",
"LOG",
".",
"warn",
"(",
"\"DataNode.shutdown() was called while shutting down.\"",
")",
";",
"return",... | Shut down this instance of the datanode.
Returns only after shutdown is complete.
This method can only be called by the offerService thread.
Otherwise, deadlock might occur. | [
"Shut",
"down",
"this",
"instance",
"of",
"the",
"datanode",
".",
"Returns",
"only",
"after",
"shutdown",
"is",
"complete",
".",
"This",
"method",
"can",
"only",
"be",
"called",
"by",
"the",
"offerService",
"thread",
".",
"Otherwise",
"deadlock",
"might",
"o... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L743-L822 |
117,737 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.checkDiskError | protected void checkDiskError(Exception e ) throws IOException {
if (e instanceof ClosedByInterruptException
|| e instanceof java.io.InterruptedIOException) {
return;
}
LOG.warn("checkDiskError: exception: ", e);
if (e.getMessage() != null &&
e.getMessage().startsWith("No spac... | java | protected void checkDiskError(Exception e ) throws IOException {
if (e instanceof ClosedByInterruptException
|| e instanceof java.io.InterruptedIOException) {
return;
}
LOG.warn("checkDiskError: exception: ", e);
if (e.getMessage() != null &&
e.getMessage().startsWith("No spac... | [
"protected",
"void",
"checkDiskError",
"(",
"Exception",
"e",
")",
"throws",
"IOException",
"{",
"if",
"(",
"e",
"instanceof",
"ClosedByInterruptException",
"||",
"e",
"instanceof",
"java",
".",
"io",
".",
"InterruptedIOException",
")",
"{",
"return",
";",
"}",
... | Check if there is no space in disk
@param e that caused this checkDiskError call | [
"Check",
"if",
"there",
"is",
"no",
"space",
"in",
"disk"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L828-L841 |
117,738 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.checkDiskError | protected void checkDiskError( ) throws IOException{
// We disallow concurrent disk checks as it doesn't help
// but can significantly impact performance and reliability of
// the system.
//
boolean setSuccess = checkingDisk.compareAndSet(false, true);
if (!setSuccess) {
LOG.info("checkDis... | java | protected void checkDiskError( ) throws IOException{
// We disallow concurrent disk checks as it doesn't help
// but can significantly impact performance and reliability of
// the system.
//
boolean setSuccess = checkingDisk.compareAndSet(false, true);
if (!setSuccess) {
LOG.info("checkDis... | [
"protected",
"void",
"checkDiskError",
"(",
")",
"throws",
"IOException",
"{",
"// We disallow concurrent disk checks as it doesn't help",
"// but can significantly impact performance and reliability of",
"// the system.",
"//",
"boolean",
"setSuccess",
"=",
"checkingDisk",
".",
"c... | Check if there is a disk failure and if so, handle the error | [
"Check",
"if",
"there",
"is",
"a",
"disk",
"failure",
"and",
"if",
"so",
"handle",
"the",
"error"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L847-L874 |
117,739 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.getListOfDataDirs | public static String[] getListOfDataDirs(Configuration conf) {
String[] configFilePath = conf.getStrings("dfs.datadir.confpath");
String[] dataDirs = null;
if(configFilePath != null && (configFilePath.length != 0)) {
try {
DataDirFileReader reader = new DataDirFileReader(configFilePath[0]);
... | java | public static String[] getListOfDataDirs(Configuration conf) {
String[] configFilePath = conf.getStrings("dfs.datadir.confpath");
String[] dataDirs = null;
if(configFilePath != null && (configFilePath.length != 0)) {
try {
DataDirFileReader reader = new DataDirFileReader(configFilePath[0]);
... | [
"public",
"static",
"String",
"[",
"]",
"getListOfDataDirs",
"(",
"Configuration",
"conf",
")",
"{",
"String",
"[",
"]",
"configFilePath",
"=",
"conf",
".",
"getStrings",
"(",
"\"dfs.datadir.confpath\"",
")",
";",
"String",
"[",
"]",
"dataDirs",
"=",
"null",
... | Returns a list of data directories from the file provided by the
dfs.datadir.confpath. If it cannot get the list of data directories
then the method will return the default dataDirs from dfs.data.dir. | [
"Returns",
"a",
"list",
"of",
"data",
"directories",
"from",
"the",
"file",
"provided",
"by",
"the",
"dfs",
".",
"datadir",
".",
"confpath",
".",
"If",
"it",
"cannot",
"get",
"the",
"list",
"of",
"data",
"directories",
"then",
"the",
"method",
"will",
"r... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L2370-L2393 |
117,740 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.createDataNode | public static DataNode createDataNode(String args[], Configuration conf)
throws IOException {
DataNode dn = instantiateDataNode(args, conf);
if (dn != null) {
dn.runDatanodeDaemon();
}
return dn;
} | java | public static DataNode createDataNode(String args[], Configuration conf)
throws IOException {
DataNode dn = instantiateDataNode(args, conf);
if (dn != null) {
dn.runDatanodeDaemon();
}
return dn;
} | [
"public",
"static",
"DataNode",
"createDataNode",
"(",
"String",
"args",
"[",
"]",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"DataNode",
"dn",
"=",
"instantiateDataNode",
"(",
"args",
",",
"conf",
")",
";",
"if",
"(",
"dn",
"!=",
"nu... | Instantiate & Start a single datanode daemon and wait for it to finish.
If this thread is specifically interrupted, it will stop waiting. | [
"Instantiate",
"&",
"Start",
"a",
"single",
"datanode",
"daemon",
"and",
"wait",
"for",
"it",
"to",
"finish",
".",
"If",
"this",
"thread",
"is",
"specifically",
"interrupted",
"it",
"will",
"stop",
"waiting",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L2398-L2405 |
117,741 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.getNamenodeAddresses | @Override // DataNodeMXBean
public String getNamenodeAddresses() {
final Map<String, Integer> info = new HashMap<String, Integer>();
for (NamespaceService ns : namespaceManager.getAllNamenodeThreads()) {
if (ns != null && ns.initialized()) {
info.put(ns.getNNSocketAddress().getAddress().getHostA... | java | @Override // DataNodeMXBean
public String getNamenodeAddresses() {
final Map<String, Integer> info = new HashMap<String, Integer>();
for (NamespaceService ns : namespaceManager.getAllNamenodeThreads()) {
if (ns != null && ns.initialized()) {
info.put(ns.getNNSocketAddress().getAddress().getHostA... | [
"@",
"Override",
"// DataNodeMXBean",
"public",
"String",
"getNamenodeAddresses",
"(",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Integer",
">",
"info",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"NamespaceSer... | Returned information is a JSON representation of a map with
name node host name as the key and block pool Id as the value | [
"Returned",
"information",
"is",
"a",
"JSON",
"representation",
"of",
"a",
"map",
"with",
"name",
"node",
"host",
"name",
"as",
"the",
"key",
"and",
"block",
"pool",
"Id",
"as",
"the",
"value"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L3299-L3308 |
117,742 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.getVolumeInfo | @Override // DataNodeMXBean
public String getVolumeInfo() {
final Map<String, Object> info = new HashMap<String, Object>();
try {
FSVolume[] volumes = ((FSDataset)this.data).volumes.getVolumes();
for (FSVolume v : volumes) {
final Map<String, Object> innerInfo = new HashMap<String, Object>... | java | @Override // DataNodeMXBean
public String getVolumeInfo() {
final Map<String, Object> info = new HashMap<String, Object>();
try {
FSVolume[] volumes = ((FSDataset)this.data).volumes.getVolumes();
for (FSVolume v : volumes) {
final Map<String, Object> innerInfo = new HashMap<String, Object>... | [
"@",
"Override",
"// DataNodeMXBean",
"public",
"String",
"getVolumeInfo",
"(",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"info",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"try",
"{",
"FSVolume",
"[",
"... | Returned information is a JSON representation of a map with
volume name as the key and value is a map of volume attribute
keys to its values | [
"Returned",
"information",
"is",
"a",
"JSON",
"representation",
"of",
"a",
"map",
"with",
"volume",
"name",
"as",
"the",
"key",
"and",
"value",
"is",
"a",
"map",
"of",
"volume",
"attribute",
"keys",
"to",
"its",
"values"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L3315-L3332 |
117,743 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java | DataNode.sendBlocksBeingWrittenReport | public void sendBlocksBeingWrittenReport(DatanodeProtocol node,
int namespaceId, DatanodeRegistration nsRegistration) throws IOException {
Block[] blocks = data.getBlocksBeingWrittenReport(namespaceId);
if (blocks != null && blocks.length != 0) {
long[] blocksAsLong =
BlockListAsLongs.conver... | java | public void sendBlocksBeingWrittenReport(DatanodeProtocol node,
int namespaceId, DatanodeRegistration nsRegistration) throws IOException {
Block[] blocks = data.getBlocksBeingWrittenReport(namespaceId);
if (blocks != null && blocks.length != 0) {
long[] blocksAsLong =
BlockListAsLongs.conver... | [
"public",
"void",
"sendBlocksBeingWrittenReport",
"(",
"DatanodeProtocol",
"node",
",",
"int",
"namespaceId",
",",
"DatanodeRegistration",
"nsRegistration",
")",
"throws",
"IOException",
"{",
"Block",
"[",
"]",
"blocks",
"=",
"data",
".",
"getBlocksBeingWrittenReport",
... | Sends a 'Blocks Being Written' report to the given node.
@param node the node to send the report to
@throws IOException | [
"Sends",
"a",
"Blocks",
"Being",
"Written",
"report",
"to",
"the",
"given",
"node",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L3359-L3368 |
117,744 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java | BlockPlacementPolicyConfigurable.randomIntInWindow | protected int randomIntInWindow(int begin, int windowSize, int n,
Set<Integer> excludeSet) {
final int size = Math.min(windowSize, n);
if (size <= 0) {
return -1;
}
int adjustment = 0;
for (Integer v: excludeSet) {
int vindex = (v.intValue() - begin + n) % n;
if (vindex < ... | java | protected int randomIntInWindow(int begin, int windowSize, int n,
Set<Integer> excludeSet) {
final int size = Math.min(windowSize, n);
if (size <= 0) {
return -1;
}
int adjustment = 0;
for (Integer v: excludeSet) {
int vindex = (v.intValue() - begin + n) % n;
if (vindex < ... | [
"protected",
"int",
"randomIntInWindow",
"(",
"int",
"begin",
",",
"int",
"windowSize",
",",
"int",
"n",
",",
"Set",
"<",
"Integer",
">",
"excludeSet",
")",
"{",
"final",
"int",
"size",
"=",
"Math",
".",
"min",
"(",
"windowSize",
",",
"n",
")",
";",
... | returns a random integer within a modular window taking into consideration
a sorted list of nodes to be excluded. | [
"returns",
"a",
"random",
"integer",
"within",
"a",
"modular",
"window",
"taking",
"into",
"consideration",
"a",
"sorted",
"list",
"of",
"nodes",
"to",
"be",
"excluded",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java#L232-L266 |
117,745 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java | BlockPlacementPolicyConfigurable.chooseTarget | @Override
public DatanodeDescriptor[] chooseTarget(FSInodeInfo srcInode,
int numOfReplicas,
DatanodeDescriptor writer, List<DatanodeDescriptor> chosenNodes,
List<Node> excludesNodes, long blocksize) {
if (numOfReplicas == 0 || clusterMap.getNumOfLeaves() == 0) {
return new DatanodeDescript... | java | @Override
public DatanodeDescriptor[] chooseTarget(FSInodeInfo srcInode,
int numOfReplicas,
DatanodeDescriptor writer, List<DatanodeDescriptor> chosenNodes,
List<Node> excludesNodes, long blocksize) {
if (numOfReplicas == 0 || clusterMap.getNumOfLeaves() == 0) {
return new DatanodeDescript... | [
"@",
"Override",
"public",
"DatanodeDescriptor",
"[",
"]",
"chooseTarget",
"(",
"FSInodeInfo",
"srcInode",
",",
"int",
"numOfReplicas",
",",
"DatanodeDescriptor",
"writer",
",",
"List",
"<",
"DatanodeDescriptor",
">",
"chosenNodes",
",",
"List",
"<",
"Node",
">",
... | This method is currently used only for re-replication and should be used
only for this. If this method is used for normal block placements that
would completely break this placement policy. | [
"This",
"method",
"is",
"currently",
"used",
"only",
"for",
"re",
"-",
"replication",
"and",
"should",
"be",
"used",
"only",
"for",
"this",
".",
"If",
"this",
"method",
"is",
"used",
"for",
"normal",
"block",
"placements",
"that",
"would",
"completely",
"b... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java#L273-L301 |
117,746 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java | BlockPlacementPolicyConfigurable.chooseFirstInRemoteRack | protected void chooseFirstInRemoteRack(DatanodeDescriptor localMachine,
HashMap<Node, Node> excludedNodes, long blocksize,
int maxReplicasPerRack, List<DatanodeDescriptor> results)
throws NotEnoughReplicasException {
readLock();
try {
RackRingInfo rackInfo = racksMap.get(localMachine.get... | java | protected void chooseFirstInRemoteRack(DatanodeDescriptor localMachine,
HashMap<Node, Node> excludedNodes, long blocksize,
int maxReplicasPerRack, List<DatanodeDescriptor> results)
throws NotEnoughReplicasException {
readLock();
try {
RackRingInfo rackInfo = racksMap.get(localMachine.get... | [
"protected",
"void",
"chooseFirstInRemoteRack",
"(",
"DatanodeDescriptor",
"localMachine",
",",
"HashMap",
"<",
"Node",
",",
"Node",
">",
"excludedNodes",
",",
"long",
"blocksize",
",",
"int",
"maxReplicasPerRack",
",",
"List",
"<",
"DatanodeDescriptor",
">",
"resul... | Picks up the first replica stored in a remote rack.
@param localMachine local machine that is writing the data
@param excludedNodes nodes that should not be considered
@param blocksize size of blocks
@param maxReplicasPerRack maximum replicas per rack
@param results datanodes used for replicas
@throws NotEnoughReplicas... | [
"Picks",
"up",
"the",
"first",
"replica",
"stored",
"in",
"a",
"remote",
"rack",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java#L359-L382 |
117,747 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java | BlockPlacementPolicyConfigurable.findBestWithFirst | private void findBestWithFirst(DatanodeDescriptor first,
List<DatanodeDescriptor> listOfNodes, DatanodeDescriptor[] result) {
for (int in2 = 0; in2 < listOfNodes.size(); in2++) {
DatanodeDescriptor n2 = listOfNodes.get(in2);
if (!first.equals(n2)) {
if (result[1] == null && inWindow(first,... | java | private void findBestWithFirst(DatanodeDescriptor first,
List<DatanodeDescriptor> listOfNodes, DatanodeDescriptor[] result) {
for (int in2 = 0; in2 < listOfNodes.size(); in2++) {
DatanodeDescriptor n2 = listOfNodes.get(in2);
if (!first.equals(n2)) {
if (result[1] == null && inWindow(first,... | [
"private",
"void",
"findBestWithFirst",
"(",
"DatanodeDescriptor",
"first",
",",
"List",
"<",
"DatanodeDescriptor",
">",
"listOfNodes",
",",
"DatanodeDescriptor",
"[",
"]",
"result",
")",
"{",
"for",
"(",
"int",
"in2",
"=",
"0",
";",
"in2",
"<",
"listOfNodes",... | Function that finds the best partial triple including a first replica
@param first first replica to be used
@param listOfNodes nodes to choose from
@param result array that stores results | [
"Function",
"that",
"finds",
"the",
"best",
"partial",
"triple",
"including",
"a",
"first",
"replica"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java#L418-L440 |
117,748 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java | BlockPlacementPolicyConfigurable.inWindow | private boolean inWindow(DatanodeDescriptor first, DatanodeDescriptor testing) {
readLock();
try {
RackRingInfo rackInfo = racksMap.get(first.getNetworkLocation());
assert (rackInfo != null);
Integer machineId = rackInfo.findNode(first);
assert (machineId != null);
final int rac... | java | private boolean inWindow(DatanodeDescriptor first, DatanodeDescriptor testing) {
readLock();
try {
RackRingInfo rackInfo = racksMap.get(first.getNetworkLocation());
assert (rackInfo != null);
Integer machineId = rackInfo.findNode(first);
assert (machineId != null);
final int rac... | [
"private",
"boolean",
"inWindow",
"(",
"DatanodeDescriptor",
"first",
",",
"DatanodeDescriptor",
"testing",
")",
"{",
"readLock",
"(",
")",
";",
"try",
"{",
"RackRingInfo",
"rackInfo",
"=",
"racksMap",
".",
"get",
"(",
"first",
".",
"getNetworkLocation",
"(",
... | Verifies if testing node is within right windows of first node
@param first first node being considered
@param testing node we are testing to check if it is within window or not
@return We return true if it is successful, and not otherwise | [
"Verifies",
"if",
"testing",
"node",
"is",
"within",
"right",
"windows",
"of",
"first",
"node"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java#L448-L489 |
117,749 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java | BlockPlacementPolicyConfigurable.inWindow | private boolean inWindow(DatanodeDescriptor first,
DatanodeDescriptor testing1, DatanodeDescriptor testing2) {
readLock();
try {
if (!testing1.getNetworkLocation().equals(testing2.getNetworkLocation())) {
return false;
}
RackRingInfo rackInfo = racksMap.get(first.getNetworkLoca... | java | private boolean inWindow(DatanodeDescriptor first,
DatanodeDescriptor testing1, DatanodeDescriptor testing2) {
readLock();
try {
if (!testing1.getNetworkLocation().equals(testing2.getNetworkLocation())) {
return false;
}
RackRingInfo rackInfo = racksMap.get(first.getNetworkLoca... | [
"private",
"boolean",
"inWindow",
"(",
"DatanodeDescriptor",
"first",
",",
"DatanodeDescriptor",
"testing1",
",",
"DatanodeDescriptor",
"testing2",
")",
"{",
"readLock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"testing1",
".",
"getNetworkLocation",
"(",
")",
... | Verifies if testing nodes are within right windows of first node
@param first first node being considered
@param testing1 node we are testing to check if it is within window or not
@param testing2 node we are testing to check if it is within window or not
@return We return true if it is successful, and not otherwise | [
"Verifies",
"if",
"testing",
"nodes",
"are",
"within",
"right",
"windows",
"of",
"first",
"node"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java#L498-L566 |
117,750 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java | BlockPlacementPolicyConfigurable.findBestWithoutFirst | private void findBestWithoutFirst(List<DatanodeDescriptor> listOfNodes,
DatanodeDescriptor[] result) {
readLock();
try {
for (int in2 = 0; in2 < listOfNodes.size(); in2++) {
DatanodeDescriptor n2 = listOfNodes.get(in2);
for (int in3 = in2 + 1; in3 < listOfNodes.size(); in3++) {
... | java | private void findBestWithoutFirst(List<DatanodeDescriptor> listOfNodes,
DatanodeDescriptor[] result) {
readLock();
try {
for (int in2 = 0; in2 < listOfNodes.size(); in2++) {
DatanodeDescriptor n2 = listOfNodes.get(in2);
for (int in3 = in2 + 1; in3 < listOfNodes.size(); in3++) {
... | [
"private",
"void",
"findBestWithoutFirst",
"(",
"List",
"<",
"DatanodeDescriptor",
">",
"listOfNodes",
",",
"DatanodeDescriptor",
"[",
"]",
"result",
")",
"{",
"readLock",
"(",
")",
";",
"try",
"{",
"for",
"(",
"int",
"in2",
"=",
"0",
";",
"in2",
"<",
"l... | Finds best match considering only the remote nodes.
@param listOfNodes Datanodes to choose from
@param result Array containing results | [
"Finds",
"best",
"match",
"considering",
"only",
"the",
"remote",
"nodes",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java#L572-L608 |
117,751 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java | BlockPlacementPolicyConfigurable.chooseRemoteRack | protected boolean chooseRemoteRack(int rackIdx, int firstRack, int rackWindow,
int machineIdx, int windowSize, HashMap<Node, Node> excludedNodes,
long blocksize, int maxReplicasPerRack, List<DatanodeDescriptor> results,
boolean reverse) throws NotEnoughReplicasException {
// randomly choose one no... | java | protected boolean chooseRemoteRack(int rackIdx, int firstRack, int rackWindow,
int machineIdx, int windowSize, HashMap<Node, Node> excludedNodes,
long blocksize, int maxReplicasPerRack, List<DatanodeDescriptor> results,
boolean reverse) throws NotEnoughReplicasException {
// randomly choose one no... | [
"protected",
"boolean",
"chooseRemoteRack",
"(",
"int",
"rackIdx",
",",
"int",
"firstRack",
",",
"int",
"rackWindow",
",",
"int",
"machineIdx",
",",
"int",
"windowSize",
",",
"HashMap",
"<",
"Node",
",",
"Node",
">",
"excludedNodes",
",",
"long",
"blocksize",
... | Picks up a remote machine within defined window
@param rackIdx rack the request is coming from and that should be avoided
@param firstRack rack that starts window
@param rackWindow rack window size
@param machineIdx index of first replica within its rack
@param windowSize size of the machine window
@param excludedNodes... | [
"Picks",
"up",
"a",
"remote",
"machine",
"within",
"defined",
"window"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java#L732-L777 |
117,752 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java | BlockPlacementPolicyConfigurable.chooseMachine | protected boolean chooseMachine(String rack, int firstMachine, int windowSize,
HashMap<Node, Node> excludedNodes, long blocksize,
int maxReplicasPerRack, List<DatanodeDescriptor> results) {
readLock();
try {
HashSet<Integer> excludedMachines = new HashSet<Integer>();
RackRingInfo rackIn... | java | protected boolean chooseMachine(String rack, int firstMachine, int windowSize,
HashMap<Node, Node> excludedNodes, long blocksize,
int maxReplicasPerRack, List<DatanodeDescriptor> results) {
readLock();
try {
HashSet<Integer> excludedMachines = new HashSet<Integer>();
RackRingInfo rackIn... | [
"protected",
"boolean",
"chooseMachine",
"(",
"String",
"rack",
",",
"int",
"firstMachine",
",",
"int",
"windowSize",
",",
"HashMap",
"<",
"Node",
",",
"Node",
">",
"excludedNodes",
",",
"long",
"blocksize",
",",
"int",
"maxReplicasPerRack",
",",
"List",
"<",
... | Chosses a machine within a window inside a rack
@param rack rack to choose from
@param firstMachine machine that starts window
@param windowSize size of machine window
@param excludedNodes nodes to avoid
@param blocksize size of a block
@param maxReplicasPerRack maximum number of replicas within the same rack
@param re... | [
"Chosses",
"a",
"machine",
"within",
"a",
"window",
"inside",
"a",
"rack"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java#L790-L841 |
117,753 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/ResourceTypeCounter.java | ResourceTypeCounter.incr | public void incr(ResourceType resourceType) {
Integer current = typeToCountMap.get(resourceType);
if (current == null) {
typeToCountMap.put(resourceType, new Integer(1));
} else {
typeToCountMap.put(resourceType, current + 1);
}
} | java | public void incr(ResourceType resourceType) {
Integer current = typeToCountMap.get(resourceType);
if (current == null) {
typeToCountMap.put(resourceType, new Integer(1));
} else {
typeToCountMap.put(resourceType, current + 1);
}
} | [
"public",
"void",
"incr",
"(",
"ResourceType",
"resourceType",
")",
"{",
"Integer",
"current",
"=",
"typeToCountMap",
".",
"get",
"(",
"resourceType",
")",
";",
"if",
"(",
"current",
"==",
"null",
")",
"{",
"typeToCountMap",
".",
"put",
"(",
"resourceType",
... | Increment the count for a given resource type
@param resourceType Resource type to increment the count of | [
"Increment",
"the",
"count",
"for",
"a",
"given",
"resource",
"type"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/ResourceTypeCounter.java#L35-L42 |
117,754 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/ResourceTypeCounter.java | ResourceTypeCounter.getCount | public Integer getCount(ResourceType resourceType) {
Integer count = typeToCountMap.get(resourceType);
if (count == null) {
return 0;
} else {
return count;
}
} | java | public Integer getCount(ResourceType resourceType) {
Integer count = typeToCountMap.get(resourceType);
if (count == null) {
return 0;
} else {
return count;
}
} | [
"public",
"Integer",
"getCount",
"(",
"ResourceType",
"resourceType",
")",
"{",
"Integer",
"count",
"=",
"typeToCountMap",
".",
"get",
"(",
"resourceType",
")",
";",
"if",
"(",
"count",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"else",
"{",
"retur... | Return the count of the ResourceType
@param resourceType
@return Count of the resource type | [
"Return",
"the",
"count",
"of",
"the",
"ResourceType"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/ResourceTypeCounter.java#L49-L56 |
117,755 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/SequentialNumber.java | SequentialNumber.skipTo | public synchronized void skipTo(final long newValue) throws IllegalStateException {
if (newValue < currentValue) {
throw new IllegalStateException(
"Cannot skip to less than the current value (="
+ currentValue + "), where newValue=" + newValue);
}
currentValue = newValue;
} | java | public synchronized void skipTo(final long newValue) throws IllegalStateException {
if (newValue < currentValue) {
throw new IllegalStateException(
"Cannot skip to less than the current value (="
+ currentValue + "), where newValue=" + newValue);
}
currentValue = newValue;
} | [
"public",
"synchronized",
"void",
"skipTo",
"(",
"final",
"long",
"newValue",
")",
"throws",
"IllegalStateException",
"{",
"if",
"(",
"newValue",
"<",
"currentValue",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot skip to less than the current value (... | Skip to the new value. | [
"Skip",
"to",
"the",
"new",
"value",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/SequentialNumber.java#L51-L58 |
117,756 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/raid/RaidCodec.java | RaidCodec.addCodec | static void addCodec(RaidCodec codec) {
List<RaidCodec> newCodecs = new ArrayList<RaidCodec>();
newCodecs.addAll(codecs);
newCodecs.add(codec);
codecs = Collections.unmodifiableList(newCodecs);
Map<String, RaidCodec> newIdToCodec = new HashMap<String, RaidCodec>();
newIdToCodec.putAll(idToCodec... | java | static void addCodec(RaidCodec codec) {
List<RaidCodec> newCodecs = new ArrayList<RaidCodec>();
newCodecs.addAll(codecs);
newCodecs.add(codec);
codecs = Collections.unmodifiableList(newCodecs);
Map<String, RaidCodec> newIdToCodec = new HashMap<String, RaidCodec>();
newIdToCodec.putAll(idToCodec... | [
"static",
"void",
"addCodec",
"(",
"RaidCodec",
"codec",
")",
"{",
"List",
"<",
"RaidCodec",
">",
"newCodecs",
"=",
"new",
"ArrayList",
"<",
"RaidCodec",
">",
"(",
")",
";",
"newCodecs",
".",
"addAll",
"(",
"codecs",
")",
";",
"newCodecs",
".",
"add",
... | Used by unit test only | [
"Used",
"by",
"unit",
"test",
"only"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/raid/RaidCodec.java#L242-L252 |
117,757 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/raid/RaidCodec.java | RaidCodec.getSourceBlocks | public BlockInfo[] getSourceBlocks(BlockInfo[] blocks) {
int numSourceBlocks = blocks.length -
(blocks.length / numStripeBlocks) * numParityBlocks -
((blocks.length % numStripeBlocks == 0) ? 0 : numParityBlocks);
BlockInfo[] sourceBlocks = new BlockInfo[numSourceBlocks];
int pos = numParit... | java | public BlockInfo[] getSourceBlocks(BlockInfo[] blocks) {
int numSourceBlocks = blocks.length -
(blocks.length / numStripeBlocks) * numParityBlocks -
((blocks.length % numStripeBlocks == 0) ? 0 : numParityBlocks);
BlockInfo[] sourceBlocks = new BlockInfo[numSourceBlocks];
int pos = numParit... | [
"public",
"BlockInfo",
"[",
"]",
"getSourceBlocks",
"(",
"BlockInfo",
"[",
"]",
"blocks",
")",
"{",
"int",
"numSourceBlocks",
"=",
"blocks",
".",
"length",
"-",
"(",
"blocks",
".",
"length",
"/",
"numStripeBlocks",
")",
"*",
"numParityBlocks",
"-",
"(",
"(... | Return only the source blocks of the raided file | [
"Return",
"only",
"the",
"source",
"blocks",
"of",
"the",
"raided",
"file"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/raid/RaidCodec.java#L286-L302 |
117,758 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/raid/RaidCodec.java | RaidCodec.getParityBlocks | public BlockInfo[] getParityBlocks(BlockInfo[] blocks) {
int numBlocks = (blocks.length / numStripeBlocks) * numParityBlocks
+ ((blocks.length % numStripeBlocks == 0) ? 0 : numParityBlocks);
BlockInfo[] parityBlocks = new BlockInfo[numBlocks];
int pos = 0;
int parityEnd = numParityBlocks;
fo... | java | public BlockInfo[] getParityBlocks(BlockInfo[] blocks) {
int numBlocks = (blocks.length / numStripeBlocks) * numParityBlocks
+ ((blocks.length % numStripeBlocks == 0) ? 0 : numParityBlocks);
BlockInfo[] parityBlocks = new BlockInfo[numBlocks];
int pos = 0;
int parityEnd = numParityBlocks;
fo... | [
"public",
"BlockInfo",
"[",
"]",
"getParityBlocks",
"(",
"BlockInfo",
"[",
"]",
"blocks",
")",
"{",
"int",
"numBlocks",
"=",
"(",
"blocks",
".",
"length",
"/",
"numStripeBlocks",
")",
"*",
"numParityBlocks",
"+",
"(",
"(",
"blocks",
".",
"length",
"%",
"... | Return only the parity blocks of the raided file | [
"Return",
"only",
"the",
"parity",
"blocks",
"of",
"the",
"raided",
"file"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/raid/RaidCodec.java#L306-L321 |
117,759 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/raid/RaidCodec.java | RaidCodec.checkRaidProgress | public boolean checkRaidProgress(INodeFile sourceINode,
LightWeightLinkedSet<RaidBlockInfo> raidEncodingTasks, FSNamesystem fs,
boolean forceAdd) throws IOException {
boolean result = true;
BlockInfo[] blocks = sourceINode.getBlocks();
for (int i = 0; i < blocks.length;
i += numStripeBl... | java | public boolean checkRaidProgress(INodeFile sourceINode,
LightWeightLinkedSet<RaidBlockInfo> raidEncodingTasks, FSNamesystem fs,
boolean forceAdd) throws IOException {
boolean result = true;
BlockInfo[] blocks = sourceINode.getBlocks();
for (int i = 0; i < blocks.length;
i += numStripeBl... | [
"public",
"boolean",
"checkRaidProgress",
"(",
"INodeFile",
"sourceINode",
",",
"LightWeightLinkedSet",
"<",
"RaidBlockInfo",
">",
"raidEncodingTasks",
",",
"FSNamesystem",
"fs",
",",
"boolean",
"forceAdd",
")",
"throws",
"IOException",
"{",
"boolean",
"result",
"=",
... | Count the number of live replicas of each parity block in the raided file
If any stripe has not enough parity block replicas, add the stripe to
raidEncodingTasks to schedule encoding.
If forceAdd is true, we always add the stripe to raidEncodingTasks
without checking
@param sourceINode
@param raidTasks
@param fs
@param... | [
"Count",
"the",
"number",
"of",
"live",
"replicas",
"of",
"each",
"parity",
"block",
"in",
"the",
"raided",
"file",
"If",
"any",
"stripe",
"has",
"not",
"enough",
"parity",
"block",
"replicas",
"add",
"the",
"stripe",
"to",
"raidEncodingTasks",
"to",
"schedu... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/raid/RaidCodec.java#L421-L443 |
117,760 | facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderPreTransactional.java | ServerLogReaderPreTransactional.handleNullRead | private void handleNullRead() throws IOException {
if (curStreamFinished && readNullAfterStreamFinished) {
// If we read a null operation after the NameNode closed
// the stream, then we surely reached the end of the file.
curStreamConsumed = true;
} else {
try {
// This affects ... | java | private void handleNullRead() throws IOException {
if (curStreamFinished && readNullAfterStreamFinished) {
// If we read a null operation after the NameNode closed
// the stream, then we surely reached the end of the file.
curStreamConsumed = true;
} else {
try {
// This affects ... | [
"private",
"void",
"handleNullRead",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"curStreamFinished",
"&&",
"readNullAfterStreamFinished",
")",
"{",
"// If we read a null operation after the NameNode closed",
"// the stream, then we surely reached the end of the file.",
"cur... | Called after we read a null operation from the transaction log.
@throws IOException when a fatal error occurred. | [
"Called",
"after",
"we",
"read",
"a",
"null",
"operation",
"from",
"the",
"transaction",
"log",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderPreTransactional.java#L181-L199 |
117,761 | facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderPreTransactional.java | ServerLogReaderPreTransactional.tryReloadingEditLog | private void tryReloadingEditLog() throws IOException {
LOG.info("Trying to reload the edit log ...");
// The roll image count is 1 after edits.new was renamed to edits
if (rollImageCount.get() == 1) {
try {
LOG.info("Trying to reload the edit log from " +
editsFile.getAbsolutePath... | java | private void tryReloadingEditLog() throws IOException {
LOG.info("Trying to reload the edit log ...");
// The roll image count is 1 after edits.new was renamed to edits
if (rollImageCount.get() == 1) {
try {
LOG.info("Trying to reload the edit log from " +
editsFile.getAbsolutePath... | [
"private",
"void",
"tryReloadingEditLog",
"(",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"info",
"(",
"\"Trying to reload the edit log ...\"",
")",
";",
"// The roll image count is 1 after edits.new was renamed to edits",
"if",
"(",
"rollImageCount",
".",
"get",
"(",
... | Tries to fully reload the edit log.
@throws IOException if a fatal error occurred. | [
"Tries",
"to",
"fully",
"reload",
"the",
"edit",
"log",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderPreTransactional.java#L233-L264 |
117,762 | facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderPreTransactional.java | ServerLogReaderPreTransactional.trySwitchingEditLog | private void trySwitchingEditLog() throws IOException {
if (shouldSwitchEditLog()) {
curStreamFinished = true;
if (LOG.isDebugEnabled()) {
LOG.debug("Should switch edit log. rollImageCount=" + rollImageCount +
". curStreamConsumed=" + curStreamConsumed);
}
if (curS... | java | private void trySwitchingEditLog() throws IOException {
if (shouldSwitchEditLog()) {
curStreamFinished = true;
if (LOG.isDebugEnabled()) {
LOG.debug("Should switch edit log. rollImageCount=" + rollImageCount +
". curStreamConsumed=" + curStreamConsumed);
}
if (curS... | [
"private",
"void",
"trySwitchingEditLog",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"shouldSwitchEditLog",
"(",
")",
")",
"{",
"curStreamFinished",
"=",
"true",
";",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",... | Tries to switch from the previous transaction file to the new one.
It ensures that no notifications are missed. If there is a possibility
that the current transaction log file has more notifications to be read,
then it will keep the current stream intact.
@throws IOException if a fatal error occurred. | [
"Tries",
"to",
"switch",
"from",
"the",
"previous",
"transaction",
"file",
"to",
"the",
"new",
"one",
".",
"It",
"ensures",
"that",
"no",
"notifications",
"are",
"missed",
".",
"If",
"there",
"is",
"a",
"possibility",
"that",
"the",
"current",
"transaction",... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderPreTransactional.java#L275-L291 |
117,763 | facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderPreTransactional.java | ServerLogReaderPreTransactional.openInputStream | private void openInputStream(File txFile) throws IOException {
int ioExceptionRetryCount = 0, logHeaderCorruptRetryCount = 0;
LOG.info("Trying to load the edit log from " + txFile.getAbsolutePath());
do {
try {
inputStream = new EditLogFileInputStream(txFile);
editLogFilePosi... | java | private void openInputStream(File txFile) throws IOException {
int ioExceptionRetryCount = 0, logHeaderCorruptRetryCount = 0;
LOG.info("Trying to load the edit log from " + txFile.getAbsolutePath());
do {
try {
inputStream = new EditLogFileInputStream(txFile);
editLogFilePosi... | [
"private",
"void",
"openInputStream",
"(",
"File",
"txFile",
")",
"throws",
"IOException",
"{",
"int",
"ioExceptionRetryCount",
"=",
"0",
",",
"logHeaderCorruptRetryCount",
"=",
"0",
";",
"LOG",
".",
"info",
"(",
"\"Trying to load the edit log from \"",
"+",
"txFile... | Tries opening the input stream.
@param txFile the file from which to load the input stream
@throws IOException If the input stream couldn't be loaded. This error
is fatal. | [
"Tries",
"opening",
"the",
"input",
"stream",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderPreTransactional.java#L348-L394 |
117,764 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.getLocalCache | public static Path getLocalCache(URI cache, Configuration conf, Path subdir,
FileStatus fileStatus, boolean isArchive, long confFileStamp, Path
currentWorkDir, boolean honorSymLinkConf, MRAsyncDiskService
asyncDiskService, LocalDirAllocator lDirAllocator)
throws IOException {
return getLocalCach... | java | public static Path getLocalCache(URI cache, Configuration conf, Path subdir,
FileStatus fileStatus, boolean isArchive, long confFileStamp, Path
currentWorkDir, boolean honorSymLinkConf, MRAsyncDiskService
asyncDiskService, LocalDirAllocator lDirAllocator)
throws IOException {
return getLocalCach... | [
"public",
"static",
"Path",
"getLocalCache",
"(",
"URI",
"cache",
",",
"Configuration",
"conf",
",",
"Path",
"subdir",
",",
"FileStatus",
"fileStatus",
",",
"boolean",
"isArchive",
",",
"long",
"confFileStamp",
",",
"Path",
"currentWorkDir",
",",
"boolean",
"hon... | Added for back compatibility. | [
"Added",
"for",
"back",
"compatibility",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L193-L201 |
117,765 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.releaseCache | public static void releaseCache(URI cache, Configuration conf, long timeStamp)
throws IOException {
String cacheId = getKey(cache, conf, timeStamp);
synchronized (cachedArchives) {
CacheStatus lcacheStatus = cachedArchives.get(cacheId);
if (lcacheStatus == null) {
LOG.warn("Cannot find ... | java | public static void releaseCache(URI cache, Configuration conf, long timeStamp)
throws IOException {
String cacheId = getKey(cache, conf, timeStamp);
synchronized (cachedArchives) {
CacheStatus lcacheStatus = cachedArchives.get(cacheId);
if (lcacheStatus == null) {
LOG.warn("Cannot find ... | [
"public",
"static",
"void",
"releaseCache",
"(",
"URI",
"cache",
",",
"Configuration",
"conf",
",",
"long",
"timeStamp",
")",
"throws",
"IOException",
"{",
"String",
"cacheId",
"=",
"getKey",
"(",
"cache",
",",
"conf",
",",
"timeStamp",
")",
";",
"synchroniz... | This is the opposite of getlocalcache. When you are done with
using the cache, you need to release the cache
@param cache The cache URI to be released
@param conf configuration which contains the filesystem the cache
is contained in.
@throws IOException | [
"This",
"is",
"the",
"opposite",
"of",
"getlocalcache",
".",
"When",
"you",
"are",
"done",
"with",
"using",
"the",
"cache",
"you",
"need",
"to",
"release",
"the",
"cache"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L377-L390 |
117,766 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.deleteCache | private static void deleteCache(Configuration conf,
MRAsyncDiskService asyncDiskService) throws IOException {
List<CacheStatus> deleteSet = new LinkedList<CacheStatus>();
// try deleting cache Status with refcount of zero
synchronized (cachedArchives) {
for (Iterator<String> it = cachedArchives.... | java | private static void deleteCache(Configuration conf,
MRAsyncDiskService asyncDiskService) throws IOException {
List<CacheStatus> deleteSet = new LinkedList<CacheStatus>();
// try deleting cache Status with refcount of zero
synchronized (cachedArchives) {
for (Iterator<String> it = cachedArchives.... | [
"private",
"static",
"void",
"deleteCache",
"(",
"Configuration",
"conf",
",",
"MRAsyncDiskService",
"asyncDiskService",
")",
"throws",
"IOException",
"{",
"List",
"<",
"CacheStatus",
">",
"deleteSet",
"=",
"new",
"LinkedList",
"<",
"CacheStatus",
">",
"(",
")",
... | To delete the caches which have a refcount of zero | [
"To",
"delete",
"the",
"caches",
"which",
"have",
"a",
"refcount",
"of",
"zero"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L428-L451 |
117,767 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.deleteLocalPath | private static void deleteLocalPath(MRAsyncDiskService asyncDiskService,
LocalFileSystem fs, Path path) throws IOException {
boolean deleted = false;
if (asyncDiskService != null) {
// Try to delete using asyncDiskService
String localPathToDelete =
path.toUri().getPath();
deleted... | java | private static void deleteLocalPath(MRAsyncDiskService asyncDiskService,
LocalFileSystem fs, Path path) throws IOException {
boolean deleted = false;
if (asyncDiskService != null) {
// Try to delete using asyncDiskService
String localPathToDelete =
path.toUri().getPath();
deleted... | [
"private",
"static",
"void",
"deleteLocalPath",
"(",
"MRAsyncDiskService",
"asyncDiskService",
",",
"LocalFileSystem",
"fs",
",",
"Path",
"path",
")",
"throws",
"IOException",
"{",
"boolean",
"deleted",
"=",
"false",
";",
"if",
"(",
"asyncDiskService",
"!=",
"null... | Delete a local path with asyncDiskService if available,
or otherwise synchronously with local file system. | [
"Delete",
"a",
"local",
"path",
"with",
"asyncDiskService",
"if",
"available",
"or",
"otherwise",
"synchronously",
"with",
"local",
"file",
"system",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L457-L475 |
117,768 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.localizeCache | private static Path localizeCache(Configuration conf,
URI cache, long confFileStamp,
CacheStatus cacheStatus,
boolean isArchive)
throws IOException {
FileSystem fs = getFileSystem(cache, conf);
FileSyst... | java | private static Path localizeCache(Configuration conf,
URI cache, long confFileStamp,
CacheStatus cacheStatus,
boolean isArchive)
throws IOException {
FileSystem fs = getFileSystem(cache, conf);
FileSyst... | [
"private",
"static",
"Path",
"localizeCache",
"(",
"Configuration",
"conf",
",",
"URI",
"cache",
",",
"long",
"confFileStamp",
",",
"CacheStatus",
"cacheStatus",
",",
"boolean",
"isArchive",
")",
"throws",
"IOException",
"{",
"FileSystem",
"fs",
"=",
"getFileSyste... | and does chmod for the files | [
"and",
"does",
"chmod",
"for",
"the",
"files"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L546-L600 |
117,769 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.ifExistsAndFresh | private static boolean ifExistsAndFresh(Configuration conf, FileSystem fs,
URI cache, long confFileStamp,
CacheStatus lcacheStatus,
FileStatus fileStatus)
throws IOException {
// check for... | java | private static boolean ifExistsAndFresh(Configuration conf, FileSystem fs,
URI cache, long confFileStamp,
CacheStatus lcacheStatus,
FileStatus fileStatus)
throws IOException {
// check for... | [
"private",
"static",
"boolean",
"ifExistsAndFresh",
"(",
"Configuration",
"conf",
",",
"FileSystem",
"fs",
",",
"URI",
"cache",
",",
"long",
"confFileStamp",
",",
"CacheStatus",
"lcacheStatus",
",",
"FileStatus",
"fileStatus",
")",
"throws",
"IOException",
"{",
"/... | Checks if the cache has already been localized and is fresh | [
"Checks",
"if",
"the",
"cache",
"has",
"already",
"been",
"localized",
"and",
"is",
"fresh"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L608-L634 |
117,770 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.getTimestamp | public static long getTimestamp(Configuration conf, URI cache)
throws IOException {
FileSystem fileSystem = FileSystem.get(cache, conf);
Path filePath = new Path(cache.getPath());
return fileSystem.getFileStatus(filePath).getModificationTime();
} | java | public static long getTimestamp(Configuration conf, URI cache)
throws IOException {
FileSystem fileSystem = FileSystem.get(cache, conf);
Path filePath = new Path(cache.getPath());
return fileSystem.getFileStatus(filePath).getModificationTime();
} | [
"public",
"static",
"long",
"getTimestamp",
"(",
"Configuration",
"conf",
",",
"URI",
"cache",
")",
"throws",
"IOException",
"{",
"FileSystem",
"fileSystem",
"=",
"FileSystem",
".",
"get",
"(",
"cache",
",",
"conf",
")",
";",
"Path",
"filePath",
"=",
"new",
... | Returns mtime of a given cache file on hdfs.
@param conf configuration
@param cache cache file
@return mtime of a given cache file on hdfs
@throws IOException | [
"Returns",
"mtime",
"of",
"a",
"given",
"cache",
"file",
"on",
"hdfs",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L643-L649 |
117,771 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.createAllSymlink | public static void createAllSymlink(Configuration conf, File jobCacheDir, File
workDir)
throws IOException{
if ((jobCacheDir == null || !jobCacheDir.isDirectory()) ||
workDir == null || (!workDir.isDirectory())) {
return;
}
boolean createSymlink = getSymlink(conf);
if (createS... | java | public static void createAllSymlink(Configuration conf, File jobCacheDir, File
workDir)
throws IOException{
if ((jobCacheDir == null || !jobCacheDir.isDirectory()) ||
workDir == null || (!workDir.isDirectory())) {
return;
}
boolean createSymlink = getSymlink(conf);
if (createS... | [
"public",
"static",
"void",
"createAllSymlink",
"(",
"Configuration",
"conf",
",",
"File",
"jobCacheDir",
",",
"File",
"workDir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"jobCacheDir",
"==",
"null",
"||",
"!",
"jobCacheDir",
".",
"isDirectory",
"(",... | This method create symlinks for all files in a given dir in another
directory
@param conf the configuration
@param jobCacheDir the target directory for creating symlinks
@param workDir the directory in which the symlinks are created
@throws IOException | [
"This",
"method",
"create",
"symlinks",
"for",
"all",
"files",
"in",
"a",
"given",
"dir",
"in",
"another",
"directory"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L674-L689 |
117,772 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.setCacheArchives | public static void setCacheArchives(URI[] archives, Configuration conf) {
String sarchives = StringUtils.uriToString(archives);
conf.set("mapred.cache.archives", sarchives);
} | java | public static void setCacheArchives(URI[] archives, Configuration conf) {
String sarchives = StringUtils.uriToString(archives);
conf.set("mapred.cache.archives", sarchives);
} | [
"public",
"static",
"void",
"setCacheArchives",
"(",
"URI",
"[",
"]",
"archives",
",",
"Configuration",
"conf",
")",
"{",
"String",
"sarchives",
"=",
"StringUtils",
".",
"uriToString",
"(",
"archives",
")",
";",
"conf",
".",
"set",
"(",
"\"mapred.cache.archive... | Set the configuration with the given set of archives
@param archives The list of archives that need to be localized
@param conf Configuration which will be changed | [
"Set",
"the",
"configuration",
"with",
"the",
"given",
"set",
"of",
"archives"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L716-L719 |
117,773 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.setCacheFiles | public static void setCacheFiles(URI[] files, Configuration conf) {
String sfiles = StringUtils.uriToString(files);
conf.set("mapred.cache.files", sfiles);
} | java | public static void setCacheFiles(URI[] files, Configuration conf) {
String sfiles = StringUtils.uriToString(files);
conf.set("mapred.cache.files", sfiles);
} | [
"public",
"static",
"void",
"setCacheFiles",
"(",
"URI",
"[",
"]",
"files",
",",
"Configuration",
"conf",
")",
"{",
"String",
"sfiles",
"=",
"StringUtils",
".",
"uriToString",
"(",
"files",
")",
";",
"conf",
".",
"set",
"(",
"\"mapred.cache.files\"",
",",
... | Set the configuration with the given set of files
@param files The list of files that need to be localized
@param conf Configuration which will be changed | [
"Set",
"the",
"configuration",
"with",
"the",
"given",
"set",
"of",
"files"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L726-L729 |
117,774 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.addCacheArchive | public static void addCacheArchive(URI uri, Configuration conf) {
String archives = conf.get("mapred.cache.archives");
conf.set("mapred.cache.archives", archives == null ? uri.toString()
: archives + "," + uri.toString());
} | java | public static void addCacheArchive(URI uri, Configuration conf) {
String archives = conf.get("mapred.cache.archives");
conf.set("mapred.cache.archives", archives == null ? uri.toString()
: archives + "," + uri.toString());
} | [
"public",
"static",
"void",
"addCacheArchive",
"(",
"URI",
"uri",
",",
"Configuration",
"conf",
")",
"{",
"String",
"archives",
"=",
"conf",
".",
"get",
"(",
"\"mapred.cache.archives\"",
")",
";",
"conf",
".",
"set",
"(",
"\"mapred.cache.archives\"",
",",
"arc... | Add a archives to be localized to the conf
@param uri The uri of the cache to be localized
@param conf Configuration to add the cache to | [
"Add",
"a",
"archives",
"to",
"be",
"localized",
"to",
"the",
"conf"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L923-L927 |
117,775 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.addCacheFile | public static void addCacheFile(URI uri, Configuration conf) {
String files = conf.get("mapred.cache.files");
conf.set("mapred.cache.files", files == null ? uri.toString() : files + ","
+ uri.toString());
} | java | public static void addCacheFile(URI uri, Configuration conf) {
String files = conf.get("mapred.cache.files");
conf.set("mapred.cache.files", files == null ? uri.toString() : files + ","
+ uri.toString());
} | [
"public",
"static",
"void",
"addCacheFile",
"(",
"URI",
"uri",
",",
"Configuration",
"conf",
")",
"{",
"String",
"files",
"=",
"conf",
".",
"get",
"(",
"\"mapred.cache.files\"",
")",
";",
"conf",
".",
"set",
"(",
"\"mapred.cache.files\"",
",",
"files",
"==",... | Add a file to be localized to the conf
@param uri The uri of the cache to be localized
@param conf Configuration to add the cache to | [
"Add",
"a",
"file",
"to",
"be",
"localized",
"to",
"the",
"conf"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L945-L949 |
117,776 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.addFileToClassPath | public static void addFileToClassPath(Path file, Configuration conf)
throws IOException {
String classpath = conf.get("mapred.job.classpath.files");
conf.set("mapred.job.classpath.files", classpath == null ? file.toString()
: classpath + System.getProperty("path.separator") + file.toString());
... | java | public static void addFileToClassPath(Path file, Configuration conf)
throws IOException {
String classpath = conf.get("mapred.job.classpath.files");
conf.set("mapred.job.classpath.files", classpath == null ? file.toString()
: classpath + System.getProperty("path.separator") + file.toString());
... | [
"public",
"static",
"void",
"addFileToClassPath",
"(",
"Path",
"file",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"String",
"classpath",
"=",
"conf",
".",
"get",
"(",
"\"mapred.job.classpath.files\"",
")",
";",
"conf",
".",
"set",
"(",
"\... | Add an file path to the current set of classpath entries It adds the file
to cache as well.
@param file Path of the file to be added
@param conf Configuration that contains the classpath setting | [
"Add",
"an",
"file",
"path",
"to",
"the",
"current",
"set",
"of",
"classpath",
"entries",
"It",
"adds",
"the",
"file",
"to",
"cache",
"as",
"well",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L969-L977 |
117,777 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.getArchiveClassPaths | public static Path[] getArchiveClassPaths(Configuration conf) {
String classpath = conf.get("mapred.job.classpath.archives");
if (classpath == null)
return null;
ArrayList list = Collections.list(new StringTokenizer(classpath, System
.getProper... | java | public static Path[] getArchiveClassPaths(Configuration conf) {
String classpath = conf.get("mapred.job.classpath.archives");
if (classpath == null)
return null;
ArrayList list = Collections.list(new StringTokenizer(classpath, System
.getProper... | [
"public",
"static",
"Path",
"[",
"]",
"getArchiveClassPaths",
"(",
"Configuration",
"conf",
")",
"{",
"String",
"classpath",
"=",
"conf",
".",
"get",
"(",
"\"mapred.job.classpath.archives\"",
")",
";",
"if",
"(",
"classpath",
"==",
"null",
")",
"return",
"null... | Get the archive entries in classpath as an array of Path
@param conf Configuration that contains the classpath setting | [
"Get",
"the",
"archive",
"entries",
"in",
"classpath",
"as",
"an",
"array",
"of",
"Path"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L1045-L1056 |
117,778 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.getSymlink | public static boolean getSymlink(Configuration conf){
String result = conf.get("mapred.create.symlink");
if ("yes".equals(result)){
return true;
}
return false;
} | java | public static boolean getSymlink(Configuration conf){
String result = conf.get("mapred.create.symlink");
if ("yes".equals(result)){
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"getSymlink",
"(",
"Configuration",
"conf",
")",
"{",
"String",
"result",
"=",
"conf",
".",
"get",
"(",
"\"mapred.create.symlink\"",
")",
";",
"if",
"(",
"\"yes\"",
".",
"equals",
"(",
"result",
")",
")",
"{",
"return",
"true... | This method checks to see if symlinks are to be create for the
localized cache files in the current working directory
@param conf the jobconf
@return true if symlinks are to be created- else return false | [
"This",
"method",
"checks",
"to",
"see",
"if",
"symlinks",
"are",
"to",
"be",
"create",
"for",
"the",
"localized",
"cache",
"files",
"in",
"the",
"current",
"working",
"directory"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L1073-L1079 |
117,779 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.checkURIs | public static boolean checkURIs(URI[] uriFiles, URI[] uriArchives){
if ((uriFiles == null) && (uriArchives == null)){
return true;
}
if (uriFiles != null){
for (int i = 0; i < uriFiles.length; i++){
String frag1 = uriFiles[i].getFragment();
if (frag1 == null)
return fa... | java | public static boolean checkURIs(URI[] uriFiles, URI[] uriArchives){
if ((uriFiles == null) && (uriArchives == null)){
return true;
}
if (uriFiles != null){
for (int i = 0; i < uriFiles.length; i++){
String frag1 = uriFiles[i].getFragment();
if (frag1 == null)
return fa... | [
"public",
"static",
"boolean",
"checkURIs",
"(",
"URI",
"[",
"]",
"uriFiles",
",",
"URI",
"[",
"]",
"uriArchives",
")",
"{",
"if",
"(",
"(",
"uriFiles",
"==",
"null",
")",
"&&",
"(",
"uriArchives",
"==",
"null",
")",
")",
"{",
"return",
"true",
";",
... | This method checks if there is a conflict in the fragment names
of the uris. Also makes sure that each uri has a fragment. It
is only to be called if you want to create symlinks for
the various archives and files.
@param uriFiles The uri array of urifiles
@param uriArchives the uri array of uri archives | [
"This",
"method",
"checks",
"if",
"there",
"is",
"a",
"conflict",
"in",
"the",
"fragment",
"names",
"of",
"the",
"uris",
".",
"Also",
"makes",
"sure",
"that",
"each",
"uri",
"has",
"a",
"fragment",
".",
"It",
"is",
"only",
"to",
"be",
"called",
"if",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L1089-L1125 |
117,780 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.purgeCache | public static void purgeCache(Configuration conf,
MRAsyncDiskService service) throws IOException {
synchronized (cachedArchives) {
LocalFileSystem localFs = FileSystem.getLocal(conf);
for (Map.Entry<String,CacheStatus> f: cachedArchives.entrySet()) {
try {
deleteLocalPath(service... | java | public static void purgeCache(Configuration conf,
MRAsyncDiskService service) throws IOException {
synchronized (cachedArchives) {
LocalFileSystem localFs = FileSystem.getLocal(conf);
for (Map.Entry<String,CacheStatus> f: cachedArchives.entrySet()) {
try {
deleteLocalPath(service... | [
"public",
"static",
"void",
"purgeCache",
"(",
"Configuration",
"conf",
",",
"MRAsyncDiskService",
"service",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"cachedArchives",
")",
"{",
"LocalFileSystem",
"localFs",
"=",
"FileSystem",
".",
"getLocal",
"(",
... | Clear the entire contents of the cache and delete the backing files. This
should only be used when the server is reinitializing, because the users
are going to lose their files. | [
"Clear",
"the",
"entire",
"contents",
"of",
"the",
"cache",
"and",
"delete",
"the",
"backing",
"files",
".",
"This",
"should",
"only",
"be",
"used",
"when",
"the",
"server",
"is",
"reinitializing",
"because",
"the",
"users",
"are",
"going",
"to",
"lose",
"... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L1180-L1193 |
117,781 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.deleteCacheInfoUpdate | private static void deleteCacheInfoUpdate(CacheStatus cacheStatus) {
if (!cacheStatus.isInited()) {
// if it is not created yet, do nothing.
return;
}
synchronized (baseDirSize) {
Long dirSize = baseDirSize.get(cacheStatus.getBaseDir());
if ( dirSize != null ) {
dirSize -= ca... | java | private static void deleteCacheInfoUpdate(CacheStatus cacheStatus) {
if (!cacheStatus.isInited()) {
// if it is not created yet, do nothing.
return;
}
synchronized (baseDirSize) {
Long dirSize = baseDirSize.get(cacheStatus.getBaseDir());
if ( dirSize != null ) {
dirSize -= ca... | [
"private",
"static",
"void",
"deleteCacheInfoUpdate",
"(",
"CacheStatus",
"cacheStatus",
")",
"{",
"if",
"(",
"!",
"cacheStatus",
".",
"isInited",
"(",
")",
")",
"{",
"// if it is not created yet, do nothing.",
"return",
";",
"}",
"synchronized",
"(",
"baseDirSize",... | Update the maps baseDirSize and baseDirNumberSubDir when deleting cache.
@param cacheStatus cache status of the cache is deleted | [
"Update",
"the",
"maps",
"baseDirSize",
"and",
"baseDirNumberSubDir",
"when",
"deleting",
"cache",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L1199-L1218 |
117,782 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.addCacheInfoUpdate | private static void addCacheInfoUpdate(CacheStatus cacheStatus) {
long cacheSize = cacheStatus.size;
synchronized (baseDirSize) {
Long dirSize = baseDirSize.get(cacheStatus.getBaseDir());
if( dirSize == null ) {
dirSize = Long.valueOf(cacheSize);
} else {
dirSize += cacheSize;
... | java | private static void addCacheInfoUpdate(CacheStatus cacheStatus) {
long cacheSize = cacheStatus.size;
synchronized (baseDirSize) {
Long dirSize = baseDirSize.get(cacheStatus.getBaseDir());
if( dirSize == null ) {
dirSize = Long.valueOf(cacheSize);
} else {
dirSize += cacheSize;
... | [
"private",
"static",
"void",
"addCacheInfoUpdate",
"(",
"CacheStatus",
"cacheStatus",
")",
"{",
"long",
"cacheSize",
"=",
"cacheStatus",
".",
"size",
";",
"synchronized",
"(",
"baseDirSize",
")",
"{",
"Long",
"dirSize",
"=",
"baseDirSize",
".",
"get",
"(",
"ca... | Update the maps baseDirSize and baseDirNumberSubDir when adding cache.
@param cacheStatus cache status of the cache is added | [
"Update",
"the",
"maps",
"baseDirSize",
"and",
"baseDirNumberSubDir",
"when",
"adding",
"cache",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L1224-L1244 |
117,783 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.getDefaultUri | public static URI getDefaultUri(Configuration conf) {
return URI.create(fixName(conf.get(FS_DEFAULT_NAME_KEY, "file:///")));
} | java | public static URI getDefaultUri(Configuration conf) {
return URI.create(fixName(conf.get(FS_DEFAULT_NAME_KEY, "file:///")));
} | [
"public",
"static",
"URI",
"getDefaultUri",
"(",
"Configuration",
"conf",
")",
"{",
"return",
"URI",
".",
"create",
"(",
"fixName",
"(",
"conf",
".",
"get",
"(",
"FS_DEFAULT_NAME_KEY",
",",
"\"file:///\"",
")",
")",
")",
";",
"}"
] | Get the default filesystem URI from a configuration.
@param conf the configuration to access
@return the uri of the default filesystem | [
"Get",
"the",
"default",
"filesystem",
"URI",
"from",
"a",
"configuration",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L116-L118 |
117,784 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.getLocal | public static LocalFileSystem getLocal(Configuration conf)
throws IOException {
return (LocalFileSystem)get(LocalFileSystem.NAME, conf);
} | java | public static LocalFileSystem getLocal(Configuration conf)
throws IOException {
return (LocalFileSystem)get(LocalFileSystem.NAME, conf);
} | [
"public",
"static",
"LocalFileSystem",
"getLocal",
"(",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"return",
"(",
"LocalFileSystem",
")",
"get",
"(",
"LocalFileSystem",
".",
"NAME",
",",
"conf",
")",
";",
"}"
] | Get the local file syste
@param conf the configuration to configure the file system with
@return a LocalFileSystem | [
"Get",
"the",
"local",
"file",
"syste"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L179-L182 |
117,785 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.newInstanceLocal | public static LocalFileSystem newInstanceLocal(Configuration conf)
throws IOException {
return (LocalFileSystem)newInstance(LocalFileSystem.NAME, conf);
} | java | public static LocalFileSystem newInstanceLocal(Configuration conf)
throws IOException {
return (LocalFileSystem)newInstance(LocalFileSystem.NAME, conf);
} | [
"public",
"static",
"LocalFileSystem",
"newInstanceLocal",
"(",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"return",
"(",
"LocalFileSystem",
")",
"newInstance",
"(",
"LocalFileSystem",
".",
"NAME",
",",
"conf",
")",
";",
"}"
] | Get a unique local file system object
@param conf the configuration to configure the file system with
@return a LocalFileSystem
This always returns a new FileSystem object. | [
"Get",
"a",
"unique",
"local",
"file",
"system",
"object"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L249-L252 |
117,786 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.create | public static FSDataOutputStream create(FileSystem fs,
Path file, FsPermission permission) throws IOException {
// create the file with default permission
FSDataOutputStream out = fs.create(file);
// set its permission to the supplied one
fs.setPermission(file, permission);
return out;
} | java | public static FSDataOutputStream create(FileSystem fs,
Path file, FsPermission permission) throws IOException {
// create the file with default permission
FSDataOutputStream out = fs.create(file);
// set its permission to the supplied one
fs.setPermission(file, permission);
return out;
} | [
"public",
"static",
"FSDataOutputStream",
"create",
"(",
"FileSystem",
"fs",
",",
"Path",
"file",
",",
"FsPermission",
"permission",
")",
"throws",
"IOException",
"{",
"// create the file with default permission",
"FSDataOutputStream",
"out",
"=",
"fs",
".",
"create",
... | create a file with the provided permission
The permission of the file is set to be the provided permission as in
setPermission, not permission&~umask
It is implemented using two RPCs. It is understood that it is inefficient,
but the implementation is thread-safe. The other option is to change the
value of umask in con... | [
"create",
"a",
"file",
"with",
"the",
"provided",
"permission",
"The",
"permission",
"of",
"the",
"file",
"is",
"set",
"to",
"be",
"the",
"provided",
"permission",
"as",
"in",
"setPermission",
"not",
"permission&~umask"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L307-L314 |
117,787 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.mkdirs | public static boolean mkdirs(FileSystem fs, Path dir, FsPermission permission)
throws IOException {
// create the directory using the default permission
boolean result = fs.mkdirs(dir);
// set its permission to be the supplied one
fs.setPermission(dir, permission);
return result;
} | java | public static boolean mkdirs(FileSystem fs, Path dir, FsPermission permission)
throws IOException {
// create the directory using the default permission
boolean result = fs.mkdirs(dir);
// set its permission to be the supplied one
fs.setPermission(dir, permission);
return result;
} | [
"public",
"static",
"boolean",
"mkdirs",
"(",
"FileSystem",
"fs",
",",
"Path",
"dir",
",",
"FsPermission",
"permission",
")",
"throws",
"IOException",
"{",
"// create the directory using the default permission",
"boolean",
"result",
"=",
"fs",
".",
"mkdirs",
"(",
"d... | create a directory with the provided permission
The permission of the directory is set to be the provided permission as in
setPermission, not permission&~umask
@see #create(FileSystem, Path, FsPermission)
@param fs file system handle
@param dir the name of the directory to be created
@param permission the permission ... | [
"create",
"a",
"directory",
"with",
"the",
"provided",
"permission",
"The",
"permission",
"of",
"the",
"directory",
"is",
"set",
"to",
"be",
"the",
"provided",
"permission",
"as",
"in",
"setPermission",
"not",
"permission&~umask"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L328-L335 |
117,788 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.checkPath | protected void checkPath(Path path) {
URI uri = path.toUri();
if (uri.getScheme() == null) // fs is relative
return;
String thisScheme = this.getUri().getScheme();
String thatScheme = uri.getScheme();
String thisAuthority = this.getUri().getAuthority();
String thatAuthority... | java | protected void checkPath(Path path) {
URI uri = path.toUri();
if (uri.getScheme() == null) // fs is relative
return;
String thisScheme = this.getUri().getScheme();
String thatScheme = uri.getScheme();
String thisAuthority = this.getUri().getAuthority();
String thatAuthority... | [
"protected",
"void",
"checkPath",
"(",
"Path",
"path",
")",
"{",
"URI",
"uri",
"=",
"path",
".",
"toUri",
"(",
")",
";",
"if",
"(",
"uri",
".",
"getScheme",
"(",
")",
"==",
"null",
")",
"// fs is relative ",
"return",
";",
"String",
"thisScheme",
"=",
... | Check that a Path belongs to this FileSystem. | [
"Check",
"that",
"a",
"Path",
"belongs",
"to",
"this",
"FileSystem",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L354-L387 |
117,789 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.getFileBlockLocations | public BlockLocation[] getFileBlockLocations(FileStatus file,
long start, long len) throws IOException {
if (file == null) {
return null;
}
if ( (start<0) || (len < 0) ) {
throw new IllegalArgumentException("Invalid start or len parameter");
}
if (file.getLen() < start) {
... | java | public BlockLocation[] getFileBlockLocations(FileStatus file,
long start, long len) throws IOException {
if (file == null) {
return null;
}
if ( (start<0) || (len < 0) ) {
throw new IllegalArgumentException("Invalid start or len parameter");
}
if (file.getLen() < start) {
... | [
"public",
"BlockLocation",
"[",
"]",
"getFileBlockLocations",
"(",
"FileStatus",
"file",
",",
"long",
"start",
",",
"long",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"(",
... | Return an array containing hostnames, offset and size of
portions of the given file. For a nonexistent
file or regions, null will be returned.
This call is most helpful with DFS, where it returns
hostnames of machines that contain the given file.
The FileSystem will simply return an elt containing 'localhost'. | [
"Return",
"an",
"array",
"containing",
"hostnames",
"offset",
"and",
"size",
"of",
"portions",
"of",
"the",
"given",
"file",
".",
"For",
"a",
"nonexistent",
"file",
"or",
"regions",
"null",
"will",
"be",
"returned",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L399-L416 |
117,790 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.create | public FSDataOutputStream create(Path f, Progressable progress) throws IOException {
return create(f, CreateOptions.progress(progress));
} | java | public FSDataOutputStream create(Path f, Progressable progress) throws IOException {
return create(f, CreateOptions.progress(progress));
} | [
"public",
"FSDataOutputStream",
"create",
"(",
"Path",
"f",
",",
"Progressable",
"progress",
")",
"throws",
"IOException",
"{",
"return",
"create",
"(",
"f",
",",
"CreateOptions",
".",
"progress",
"(",
"progress",
")",
")",
";",
"}"
] | Create an FSDataOutputStream at the indicated Path with write-progress
reporting.
Files are overwritten by default.
@deprecated Use {@link #create(Path, CreateOptions...)} instead. | [
"Create",
"an",
"FSDataOutputStream",
"at",
"the",
"indicated",
"Path",
"with",
"write",
"-",
"progress",
"reporting",
".",
"Files",
"are",
"overwritten",
"by",
"default",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L483-L485 |
117,791 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.create | public FSDataOutputStream create(Path f,
FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
int bytesPerChecksum,
Progressable progress) throws IOException {
return create(f, CreateOptions.perms(permission), CreateOptions.writeOpt... | java | public FSDataOutputStream create(Path f,
FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
int bytesPerChecksum,
Progressable progress) throws IOException {
return create(f, CreateOptions.perms(permission), CreateOptions.writeOpt... | [
"public",
"FSDataOutputStream",
"create",
"(",
"Path",
"f",
",",
"FsPermission",
"permission",
",",
"boolean",
"overwrite",
",",
"int",
"bufferSize",
",",
"short",
"replication",
",",
"long",
"blockSize",
",",
"int",
"bytesPerChecksum",
",",
"Progressable",
"progr... | Opens an FSDataOutputStream at the indicated Path with write-progress
reporting.
@param f the file name to open
@param permission
@param overwrite if a file with this name already exists, then if true,
the file will be overwritten, and if false an error will be thrown.
@param bufferSize the size of the buffer to be use... | [
"Opens",
"an",
"FSDataOutputStream",
"at",
"the",
"indicated",
"Path",
"with",
"write",
"-",
"progress",
"reporting",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L653-L665 |
117,792 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.createNewFile | public boolean createNewFile(Path f) throws IOException {
if (exists(f)) {
return false;
} else {
create(f, false, getDefaultBufferSize()).close();
return true;
}
} | java | public boolean createNewFile(Path f) throws IOException {
if (exists(f)) {
return false;
} else {
create(f, false, getDefaultBufferSize()).close();
return true;
}
} | [
"public",
"boolean",
"createNewFile",
"(",
"Path",
"f",
")",
"throws",
"IOException",
"{",
"if",
"(",
"exists",
"(",
"f",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"create",
"(",
"f",
",",
"false",
",",
"getDefaultBufferSize",
"(",
")",
... | Creates the given Path as a brand-new zero-length file. If
create fails, or if it already existed, return false. | [
"Creates",
"the",
"given",
"Path",
"as",
"a",
"brand",
"-",
"new",
"zero",
"-",
"length",
"file",
".",
"If",
"create",
"fails",
"or",
"if",
"it",
"already",
"existed",
"return",
"false",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L773-L780 |
117,793 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.deleteOnExit | public boolean deleteOnExit(Path f) throws IOException {
if (!exists(f)) {
return false;
}
synchronized (deleteOnExit) {
deleteOnExit.add(f);
}
return true;
} | java | public boolean deleteOnExit(Path f) throws IOException {
if (!exists(f)) {
return false;
}
synchronized (deleteOnExit) {
deleteOnExit.add(f);
}
return true;
} | [
"public",
"boolean",
"deleteOnExit",
"(",
"Path",
"f",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"exists",
"(",
"f",
")",
")",
"{",
"return",
"false",
";",
"}",
"synchronized",
"(",
"deleteOnExit",
")",
"{",
"deleteOnExit",
".",
"add",
"(",
"f... | Mark a path to be deleted when FileSystem is closed.
When the JVM shuts down,
all FileSystem objects will be closed automatically.
Then,
the marked path will be deleted as a result of closing the FileSystem.
The path has to exist in the file system.
@param f the path to delete.
@return true if deleteOnExit is succes... | [
"Mark",
"a",
"path",
"to",
"be",
"deleted",
"when",
"FileSystem",
"is",
"closed",
".",
"When",
"the",
"JVM",
"shuts",
"down",
"all",
"FileSystem",
"objects",
"will",
"be",
"closed",
"automatically",
".",
"Then",
"the",
"marked",
"path",
"will",
"be",
"dele... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L926-L934 |
117,794 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.processDeleteOnExit | protected void processDeleteOnExit() {
synchronized (deleteOnExit) {
for (Iterator<Path> iter = deleteOnExit.iterator(); iter.hasNext();) {
Path path = iter.next();
try {
delete(path, true);
}
catch (IOException e) {
LOG.info("Ignoring failure to deleteOnExi... | java | protected void processDeleteOnExit() {
synchronized (deleteOnExit) {
for (Iterator<Path> iter = deleteOnExit.iterator(); iter.hasNext();) {
Path path = iter.next();
try {
delete(path, true);
}
catch (IOException e) {
LOG.info("Ignoring failure to deleteOnExi... | [
"protected",
"void",
"processDeleteOnExit",
"(",
")",
"{",
"synchronized",
"(",
"deleteOnExit",
")",
"{",
"for",
"(",
"Iterator",
"<",
"Path",
">",
"iter",
"=",
"deleteOnExit",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
... | Delete all files that were marked as delete-on-exit. This recursively
deletes all files in the specified paths. | [
"Delete",
"all",
"files",
"that",
"were",
"marked",
"as",
"delete",
"-",
"on",
"-",
"exit",
".",
"This",
"recursively",
"deletes",
"all",
"files",
"in",
"the",
"specified",
"paths",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L940-L953 |
117,795 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.isFile | public boolean isFile(Path f) throws IOException {
try {
return !getFileStatus(f).isDir();
} catch (FileNotFoundException e) {
return false; // f does not exist
}
} | java | public boolean isFile(Path f) throws IOException {
try {
return !getFileStatus(f).isDir();
} catch (FileNotFoundException e) {
return false; // f does not exist
}
} | [
"public",
"boolean",
"isFile",
"(",
"Path",
"f",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"!",
"getFileStatus",
"(",
"f",
")",
".",
"isDir",
"(",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"return",
"false",
";... | True iff the named path is a regular file. | [
"True",
"iff",
"the",
"named",
"path",
"is",
"a",
"regular",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L977-L983 |
117,796 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.listLocatedStatus | @Deprecated
public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f,
final PathFilter filter)
throws FileNotFoundException, IOException {
return new RemoteIterator<LocatedFileStatus>() {
private final FileStatus[] stats;
private int i = 0;
{ // initializer
stats ... | java | @Deprecated
public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f,
final PathFilter filter)
throws FileNotFoundException, IOException {
return new RemoteIterator<LocatedFileStatus>() {
private final FileStatus[] stats;
private int i = 0;
{ // initializer
stats ... | [
"@",
"Deprecated",
"public",
"RemoteIterator",
"<",
"LocatedFileStatus",
">",
"listLocatedStatus",
"(",
"final",
"Path",
"f",
",",
"final",
"PathFilter",
"filter",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"return",
"new",
"RemoteIterator",
"<... | Listing a directory
The returned results include its block location if it is a file
The results are filtered by the given path filter
@param f a path
@param filter a path filter
@return an iterator that traverses statuses of the files/directories
in the given path
@throws FileNotFoundException if <code>f</code> does no... | [
"Listing",
"a",
"directory",
"The",
"returned",
"results",
"include",
"its",
"block",
"location",
"if",
"it",
"is",
"a",
"file",
"The",
"results",
"are",
"filtered",
"by",
"the",
"given",
"path",
"filter"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1059-L1090 |
117,797 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.listLocatedBlockStatus | public RemoteIterator<LocatedBlockFileStatus> listLocatedBlockStatus(
final Path f,
final PathFilter filter)
throws FileNotFoundException, IOException {
return new RemoteIterator<LocatedBlockFileStatus>() {
private final FileStatus[] stats;
private int i = 0;
{ // initializer
... | java | public RemoteIterator<LocatedBlockFileStatus> listLocatedBlockStatus(
final Path f,
final PathFilter filter)
throws FileNotFoundException, IOException {
return new RemoteIterator<LocatedBlockFileStatus>() {
private final FileStatus[] stats;
private int i = 0;
{ // initializer
... | [
"public",
"RemoteIterator",
"<",
"LocatedBlockFileStatus",
">",
"listLocatedBlockStatus",
"(",
"final",
"Path",
"f",
",",
"final",
"PathFilter",
"filter",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"return",
"new",
"RemoteIterator",
"<",
"Located... | Listing a directory
The returned results include its blocks and locations if it is a file
The results are filtered by the given path filter
@param f a path
@param filter a path filter
@return an iterator that traverses statuses of the files/directories
in the given path
@throws FileNotFoundException if <code>f</code> d... | [
"Listing",
"a",
"directory",
"The",
"returned",
"results",
"include",
"its",
"blocks",
"and",
"locations",
"if",
"it",
"is",
"a",
"file",
"The",
"results",
"are",
"filtered",
"by",
"the",
"given",
"path",
"filter"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1123-L1162 |
117,798 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.globStatus | public FileStatus[] globStatus(Path pathPattern, PathFilter filter)
throws IOException {
String filename = pathPattern.toUri().getPath();
List<String> filePatterns = GlobExpander.expand(filename);
if (filePatterns.size() == 1) {
return globStatusInternal(pathPattern, filter);
} else {
... | java | public FileStatus[] globStatus(Path pathPattern, PathFilter filter)
throws IOException {
String filename = pathPattern.toUri().getPath();
List<String> filePatterns = GlobExpander.expand(filename);
if (filePatterns.size() == 1) {
return globStatusInternal(pathPattern, filter);
} else {
... | [
"public",
"FileStatus",
"[",
"]",
"globStatus",
"(",
"Path",
"pathPattern",
",",
"PathFilter",
"filter",
")",
"throws",
"IOException",
"{",
"String",
"filename",
"=",
"pathPattern",
".",
"toUri",
"(",
")",
".",
"getPath",
"(",
")",
";",
"List",
"<",
"Strin... | Return an array of FileStatus objects whose path names match pathPattern
and is accepted by the user-supplied path filter. Results are sorted by
their path names.
Return null if pathPattern has no glob and the path does not exist.
Return an empty array if pathPattern has a glob and no path matches it.
@param pathPatte... | [
"Return",
"an",
"array",
"of",
"FileStatus",
"objects",
"whose",
"path",
"names",
"match",
"pathPattern",
"and",
"is",
"accepted",
"by",
"the",
"user",
"-",
"supplied",
"path",
"filter",
".",
"Results",
"are",
"sorted",
"by",
"their",
"path",
"names",
".",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1333-L1349 |
117,799 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.getHomeDirectory | public Path getHomeDirectory(String userName) {
if (userName == null)
userName = System.getProperty("user.name");
return new Path("/user/"+ userName).makeQualified(this);
} | java | public Path getHomeDirectory(String userName) {
if (userName == null)
userName = System.getProperty("user.name");
return new Path("/user/"+ userName).makeQualified(this);
} | [
"public",
"Path",
"getHomeDirectory",
"(",
"String",
"userName",
")",
"{",
"if",
"(",
"userName",
"==",
"null",
")",
"userName",
"=",
"System",
".",
"getProperty",
"(",
"\"user.name\"",
")",
";",
"return",
"new",
"Path",
"(",
"\"/user/\"",
"+",
"userName",
... | Return the home directory for a given user in this filesystem.
@param userName name of the user or null for default user.name
@return Path for the supplied userName's home directory. | [
"Return",
"the",
"home",
"directory",
"for",
"a",
"given",
"user",
"in",
"this",
"filesystem",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1583-L1587 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.