Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-2169

Flushing of output stream in DataFileWriter<D>#BufferedFileOutputStream out

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Not A Bug
    • 1.8.2
    • 1.8.2
    • java
    • None
    • This was an internal coding issue. Apologize for the same.

    Description

      Hi

      I am looking a the code of DataFileWriter inside the package org.apache.avro.file.

      private BufferedFileOutputStream out; we use the out stream.

      when the close method is called this stream is not flushed.

        /** Return the current position as a value that may be passed to {@link
         * DataFileReader#seek(long)}.  Forces the end of the current block,
         * emitting a synchronization marker. By default, this will also flush the
         * block to the stream.
         *
         * If {@linkplain #setFlushOnEveryBlock(boolean)} is
         * called with param set to false, then this method may not flush
         * the block. In this case, the {@linkplain #flush()} must be called to
         * flush the stream.
         */
        public long sync() throws IOException {
          assertOpen();
          writeBlock();
          return out.tell();
        }
      
        /** Calls {@linkplain #sync()} and then flushes the current state of the
         * file.
         */
        @Override
        public void flush() throws IOException {
          sync();
          vout.flush();
        }
      

      Can this lead to potential issues?

      Attachments

        Activity

          People

            Unassigned Unassigned
            jmukesh mukesh katariya
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: