Avro
  1. Avro
  2. AVRO-738

BinaryEncoder's init() function does not reset the OutputStream of the embedded SimpleByteWriter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Duplicate
    • Affects Version/s: 1.4.1
    • Fix Version/s: None
    • Component/s: java
    • Labels:
      None

      Description

      This is a problem if one is trying to reuse the BinaryEncoder by passing a new OutputStream with the init() method. While the encoder will write all the fields to the new OutputStream, fields that are of type "bytes" do not get written. This effectively means that one needs to create a new BinaryEncoder each time if one is serializing record with a "bytes" field in it.

        Issue Links

          Activity

          Devajyoti Sarkar created issue -
          Hide
          Scott Carey added a comment -

          This looks like a relatively crirical bug.

          BinaryEncoder is not clearing out its byteWriter state when initialized with a new output stream.

          In general it seems like there are several performance enhancements to be had as well – access to the outputStream is too fine-grained.

          As a work-around use the

            public void writeBytes(byte[] bytes, int start, int len) throws IOException
          

          signature instead of

            public void writeBytes(ByteBuffer bytes) throws IOException
          

          That should avoid this bug.

          Show
          Scott Carey added a comment - This looks like a relatively crirical bug. BinaryEncoder is not clearing out its byteWriter state when initialized with a new output stream. In general it seems like there are several performance enhancements to be had as well – access to the outputStream is too fine-grained. As a work-around use the public void writeBytes( byte [] bytes, int start, int len) throws IOException signature instead of public void writeBytes(ByteBuffer bytes) throws IOException That should avoid this bug.
          Scott Carey made changes -
          Field Original Value New Value
          Fix Version/s 1.5.0 [ 12315282 ]
          Priority Major [ 3 ] Critical [ 2 ]
          Scott Carey made changes -
          Link This issue relates to AVRO-753 [ AVRO-753 ]
          Doug Cutting made changes -
          Fix Version/s 1.5.1 [ 12316197 ]
          Fix Version/s 1.5.0 [ 12315282 ]
          Hide
          Scott Carey added a comment -

          After AVRO-753, this will be closed since there won't be an init() method and the replacement via EncoderFactory.binaryEncoder() will not have this problem.

          Show
          Scott Carey added a comment - After AVRO-753 , this will be closed since there won't be an init() method and the replacement via EncoderFactory.binaryEncoder() will not have this problem.
          Hide
          Doug Cutting added a comment -

          This was made obsolete by AVRO-753. Resolving.

          Show
          Doug Cutting added a comment - This was made obsolete by AVRO-753 . Resolving.
          Doug Cutting made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 1.5.1 [ 12316197 ]
          Resolution Duplicate [ 3 ]
          Doug Cutting made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          54d 10h 58m 1 Doug Cutting 14/Mar/11 16:59
          Resolved Resolved Closed Closed
          53d 2h 18m 1 Doug Cutting 06/May/11 20:18

            People

            • Assignee:
              Unassigned
              Reporter:
              Devajyoti Sarkar
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development