Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-1786 Need to implement ODBC driver for Ignite
  3. IGNITE-2627

ODBC: OdbcNioParser is implemented incorrectly.

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.5.0.final
    • 1.6
    • odbc
    • None

    Description

      There are number of problem with OdbcNioParser which makes it usable only in single-threaded application when no TCP messages are batched together:

      1) Parser is not thread-safe and hence cannot have any state like "leftToReceive" of "curMsg" fields.
      Instead, you should rely on meta assigned to GridNioSession. See GridDirectParser as example.
      This will make the parser thread-safe.

      2) Message is decoded incorrectly. When "decode" is called, you cannot rely on buf.array(), as this array could contain multiple requests. Moreover, there are no guarantees that current message is started from the beginning of this array. So, the following line might return incorrect result:

      int msgLen = reader.readInt();
      

      Instead, you should follow common practice:
      1) Always rely on ByteBuffer.remaining()
      2) Read message byte-by-byte until all 4 bytes are read.
      3) Then read message body into separate byte[] until all data is ready.
      4) And only then you can create BinaryHeapInputStream and deserialize the stuff.

      Attachments

        Activity

          People

            vozerov Vladimir Ozerov
            vozerov Vladimir Ozerov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: