23
23
*/
24
24
package org .apache .hadoop .fs .glusterfs ;
25
25
26
- import java .io .*;
27
- import java .net .*;
28
-
26
+ import java .io .File ;
27
+ import java .io .FileNotFoundException ;
28
+ import java .io .IOException ;
29
+ import java .net .InetAddress ;
30
+ import java .net .URI ;
29
31
import java .util .StringTokenizer ;
30
32
import java .util .TreeMap ;
31
- import java .util .regex .*;
32
33
33
34
import org .apache .hadoop .conf .Configuration ;
35
+ import org .apache .hadoop .fs .BlockLocation ;
34
36
import org .apache .hadoop .fs .FSDataInputStream ;
35
37
import org .apache .hadoop .fs .FSDataOutputStream ;
36
- import org .apache .hadoop .fs .FileSystem ;
37
38
import org .apache .hadoop .fs .FileStatus ;
39
+ import org .apache .hadoop .fs .FileSystem ;
38
40
import org .apache .hadoop .fs .FileUtil ;
39
41
import org .apache .hadoop .fs .Path ;
40
- import org .apache .hadoop .fs .BlockLocation ;
41
42
import org .apache .hadoop .fs .permission .FsPermission ;
42
43
import org .apache .hadoop .util .Progressable ;
43
44
import org .apache .hadoop .util .Shell ;
44
45
import org .apache .hadoop .util .StringUtils ;
45
-
46
46
import org .slf4j .Logger ;
47
47
import org .slf4j .LoggerFactory ;
48
48
@@ -65,6 +65,7 @@ public class GlusterFileSystem extends FileSystem{
65
65
private Path workingDir =null ;
66
66
private String glusterMount =null ;
67
67
private boolean mounted =false ;
68
+ private int writeBufferSize = 0 ;
68
69
69
70
70
71
/* for quick IO */
@@ -111,6 +112,7 @@ public void initialize(URI uri,Configuration conf) throws IOException{
111
112
String remoteGFSServer =null ;
112
113
String needQuickRead =null ;
113
114
boolean autoMount =true ;
115
+
114
116
115
117
if (this .mounted )
116
118
return ;
@@ -123,7 +125,7 @@ public void initialize(URI uri,Configuration conf) throws IOException{
123
125
remoteGFSServer =conf .get ("fs.glusterfs.server" , null );
124
126
needQuickRead =conf .get ("quick.slave.io" , null );
125
127
autoMount =conf .getBoolean ("fs.glusterfs.automount" , true );
126
-
128
+ writeBufferSize = conf . getInt ( "fs.glusterfs.write.buffer.size" , 0 );
127
129
/*
128
130
* bail out if we do not have enough information to do a FUSE mount
129
131
*/
@@ -421,7 +423,7 @@ public FSDataOutputStream create(Path path,FsPermission permission,boolean overw
421
423
parent =path .getParent ();
422
424
mkdirs (parent );
423
425
424
- glusterFileStream =new FSDataOutputStream (new GlusterFUSEOutputStream (f .getPath (), false ));
426
+ glusterFileStream =new FSDataOutputStream (new GlusterFUSEOutputStream (f .getPath (), false , writeBufferSize ));
425
427
426
428
return glusterFileStream ;
427
429
}
0 commit comments