diff --git a/src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFSBrickClass.java b/src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFSBrickClass.java deleted file mode 100644 index 21dc942e..00000000 --- a/src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFSBrickClass.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * - * Copyright (c) 2011 Gluster, Inc. - * This file is part of GlusterFS. - * - * Licensed under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - * - */ - -package org.apache.hadoop.fs.glusterfs; - -import java.io.*; - -public class GlusterFSBrickClass{ - String host; - String exportedFile; - long start; - long end; - boolean isChunked; - int stripeSize; // Stripe size in bytes - int nrStripes; // number of stripes - int switchCount; // for SR, DSR - number of replicas of each stripe - // -1 for others - - public GlusterFSBrickClass(String brick, long start, long len, boolean flag, int stripeSize, int nrStripes, int switchCount) throws IOException{ - this.host=brick2host(brick); - this.exportedFile=brick2file(brick); - this.start=start; - this.end=start+len; - this.isChunked=flag; - this.stripeSize=stripeSize; - this.nrStripes=nrStripes; - this.switchCount=switchCount; - } - - public boolean isChunked(){ - return isChunked; - } - - public String brickIsLocal(String hostname){ - String path=null; - if(host.equals(hostname)) - path=exportedFile; - - return path; - } - - public int[] getBrickNumberInTree(long start,int len){ - long end=len; - int startNodeInTree=((int) (start/stripeSize))%nrStripes; - int endNodeInTree=((int) ((start+len)/stripeSize))%nrStripes; - - if(startNodeInTree!=endNodeInTree){ - end=(start-(start%stripeSize))+stripeSize; - end-=start; - } - - return new int[]{startNodeInTree,endNodeInTree,(int) end}; - } - - public boolean brickHasFilePart(int nodeInTree,int nodeLoc){ - if(switchCount==-1) - return (nodeInTree==nodeLoc); - - nodeInTree*=switchCount; - for(int i=nodeInTree;i<(nodeInTree+switchCount);i++){ - if(i==nodeLoc) - return true; - } - - return false; - } - - public String brick2host(String brick) throws IOException{ - String[] hf=null; - - hf=brick.split(":"); - if(hf.length!=2) - throw new IOException("Error getting hostname from brick"); - - return hf[0]; - } - - public String brick2file(String brick) throws IOException{ - String[] hf=null; - - hf=brick.split(":"); - if(hf.length!=2) - throw new IOException("Error getting hostname from brick"); - - return hf[1]; - } - -} diff --git a/src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFSBrickRepl.java b/src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFSBrickRepl.java deleted file mode 100644 index b4e4713a..00000000 --- a/src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFSBrickRepl.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * - * Copyright (c) 2011 Gluster, Inc. - * This file is part of GlusterFS. - * - * Licensed under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - * - */ - -package org.apache.hadoop.fs.glusterfs; - -public class GlusterFSBrickRepl{ - private String[] replHost; - private long start; - private long len; - private int cnt; - - GlusterFSBrickRepl(int replCount, long start, long len){ - this.replHost=new String[replCount]; - this.start=start; - this.len=len; - this.cnt=0; - } - - public void addHost(String host){ - this.replHost[cnt++]=host; - } - - public String[] getReplHosts(){ - return this.replHost; - } - - public long getStartLen(){ - return this.start; - } - - public long getOffLen(){ - return this.len; - } -} diff --git a/src/main/java/org/apache/hadoop/fs/glusterfs/GlusterVolume.java b/src/main/java/org/apache/hadoop/fs/glusterfs/GlusterVolume.java index d271b980..c28d36f9 100644 --- a/src/main/java/org/apache/hadoop/fs/glusterfs/GlusterVolume.java +++ b/src/main/java/org/apache/hadoop/fs/glusterfs/GlusterVolume.java @@ -26,14 +26,12 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.net.URI; -import java.util.Arrays; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.BlockLocation; -import org.apache.hadoop.fs.FileAlreadyExistsException; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileUtil; import org.apache.hadoop.fs.Path; @@ -111,9 +109,7 @@ public boolean sameVolume(Path p){ } public void setConf(Configuration conf){ - log.info("Initializing gluster volume.."); super.setConf(conf); - if(conf!=null){ try{ @@ -136,7 +132,7 @@ public void setConf(Configuration conf){ + ", No mount point available for the volume."); } volumes.put(v[i],vol); - log.info("Gluster volume: " + v[i] + " at : " + volumes.get(v[i])); + log.info("Volume: " + v[i] + " at : " + volumes.get(v[i])); } String jtSysDir = conf.get("mapreduce.jobtracker.system.dir", null); @@ -149,7 +145,6 @@ public void setConf(Configuration conf){ } if(sameVolume(mapredSysDirectory) && !exists(mapredSysDirectory) ){ - // mkdirs(mapredSysDirectory); log.warn("mapred.system.dir/mapreduce.jobtracker.system.dir does not exist: " + mapredSysDirectory); } //Working directory setup @@ -158,14 +153,13 @@ public void setConf(Configuration conf){ if(!sameVolume(workingDirectory)){ workingDirectory = new Path("/"); }else if( !exists(workingDirectory)){ - // mkdirs(workingDirectory); log.warn("working directory does not exist: " + workingDirectory); } setWorkingDirectory(workingDirectory); - log.info("Working directory is : "+ getWorkingDirectory()); + log.info("Working directory: "+ getWorkingDirectory()); /** * Write Buffering @@ -198,11 +192,11 @@ public void setConf(Configuration conf){ */ tsPrecisionChop=conf.getInt("fs.glusterfs.timestamp.trim", 0); - log.info("File timestamp lease significant digits removed : " + tsPrecisionChop) ; + if(tsPrecisionChop!=0) log.info("Timestamp digit precision : " + tsPrecisionChop) ; } catch (Exception e){ - throw new RuntimeException(e); + throw new RuntimeException("Error Initializing gluster volume:" + e); } } } @@ -404,14 +398,14 @@ public BlockLocation[] getFileBlockLocations(FileStatus file,long start,long len File f=pathToFile(file.getPath()); BlockLocation[] result = new GlusterFSXattr(f.getPath()).getPathInfo(start, len); if(result==null){ - log.info("GLUSTERFS: Problem getting host/block location for file "+f.getPath()); + log.info("Problem getting host/block location for file "+f.getPath()); } return result; } public String toString(){ - return "Gluster volume: " + this.NAME; + return "Volume: " + this.NAME; } }