Browse files

Fix in FsPermission constructor to maintain hadoop jar backwards comp…

…atibility
  • Loading branch information...
1 parent 0f2f85e commit c8d7a6ca2004b012f08ae2d9c1783e1befd5b0c6 Chinmay Soman committed May 24, 2012
View
15 contrib/hadoop-store-builder/src/java/voldemort/store/readonly/disk/HadoopStoreWriter.java
@@ -39,6 +39,7 @@
import voldemort.store.readonly.ReadOnlyUtils;
import voldemort.store.readonly.checksum.CheckSum;
import voldemort.store.readonly.checksum.CheckSum.CheckSumType;
+import voldemort.store.readonly.mr.HadoopStoreBuilder;
import voldemort.utils.ByteUtils;
import voldemort.xml.ClusterMapper;
import voldemort.xml.StoreDefinitionsMapper;
@@ -147,11 +148,13 @@ public void conf(JobConf job) {
this.fs = this.taskIndexFileName.getFileSystem(job);
this.indexFileStream = fs.create(this.taskIndexFileName);
- fs.setPermission(this.taskIndexFileName, new FsPermission("755"));
+ fs.setPermission(this.taskIndexFileName,
+ new FsPermission(HadoopStoreBuilder.HADOOP_FILE_PERMISSION));
logger.info("Setting permission to 755 for " + this.taskIndexFileName);
this.valueFileStream = fs.create(this.taskValueFileName);
- fs.setPermission(this.taskValueFileName, new FsPermission("755"));
+ fs.setPermission(this.taskValueFileName,
+ new FsPermission(HadoopStoreBuilder.HADOOP_FILE_PERMISSION));
logger.info("Setting permission to 755 for " + this.taskValueFileName);
logger.info("Opening " + this.taskIndexFileName + " and " + this.taskValueFileName
@@ -310,7 +313,7 @@ public void close() throws IOException {
// Create output directory, if it doesn't exist
FileSystem outputFs = nodeDir.getFileSystem(this.conf);
outputFs.mkdirs(nodeDir);
- outputFs.setPermission(nodeDir, new FsPermission("755"));
+ outputFs.setPermission(nodeDir, new FsPermission(HadoopStoreBuilder.HADOOP_FILE_PERMISSION));
logger.info("Setting permission to 755 for " + nodeDir);
// Write the checksum and output files
@@ -321,12 +324,14 @@ public void close() throws IOException {
Path checkSumValueFile = new Path(nodeDir, fileNamePrefix + ".data.checksum");
FSDataOutputStream output = outputFs.create(checkSumIndexFile);
- outputFs.setPermission(checkSumIndexFile, new FsPermission("755"));
+ outputFs.setPermission(checkSumIndexFile,
+ new FsPermission(HadoopStoreBuilder.HADOOP_FILE_PERMISSION));
output.write(this.checkSumDigestIndex.getCheckSum());
output.close();
output = outputFs.create(checkSumValueFile);
- outputFs.setPermission(checkSumValueFile, new FsPermission("755"));
+ outputFs.setPermission(checkSumValueFile,
+ new FsPermission(HadoopStoreBuilder.HADOOP_FILE_PERMISSION));
output.write(this.checkSumDigestValue.getCheckSum());
output.close();
} else {
View
15 ...doop-store-builder/src/java/voldemort/store/readonly/disk/HadoopStoreWriterPerBucket.java
@@ -39,6 +39,7 @@
import voldemort.store.readonly.ReadOnlyUtils;
import voldemort.store.readonly.checksum.CheckSum;
import voldemort.store.readonly.checksum.CheckSum.CheckSumType;
+import voldemort.store.readonly.mr.HadoopStoreBuilder;
import voldemort.utils.ByteUtils;
import voldemort.xml.ClusterMapper;
import voldemort.xml.StoreDefinitionsMapper;
@@ -118,11 +119,13 @@ public void conf(JobConf job) {
this.fs = this.taskIndexFileName[chunkId].getFileSystem(job);
this.indexFileStream[chunkId] = fs.create(this.taskIndexFileName[chunkId]);
- fs.setPermission(this.taskIndexFileName[chunkId], new FsPermission("755"));
+ fs.setPermission(this.taskIndexFileName[chunkId],
+ new FsPermission(HadoopStoreBuilder.HADOOP_FILE_PERMISSION));
logger.info("Setting permission to 755 for " + this.taskIndexFileName[chunkId]);
this.valueFileStream[chunkId] = fs.create(this.taskValueFileName[chunkId]);
- fs.setPermission(this.taskValueFileName[chunkId], new FsPermission("755"));
+ fs.setPermission(this.taskValueFileName[chunkId],
+ new FsPermission(HadoopStoreBuilder.HADOOP_FILE_PERMISSION));
logger.info("Setting permission to 755 for " + this.taskValueFileName[chunkId]);
logger.info("Opening " + this.taskIndexFileName[chunkId] + " and "
@@ -284,7 +287,7 @@ public void close() throws IOException {
// Create output directory, if it doesn't exist
FileSystem outputFs = nodeDir.getFileSystem(this.conf);
outputFs.mkdirs(nodeDir);
- outputFs.setPermission(nodeDir, new FsPermission("755"));
+ outputFs.setPermission(nodeDir, new FsPermission(HadoopStoreBuilder.HADOOP_FILE_PERMISSION));
logger.info("Setting permission to 755 for " + nodeDir);
// Write the checksum and output files
@@ -299,12 +302,14 @@ public void close() throws IOException {
Path checkSumValueFile = new Path(nodeDir, chunkFileName + ".data.checksum");
FSDataOutputStream output = outputFs.create(checkSumIndexFile);
- outputFs.setPermission(checkSumIndexFile, new FsPermission("755"));
+ outputFs.setPermission(checkSumIndexFile,
+ new FsPermission(HadoopStoreBuilder.HADOOP_FILE_PERMISSION));
output.write(this.checkSumDigestIndex[chunkId].getCheckSum());
output.close();
output = outputFs.create(checkSumValueFile);
- outputFs.setPermission(checkSumValueFile, new FsPermission("755"));
+ outputFs.setPermission(checkSumValueFile,
+ new FsPermission(HadoopStoreBuilder.HADOOP_FILE_PERMISSION));
output.write(this.checkSumDigestValue[chunkId].getCheckSum());
output.close();
} else {
View
5 contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/HadoopStoreBuilder.java
@@ -70,6 +70,7 @@
public static final long MIN_CHUNK_SIZE = 1L;
public static final long MAX_CHUNK_SIZE = (long) (1.9 * 1024 * 1024 * 1024);
public static final int DEFAULT_BUFFER_SIZE = 64 * 1024;
+ public static final short HADOOP_FILE_PERMISSION = 493;
private static final Logger logger = Logger.getLogger(HadoopStoreBuilder.class);
@@ -471,7 +472,7 @@ public void build() {
logger.info("No data generated for node " + node.getId()
+ ". Generating empty folder");
outputFs.mkdirs(nodePath); // Create empty folder
- outputFs.setPermission(nodePath, new FsPermission("755"));
+ outputFs.setPermission(nodePath, new FsPermission(HADOOP_FILE_PERMISSION));
logger.info("Setting permission to 755 for " + nodePath);
}
@@ -523,7 +524,7 @@ public boolean accept(Path arg0) {
// Write metadata
Path metadataPath = new Path(nodePath, ".metadata");
FSDataOutputStream metadataStream = outputFs.create(metadataPath);
- outputFs.setPermission(metadataPath, new FsPermission("755"));
+ outputFs.setPermission(metadataPath, new FsPermission(HADOOP_FILE_PERMISSION));
logger.info("Setting permission to 755 for " + metadataPath);
metadataStream.write(metadata.toJsonString().getBytes());
metadataStream.flush();

0 comments on commit c8d7a6c

Please sign in to comment.