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

C# DataFileReader requires Stream to be Seekable for no reason

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.9.2
    • csharp
    • None
    • Added support for non-seekable streams in the DataFileReader

    Description

      When calling the method DataFileReader.OpenReader on a non-seekable stream, the method throws an AvroException.

      The requirements for this Seek() call is:

      1. To ensure the magic number to be there and rewind the Stream afterward.
      2. To be able to call the methods Seek and Sync.

      The 1. is not useful as the Ctor does ensure again that the magic number is there (this is the reason why the Stream has to be rewind). This code can just be removed with no side effect, as a Stream without this magic number will throw itself an AvroException. (the message being "Not a valid data file!" instead of "Not an Avro data file").

      The 2. could be checked at the call time of the method: the user that sends a non-seekable Stream should not call Seek or Sync upon the reader. (and by the way the Stream should throws a UnsupportedException at this time)

      Attachments

        Issue Links

          Activity

            People

              sfoutrier Sébastien Foutrier
              sfoutrier Sébastien Foutrier
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 4h
                  4h
                  Remaining:
                  Remaining Estimate - 4h
                  4h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified