You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Myrna van Lunteren <m....@gmail.com> on 2012/03/28 18:59:39 UTC
Re: svn commit: r1305451 - in /db/derby/code/branches/10.3/java:
engine/org/apache/derby/impl/sql/compile/ engine/org/apache/derby/impl/sql/execute/
testing/org/apache/derbyTesting/functionTests/tests/lang/ testing/org/apache/derbyTesting/junit/
On Mon, Mar 26, 2012 at 10:08 AM, <mi...@apache.org> wrote:
> Author: mikem
> Date: Mon Mar 26 17:08:57 2012
> New Revision: 1305451
>
> URL: http://svn.apache.org/viewvc?rev=1305451&view=rev
> Log:
> DERBY-4275: Query executions fail when compressing a table using SYSCS_UTIL.SYSCS_COMPRESS_TABLE
>
> backported changes #1142583 and #1160597 from trunk to 10.3 branch.
>
> Move invalidation of dependent statements until the system tables have
> been updated with information about the new conglomerates created by
> compression or truncation. This is to prevent that statements
> executing concurrently get recompiled too early and don't see the new
> conglomerates (and therefore fail on subsequent executions because
> they cannot find the old conglomerates).
>
> Fail in a controlled fashion (StandardException) if the conglomerate
> disappears while binding the FromBaseTable. This used to cause a
> NullPointerException.
>
> Did not backport the changes to TruncateTableTest. Truncate table
> functionality was released in 10.7, so changes did not apply to 10.5.
>
> Had to hand backport the CompressTableTest, removing tests for fixes not
> in 10.3.
>
>
> Added:
> db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CompressTableTest.java
> - copied unchanged from r1305136, db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CompressTableTest.java
> Modified:
> db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
> db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
> db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
> db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
>
> Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
> URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java?rev=1305451&r1=1305450&r2=1305451&view=diff
> ==============================================================================
> --- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java (original)
> +++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java Mon Mar 26 17:08:57 2012
> @@ -2305,6 +2305,14 @@ public class FromBaseTable extends FromT
> tableDescriptor.getHeapConglomerateId()
> );
>
> + // Bail out if the descriptor couldn't be found. The conglomerate
> + // probably doesn't exist anymore.
> + if (baseConglomerateDescriptor == null) {
> + throw StandardException.newException(
> + SQLState.STORE_CONGLOMERATE_DOES_NOT_EXIST,
> + new Long(tableDescriptor.getHeapConglomerateId()));
> + }
> +
> /* Build the 0-based array of base column names. */
> columnNames = resultColumns.getColumnNames();
>
>
> Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
> URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java?rev=1305451&r1=1305450&r2=1305451&view=diff
> ==============================================================================
> --- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java (original)
> +++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java Mon Mar 26 17:08:57 2012
> @@ -288,7 +288,7 @@ class AlterTableConstantAction extends D
> sd = getAndCheckSchemaDescriptor(dd, schemaId, "ALTER TABLE");
> }
>
> - /* Prepare all dependents to invalidate. (This is there chance
> + /* Prepare all dependents to invalidate. (This is their chance
> * to say that they can't be invalidated. For example, an open
> * cursor referencing a table/view that the user is attempting to
> * alter.) If no one objects, then invalidate any dependent objects.
> @@ -1199,14 +1199,6 @@ class AlterTableConstantAction extends D
> TransactionController.MODE_TABLE,
> TransactionController.ISOLATION_SERIALIZABLE);
>
> - // invalidate any prepared statements that depended on this table
> - // (including this one), this fixes problem with threads that start up
> - // and block on our lock, but do not see they have to recompile their
> - // plan. We now invalidate earlier however they still might recompile
> - // using the old conglomerate id before we commit our DD changes.
> - //
> - dm.invalidateFor(td, DependencyManager.COMPRESS_TABLE, lcc);
> -
> rl = compressHeapCC.newRowLocationTemplate();
>
> // Get the properties on the old heap
> @@ -1330,6 +1322,10 @@ class AlterTableConstantAction extends D
> // Update sys.sysconglomerates with new conglomerate #
> dd.updateConglomerateDescriptor(cd, newHeapConglom, tc);
>
> + // Now that the updated information is available in the system tables,
> + // we should invalidate all statements that use the old conglomerates
> + dm.invalidateFor(td, DependencyManager.COMPRESS_TABLE, lcc);
> +
> // Drop the old conglomerate
> tc.dropConglomerate(oldHeapConglom);
> cleanUp();
> @@ -1419,15 +1415,6 @@ class AlterTableConstantAction extends D
> TransactionController.MODE_TABLE,
> TransactionController.ISOLATION_SERIALIZABLE);
>
> - // invalidate any prepared statements that
> - // depended on this table (including this one)
> - // bug 3653 has threads that start up and block on our lock, but do
> - // not see they have to recompile their plan. We now invalidate earlier
> - // however they still might recompile using the old conglomerate id before we
> - // commit our DD changes.
> - //
> - dm.invalidateFor(td, DependencyManager.TRUNCATE_TABLE, lcc);
> -
> rl = compressHeapCC.newRowLocationTemplate();
> // Get the properties on the old heap
> compressHeapCC.getInternalTablePropertySet(properties);
> @@ -1512,6 +1499,11 @@ class AlterTableConstantAction extends D
>
> // Update sys.sysconglomerates with new conglomerate #
> dd.updateConglomerateDescriptor(cd, newHeapConglom, tc);
> +
> + // Now that the updated information is available in the system tables,
> + // we should invalidate all statements that use the old conglomerates
> + dm.invalidateFor(td, DependencyManager.TRUNCATE_TABLE, lcc);
> +
> // Drop the old conglomerate
> tc.dropConglomerate(oldHeapConglom);
> cleanUp();
>
> Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
> URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=1305451&r1=1305450&r2=1305451&view=diff
> ==============================================================================
> --- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java (original)
> +++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java Mon Mar 26 17:08:57 2012
> @@ -61,6 +61,7 @@ public class _Suite extends BaseTestCase
>
> suite.addTest(org.apache.derbyTesting.functionTests.tests.memory.TriggerTests.suite());
> suite.addTest(AnsiTrimTest.suite());
> + suite.addTest(CompressTableTest.suite());
> suite.addTest(CreateTableFromQueryTest.suite());
> suite.addTest(DatabaseClassLoadingTest.suite());
> suite.addTest(DynamicLikeOptimizationTest.suite());
>
> Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
> URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=1305451&r1=1305450&r2=1305451&view=diff
> ==============================================================================
> --- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original)
> +++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Mon Mar 26 17:08:57 2012
> @@ -531,11 +531,11 @@ public abstract class BaseTestCase
> *
> * @exception AssertionFailedError
> */
> - public static void fail(String msg, Exception e)
> + public static void fail(String msg, Throwable t)
> throws AssertionFailedError {
>
> AssertionFailedError ae = new AssertionFailedError(msg);
> - ae.initCause(e);
> + ae.initCause(t);
> throw ae;
> }
>
>
>
This commit caused the following javadoc build warning:
[javadoc] D:\svnnightlies\v10_3\src\opensource\java\testing\org\apache\derbyTesting\junit\BaseTestCase.java:534:
warning - @param argument "e" is not a parameter name.
Myrna