Derby
  1. Derby
  2. DERBY-4777

Different behavior in Client and Embedded modes when update on an invalid cursor

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.7.1.1
    • Fix Version/s: 10.7.1.1
    • Component/s: JDBC
    • Labels:
      None
    • Bug behavior facts:
      Embedded/Client difference

      Description

      Consider the sql snippet below:

      create table test(c1 int, c2 int);
      insert into test values(1,1);
      update test set c1=2 where current of jdk4;

      for the 'update' line, we get 'ERROR XJ202: Invalid cursor name 'JDK4'. ' in Client mode, while 'ERROR 42X30: Cursor 'JDK4' not found. Verify that autocommit is OFF.' in Embed mode.

      1. releaseNote.html
        4 kB
        Rick Hillegas
      2. releaseNote.html
        5 kB
        Myrna van Lunteren
      3. derby-4777-releasenote.stat
        0.0 kB
        Yun Lee
      4. derby-4777-releasenote.patch
        2 kB
        Yun Lee
      5. DERBY-4777_b.diff
        3 kB
        Myrna van Lunteren
      6. DERBY-4777_b.stat
        0.3 kB
        Myrna van Lunteren
      7. derby-4777.stat
        0.1 kB
        Yun Lee
      8. derby-4777.patch
        2 kB
        Yun Lee

        Issue Links

          Activity

          Yun Lee created issue -
          Yun Lee made changes -
          Field Original Value New Value
          Status Open [ 1 ] In Progress [ 3 ]
          Hide
          Yun Lee added a comment -

          In DERBY, ERROR 42X30 (LANG_CURSOR_NOT_FOUND) occures in CurrentOfResultSet.getCursor() and CurrentOfNode.bindNonVTITables(). While ERROR XJ202 (CURSOR_INVALID_NAME) occurs in Statement.setCursorName() and Statement.flowExecute().

          I think CURSOR_INVALID_NAME should just be used to show the 'name' of a cursor is invalid, but not the cursor itself is invalid. If a cursor itselft is not invalid, a LANG_CURSOR_NOT_FOUND is more suitable.

          Show
          Yun Lee added a comment - In DERBY, ERROR 42X30 (LANG_CURSOR_NOT_FOUND) occures in CurrentOfResultSet.getCursor() and CurrentOfNode.bindNonVTITables(). While ERROR XJ202 (CURSOR_INVALID_NAME) occurs in Statement.setCursorName() and Statement.flowExecute(). I think CURSOR_INVALID_NAME should just be used to show the 'name' of a cursor is invalid, but not the cursor itself is invalid. If a cursor itselft is not invalid, a LANG_CURSOR_NOT_FOUND is more suitable.
          Hide
          Yun Lee added a comment -

          For derby-4777.patch, CURSOR_INVALID_NAME is replaced by LANG_CURSOR_NOT_FOUND in Statement.flowExecute().

          Accordingly, CurrentOfTest.testDelete() begins to use 42X30(LANG_CURSOR_NOT_FOUND) in both modes.

          Please check it, thanks!

          Show
          Yun Lee added a comment - For derby-4777.patch, CURSOR_INVALID_NAME is replaced by LANG_CURSOR_NOT_FOUND in Statement.flowExecute(). Accordingly, CurrentOfTest.testDelete() begins to use 42X30(LANG_CURSOR_NOT_FOUND) in both modes. Please check it, thanks!
          Yun Lee made changes -
          Attachment derby-4777.patch [ 12452168 ]
          Attachment derby-4777.stat [ 12452169 ]
          Yun Lee made changes -
          Issue & fix info [Patch Available]
          Yun Lee made changes -
          Link This issue is related to DERBY-3801 [ DERBY-3801 ]
          Yun Lee made changes -
          Link This issue is part of DERBY-310 [ DERBY-310 ]
          Hide
          Myrna van Lunteren added a comment -

          attaching an improved patch.

          Show
          Myrna van Lunteren added a comment - attaching an improved patch.
          Myrna van Lunteren made changes -
          Attachment DERBY-4777_b.stat [ 12452352 ]
          Attachment DERBY-4777_b.diff [ 12452353 ]
          Hide
          Myrna van Lunteren added a comment -

          Thanks Yun for that inital patch.

          But when I built, and ran our lang/holdCursorIJ.sql test with -Dframework=DerbyNetClient (which after all is how we got to notice this difference between client and embedded) it failed with the following diff:

          234 del
          < ERROR XJ202: Invalid cursor name 'JDK4'.
          234a234
          > ERROR 42X30: UNKNOWN MESSAGE, id 42X30 : [0] JDK4
          280 del
          < ERROR XJ202: Invalid cursor name 'JDK4'.
          280a280
          > ERROR 42X30: UNKNOWN MESSAGE, id 42X30 : [0] JDK4

          I had expected a difference, but not this 'UNKNOWN MESSAGE'.
          The messages that the client access, need to be 'split' out of the shared messages. This is handled in the build process by the file java/build/org/apache/derbyBuild/splitmessages.java. I added the line:
          clientMessageIds.add(SQLState.LANG_CURSOR_NOT_FOUND); and after that, the holdCursorIj had the expected output:

          I'm running tests to confirm this works, if all ok, I'll commit this.

          However, we're not done - as this is a change in SQLState, and people might have programmed their application to expect a certain sqlstate, I think this issue needs a release note.
          See the first part of this wiki for how that's done: http://wiki.apache.org/db-derby/ReleaseNoteProcess

          Show
          Myrna van Lunteren added a comment - Thanks Yun for that inital patch. But when I built, and ran our lang/holdCursorIJ.sql test with -Dframework=DerbyNetClient (which after all is how we got to notice this difference between client and embedded) it failed with the following diff: 234 del < ERROR XJ202: Invalid cursor name 'JDK4'. 234a234 > ERROR 42X30: UNKNOWN MESSAGE, id 42X30 : [0] JDK4 280 del < ERROR XJ202: Invalid cursor name 'JDK4'. 280a280 > ERROR 42X30: UNKNOWN MESSAGE, id 42X30 : [0] JDK4 I had expected a difference, but not this 'UNKNOWN MESSAGE'. The messages that the client access, need to be 'split' out of the shared messages. This is handled in the build process by the file java/build/org/apache/derbyBuild/splitmessages.java. I added the line: clientMessageIds.add(SQLState.LANG_CURSOR_NOT_FOUND); and after that, the holdCursorIj had the expected output: I'm running tests to confirm this works, if all ok, I'll commit this. However, we're not done - as this is a change in SQLState, and people might have programmed their application to expect a certain sqlstate, I think this issue needs a release note. See the first part of this wiki for how that's done: http://wiki.apache.org/db-derby/ReleaseNoteProcess
          Hide
          Yun Lee added a comment -

          Thanks Myrna! I will add a patch for a release note tomorrow or the day after.

          Show
          Yun Lee added a comment - Thanks Myrna! I will add a patch for a release note tomorrow or the day after.
          Hide
          Myrna van Lunteren added a comment -

          Tests ran cleanly against classes (except for testPing/DERBY-4762) so I committed the modified patch with revision 986750. Marking Release Note Needed sothe issue will be flagged when we make a next release.

          Show
          Myrna van Lunteren added a comment - Tests ran cleanly against classes (except for testPing/ DERBY-4762 ) so I committed the modified patch with revision 986750. Marking Release Note Needed sothe issue will be flagged when we make a next release.
          Myrna van Lunteren made changes -
          Affects Version/s 10.7.0.0 [ 12314971 ]
          Issue & fix info [Patch Available] [Release Note Needed]
          Hide
          Dag H. Wanvik added a comment -

          Changed to the title of this issue somewhat for legibility.

          Show
          Dag H. Wanvik added a comment - Changed to the title of this issue somewhat for legibility.
          Dag H. Wanvik made changes -
          Summary perform different in Client and Embed modes when update on an invalid cursor Different behavior in Client and Embedded modes when update on an invalid cursor
          Hide
          Yun Lee added a comment -

          A patch for releasenote.html is submitted, please check it, thanks!

          Show
          Yun Lee added a comment - A patch for releasenote.html is submitted, please check it, thanks!
          Yun Lee made changes -
          Attachment derby-4777-releasenote.patch [ 12452736 ]
          Attachment derby-4777-releasenote.stat [ 12452737 ]
          Yun Lee made changes -
          Issue & fix info [Release Note Needed] [Patch Available]
          Hide
          Myrna van Lunteren added a comment -

          Thanks for that releaseNote.
          On the whole, it looks good.

          However, release notes don't need to be appended as 'patches'/svn diffs. Instead, the templates/releaseNote.html is supposed to get copied to a temporary location, not actually changed, and then copied, modified file can be attached to the jira issue without a name change.

          The flag 'release Note needed' stays on, the bug gets closed, and during the next release cycle, the file 'releaseNote.html' attached to the issue will automatically be included in the list of items requiring a release note.

          I'm attaching the releaseNote.html resulting from your patch (I applied the patch, copied the file, then reverted the tools/release/templates/releaseNote.html).
          I made a couple of tiny changes to the phrasing, nothing important.

          Show
          Myrna van Lunteren added a comment - Thanks for that releaseNote. On the whole, it looks good. However, release notes don't need to be appended as 'patches'/svn diffs. Instead, the templates/releaseNote.html is supposed to get copied to a temporary location, not actually changed, and then copied, modified file can be attached to the jira issue without a name change. The flag 'release Note needed' stays on, the bug gets closed, and during the next release cycle, the file 'releaseNote.html' attached to the issue will automatically be included in the list of items requiring a release note. I'm attaching the releaseNote.html resulting from your patch (I applied the patch, copied the file, then reverted the tools/release/templates/releaseNote.html). I made a couple of tiny changes to the phrasing, nothing important.
          Myrna van Lunteren made changes -
          Attachment releaseNote.html [ 12453149 ]
          Myrna van Lunteren made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Issue & fix info [Patch Available]
          Fix Version/s 10.7.0.0 [ 12314971 ]
          Resolution Fixed [ 1 ]
          Myrna van Lunteren made changes -
          Link This issue is part of DERBY-4609 [ DERBY-4609 ]
          Hide
          Rick Hillegas added a comment -

          Updating the release note, incorporating feedback from Dag on the 10.7.1 release notes.

          Show
          Rick Hillegas added a comment - Updating the release note, incorporating feedback from Dag on the 10.7.1 release notes.
          Rick Hillegas made changes -
          Attachment releaseNote.html [ 12459478 ]
          Rick Hillegas made changes -
          Affects Version/s 10.7.1.1 [ 12315564 ]
          Affects Version/s 10.7.1.0 [ 12314971 ]
          Fix Version/s 10.7.1.1 [ 12315564 ]
          Fix Version/s 10.7.1.0 [ 12314971 ]
          Hide
          Knut Anders Hatlen added a comment -

          [bulk update] Close all resolved issues that haven't been updated for more than one year.

          Show
          Knut Anders Hatlen added a comment - [bulk update] Close all resolved issues that haven't been updated for more than one year.
          Knut Anders Hatlen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gavin made changes -
          Workflow jira [ 12518087 ] Default workflow, editable Closed status [ 12802710 ]

            People

            • Assignee:
              Yun Lee
              Reporter:
              Yun Lee
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development