43
43
import org .apache .hadoop .util .Shell ;
44
44
import org .apache .hadoop .util .StringUtils ;
45
45
46
+ import org .slf4j .Logger ;
47
+ import org .slf4j .LoggerFactory ;
48
+
46
49
/*
47
50
* This package provides interface for hadoop jobs (incl. Map/Reduce)
48
51
* to access files in GlusterFS backed file system via FUSE mount
54
57
*
55
58
*/
56
59
public class GlusterFileSystem extends FileSystem {
60
+
61
+ static final Logger log = LoggerFactory .getLogger (GlusterFileSystem .class );
57
62
58
63
private FileSystem glusterFs =null ;
59
64
private URI uri =null ;
60
65
private Path workingDir =null ;
61
66
private String glusterMount =null ;
62
67
private boolean mounted =false ;
63
68
69
+
64
70
/* for quick IO */
65
71
private boolean quickSlaveIO =false ;
66
72
@@ -86,14 +92,14 @@ public boolean FUSEMount(String volname,String server,String mount) throws IOExc
86
92
String mountCmd =null ;
87
93
88
94
mountCmd ="mount -t glusterfs " +server +":" +"/" +volname +" " +mount ;
89
- System . out . println (mountCmd );
95
+ log . info (mountCmd );
90
96
try {
91
97
p =Runtime .getRuntime ().exec (mountCmd );
92
98
retVal =p .waitFor ();
93
99
if (retVal !=0 )
94
100
ret =false ;
95
101
}catch (IOException e ){
96
- System . out . println ("Problem mounting FUSE mount on: " +mount );
102
+ log . info ("Problem mounting FUSE mount on: " +mount );
97
103
throw new RuntimeException (e );
98
104
}
99
105
return ret ;
@@ -109,7 +115,7 @@ public void initialize(URI uri,Configuration conf) throws IOException{
109
115
if (this .mounted )
110
116
return ;
111
117
112
- System . out . println ("Initializing GlusterFS" );
118
+ log . info ("Initializing GlusterFS" );
113
119
114
120
try {
115
121
volName =conf .get ("fs.glusterfs.volname" , null );
@@ -314,7 +320,7 @@ private void loadPermissionInfo(){
314
320
String output ;
315
321
StringTokenizer t =new StringTokenizer (output =execCommand (theFile , Shell .getGET_PERMISSION_COMMAND ()));
316
322
317
- // System.out.println ("Output of PERMISSION command = " + output
323
+ // log.info ("Output of PERMISSION command = " + output
318
324
// + " for " + this.getPath());
319
325
// expected format
320
326
// -rw------- 1 username groupname ...
@@ -546,7 +552,7 @@ public BlockLocation[] getFileBlockLocations(FileStatus file,long start,long len
546
552
547
553
result =xattr .getPathInfo (f .getPath (), start , len );
548
554
if (result ==null ){
549
- System . out . println ("Problem getting destination host for file " +f .getPath ());
555
+ log . info ("Problem getting destination host for file " +f .getPath ());
550
556
return null ;
551
557
}
552
558
0 commit comments