db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-4313) JDBC.dropUsingDMD() may skip dropping objects
Date Fri, 17 Jul 2009 14:40:15 GMT

     [ https://issues.apache.org/jira/browse/DERBY-4313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Knut Anders Hatlen updated DERBY-4313:
--------------------------------------

    Attachment: dropUsingDMD.diff

dropUsingDMD.diff fixes the loop by only removing the DDL statement from the ArrayList if
it had succeeded, which appears to be the intent of the code judging by the comments. The
three tables mentioned in my previous comment were successfully dropped when this patch was
applied. I'll also run suites.All to see if it causes problems for any of the tests.

> JDBC.dropUsingDMD() may skip dropping objects
> ---------------------------------------------
>
>                 Key: DERBY-4313
>                 URL: https://issues.apache.org/jira/browse/DERBY-4313
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: dropUsingDMD.diff
>
>
> This loop in JDBC.dropUsingDMD() looks broken:
>         // Remove any statements from the list that succeeded.
> 		boolean didDrop = false;
> 		for (int i = 0; i < results.length; i++)
> 		{
> 			int result = results[i];
> 			if (result == -3 /* Statement.EXECUTE_FAILED*/)
> 				hadError = true;
> 			else if (result == -2/*Statement.SUCCESS_NO_INFO*/)
> 				didDrop = true;
> 			else if (result >= 0)
> 				didDrop = true;
> 			else
> 				Assert.fail("Negative executeBatch status");
>             
>             if (didDrop)
>                 ddl.set(i, null);
> 		}
> It is supposed to check the status of each individual statement executed in a batch,
and clear the successful ones from an ArrayList so that only the unsuccessful ones are left.
> However, if one of the statements is reported to have failed, and one of the proceeding
statements has been successful, the failed statement will be removed from the ArrayList because
didDrop is true. This means that some of the failed statements are not retried later. The
statements normally fail because some other object depends on the object being dropped, and
they usually succeed when they are retried after the other objects have been dropped. By not
retrying, some objects that were supposed to be dropped may be left in the database.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message