Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-4166

improvements to the mailjdbc test

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 10.6.1.0
    • 10.6.1.0
    • Test
    • None
    • Newcomer, Patch Available

    Description

      When recently working with the mailjdbc system test org.apache.derbyTesting.system.mailjdbc on DERBY-4152 I noticed some potential improvements that might be good for the test. We should probably hold off on these improvements however until the root cause of DERBY-4152 is established, however, so we don't muddy the waters with that issue by changing the test.

      1) DbTasks.moveToFolders may throw an IllegalArgumentException.
      There is a line: message_id = Rn.nextInt(count - 1);
      if count is 1 the argument to nextInt() might be 0 which is not allowed. I hit this once but lost the stack trace, but it is apparent that when there is only one row in the table this can occur.

      2) Allow/implement multiple attachments per message and cleanup DbTasks.insertMail() logic.

      • Remove the attach_id column from INBOX to allow multiple attachments.
        -Make the attachment insert part of the message for loop in insertMail.
        Use getGeneratedKeys() to get the id of the inserted message.
        When attachments are inserted, insert (1-4) attachments and give them a corresponding attach_id from 1-4.
        This will allow for removal of the select statements used to determine id and attach_id. I'll file another issue for these improvements if folks agree that they are sensible.

      A detailed description of the current implementation of insertMail is described at https://issues.apache.org/jira/secure/attachment/12405685/insertMailSummary.txt

      3) DbTasks.databaseSize calculation is wrong. It doesn't match du -sk. The method does not recurse into subdirectories and includes the length() on directory files which is undefined accourding to the file.length() javadoc.

      Attachments

        1. DERBY-4166-schemachange7.diff
          31 kB
          Lily Wei
        2. DERBY-4166-schemachange6.diff
          31 kB
          Lily Wei
        3. DERBY-4166-schemachange5.diff
          30 kB
          Lily Wei
        4. derby.log
          0.7 kB
          Lily Wei
        5. DERBY-4166-schemachange3.diff
          30 kB
          Lily Wei
        6. DERBY-4166-schemachange4.diff
          22 kB
          Lily Wei
        7. DERBY-4166-schemachange3.diff
          21 kB
          Lily Wei
        8. DERBY-4166-schemachange2.diff
          19 kB
          Lily Wei
        9. DERBY-4166-schemachange.diff
          17 kB
          Lily Wei
        10. DERBY-4166-databasesize.diff
          2 kB
          Lily Wei
        11. Derby-4166-samedb.diff
          4 kB
          Lily Wei
        12. Derby-4166.diff
          18 kB
          Lily Wei

        Activity

          People

            lilywei Lily Wei
            kmarsden Katherine Marsden
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: