Browse Source

Fix for HADOOP-40. Buffer size was ignored.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@380825 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 19 years ago
parent
commit
0940edcbcf

+ 5 - 4
src/java/org/apache/hadoop/fs/FSDataOutputStream.java

@@ -122,19 +122,20 @@ public class FSDataOutputStream extends DataOutputStream {
   }
   }
 
 
   public FSDataOutputStream(FileSystem fs, File file,
   public FSDataOutputStream(FileSystem fs, File file,
-                             boolean overwrite, Configuration conf)
+                            boolean overwrite, Configuration conf,
+                            int bufferSize)
     throws IOException {
     throws IOException {
     super(new Buffer(new PositionCache(new Summer(fs, file, overwrite, conf)),
     super(new Buffer(new PositionCache(new Summer(fs, file, overwrite, conf)),
-            conf.getInt("io.file.buffer.size", 4096)));
+                     bufferSize));
   }
   }
 
 
   /** Construct without checksums. */
   /** Construct without checksums. */
-  public FSDataOutputStream(FSOutputStream out, Configuration conf) throws IOException {
+  private FSDataOutputStream(FSOutputStream out, Configuration conf) throws IOException {
     this(out, conf.getInt("io.file.buffer.size", 4096));
     this(out, conf.getInt("io.file.buffer.size", 4096));
   }
   }
 
 
   /** Construct without checksums. */
   /** Construct without checksums. */
-  public FSDataOutputStream(FSOutputStream out, int bufferSize)
+  private FSDataOutputStream(FSOutputStream out, int bufferSize)
     throws IOException {
     throws IOException {
     super(new Buffer(new PositionCache(out), bufferSize));
     super(new Buffer(new PositionCache(out), bufferSize));
   }
   }

+ 1 - 1
src/java/org/apache/hadoop/fs/FileSystem.java

@@ -177,7 +177,7 @@ public abstract class FileSystem extends Configured {
      */
      */
     public FSDataOutputStream create(File f, boolean overwrite,
     public FSDataOutputStream create(File f, boolean overwrite,
                                       int bufferSize) throws IOException {
                                       int bufferSize) throws IOException {
-      return new FSDataOutputStream(this, f, overwrite, getConf());
+      return new FSDataOutputStream(this, f, overwrite, getConf(), bufferSize);
     }
     }
 
 
     /** Opens an OutputStream at the indicated File.
     /** Opens an OutputStream at the indicated File.