db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1479562 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql: compile/CreateViewNode.java depend/BasicDependencyManager.java
Date Mon, 06 May 2013 13:18:59 GMT
Author: kahatlen
Date: Mon May  6 13:18:58 2013
New Revision: 1479562

URL: http://svn.apache.org/r1479562
Log:
DERBY-6169: Reduce visibility of classes and methods under impl/sql

Remove the CreateViewNode.getProviderInfo() method in which a bug (it
returns colInfos instead of providerInfos) was introduced in revision
1477476.

Also remove the single caller of that method, as it appears to be dead
code that was only needed for views that had been created with a
pre-Derby version of the engine. Since upgrade is only supported from
other Derby versions, that logic should not be needed anymore.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java?rev=1479562&r1=1479561&r2=1479562&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java
Mon May  6 13:18:58 2013
@@ -21,12 +21,10 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import java.util.List;
 
 import org.apache.derby.iapi.sql.compile.Visitor;
 
 import org.apache.derby.iapi.services.context.ContextManager;
-import org.apache.derby.iapi.services.io.ArrayUtil;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
 import org.apache.derby.iapi.error.StandardException;
@@ -164,12 +162,6 @@ public class CreateViewNode extends DDLS
 		}
 	}
 
-	// accessors
-
-    public final List getProviderInfo() {
-        return ArrayUtil.asReadOnlyList(colInfos);
-    }
-
 	// We inherit the generate() method from DDLStatementNode.
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java?rev=1479562&r1=1479561&r2=1479562&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java
Mon May  6 13:18:58 2013
@@ -35,8 +35,6 @@ import org.apache.derby.iapi.error.Stand
 import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.io.FormatableBitSet;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.sql.compile.CompilerContext;
-import org.apache.derby.iapi.sql.compile.Parser;
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
 import org.apache.derby.iapi.sql.conn.StatementContext;
 import org.apache.derby.iapi.sql.depend.Dependency;
@@ -47,11 +45,9 @@ import org.apache.derby.iapi.sql.depend.
 import org.apache.derby.iapi.sql.depend.ProviderList;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.DependencyDescriptor;
-import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ViewDescriptor;
 import org.apache.derby.iapi.store.access.TransactionController;
-import org.apache.derby.impl.sql.compile.CreateViewNode;
 
 /**
  * The dependency manager tracks needs that dependents have of providers.
@@ -69,7 +65,7 @@ import org.apache.derby.impl.sql.compile
  * Note that stored dependencies should not be accessed while holding the
  * monitor of {@code this}, as this may result in deadlocks. So far the need
  * for synchronization across both in-memory and stored dependencies hasn't
- * occured.
+ * occurred.
  */
 public class BasicDependencyManager implements DependencyManager {
   
@@ -334,6 +330,13 @@ public class BasicDependencyManager impl
 		// if we passed in table descriptor to this function with a bit map,
 		// we really need this, we generate the bitmaps on the fly and update
 		// SYSDEPENDS
+        //
+        // Note: Since the "previous version of server" mentioned above must
+        // be a version that predates Derby, and we don't support upgrade from
+        // those versions, we no longer have code to generate the column
+        // dependency list on the fly. Instead, an assert has been added to
+        // verify that we always have a column bitmap in SYSDEPENDS if the
+        // affectedCols bitmap is non-null.
 
 		FormatableBitSet affectedCols = null, subsetCols = null;
 		if (p instanceof TableDescriptor)
@@ -363,60 +366,20 @@ public class BasicDependencyManager impl
 					{
 						if (dep instanceof ViewDescriptor)
 						{
-							ViewDescriptor vd = (ViewDescriptor) dep;
-							SchemaDescriptor compSchema;
-							compSchema = dd.getSchemaDescriptor(vd.getCompSchemaId(), null);
-							CompilerContext newCC = lcc.pushCompilerContext(compSchema);
-							Parser	pa = newCC.getParser();
-
-							// Since this is always nested inside another SQL
-							// statement, so topLevel flag should be false
-							CreateViewNode cvn = (CreateViewNode)pa.parseStatement(
-												vd.getViewText());
-
-							// need a current dependent for bind
-							newCC.setCurrentDependent(dep);
-							cvn.bindStatement();
-							lcc.popCompilerContext(newCC);
-
-							boolean		interferent = false;
-
-                            Iterator it = cvn.getProviderInfo().iterator();
-                            while (it.hasNext())
-							{
-                                ProviderInfo info = (ProviderInfo) it.next();
-                                Provider provider = (Provider) info.
-													getDependableFinder().
-													getDependable(dd,
-                                                    info.getObjectId());
-								if (provider instanceof TableDescriptor)
-								{
-									TableDescriptor tab = (TableDescriptor)provider;
-									FormatableBitSet colMap = tab.getReferencedColumnMap();
-									if (colMap == null)
-										continue;
-									// if later on an error is raised such as in
-									// case of interference, this dependency line
-									// upgrade will not happen due to rollback
-									tab.setReferencedColumnMap(null);
-									dropDependency(lcc, vd, tab);
-									tab.setReferencedColumnMap(colMap);
-									addDependency(vd, tab, lcc.getContextManager());
-
-									if (tab.getObjectID().equals(td.getObjectID()))
-									{
-                                        subsetCols.copyFrom( affectedCols );
-										subsetCols.and(colMap);
-										if (subsetCols.anySetBit() != -1)
-										{
-											interferent = true;
-											((TableDescriptor) p).setReferencedColumnMap(subsetCols);
-										}
-									}
-								}	// if provider instanceof TableDescriptor
-							}	// for providerInfos
-							if (! interferent)
-								continue;
+                            // If the table descriptor that was passed in had a
+                            // column bit map, so should the provider's table
+                            // descriptor. Views that were created with a
+                            // database version that predates Derby could lack
+                            // a bitmap in the provider and needed to
+                            // reconstruct it here by parsing and binding the
+                            // original CREATE VIEW statement. However, since
+                            // we don't support upgrade from pre-Derby versions,
+                            // this code was removed as part of DERBY-6169.
+                            if (SanityManager.DEBUG)
+                            {
+                                SanityManager.THROWASSERT("Expected view to " +
+                                        "have referenced column bitmap");
+                            }
 						}	// if dep instanceof ViewDescriptor
 						else
 							((TableDescriptor) p).setReferencedColumnMap(null);



Mime
View raw message