You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2006/07/25 20:26:34 UTC

svn commit: r425479 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java

Author: djd
Date: Tue Jul 25 11:26:33 2006
New Revision: 425479

URL: http://svn.apache.org/viewvc?rev=425479&view=rev
Log:
DERBY-1581 Avoid reloading the Provider from the data dictionary when
executing an invalidateFor on the Provider. Previosuly the code
when loading the stored dependencies and converting them to an in-memory from
reloaded the provider once per dependent. This patch re-uses the Provider
passed into the invalidateFor method.

Modified:
    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/depend/BasicDependencyManager.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java?rev=425479&r1=425478&r2=425479&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 Tue Jul 25 11:26:33 2006
@@ -1133,16 +1133,17 @@
 	 *
 	 * @param storedList	The List of DependencyDescriptors representing
 	 *						stored dependencies.
+	 * @param providerForList The provider if this list is being created
+	 *                        for a list of dependents. Null otherwise.
 	 * 
 	 * @return List		The converted List
 	 *
 	 * @exception StandardException thrown if something goes wrong
 	 */
-	private List getDependencyDescriptorList(List storedList)
+	private List getDependencyDescriptorList(List storedList,
+			Provider providerForList)
 		throws StandardException
 	{
-		DataDictionary		 dd = getDataDictionary();
-
 		if (storedList.size() != 0)
 		{
 			/* For each DependencyDescriptor, we need to instantiate
@@ -1165,13 +1166,26 @@
 					finder = depDesc.getDependentFinder();
 					tempD = (Dependent) finder.getDependable( depDesc.getUUID() );
 
-					finder = depDesc.getProviderFinder();
-					tempP = (Provider) finder.getDependable( depDesc.getProviderID() );
-/*					if (finder instanceof DDColumnDependableFinder)
-						((TableDescriptor)tempP).setReferencedColumnMap(
-							new FormatableBitSet(((DDColumnDependableFinder) finder).
-										getColumnBitMap()));
-*/
+					if (providerForList != null)
+					{
+						// Use the provider being passed in.
+						tempP = providerForList;
+						
+						// Sanity check the object identifiers match.
+						if (SanityManager.DEBUG) {
+							if (!tempP.getObjectID().equals(depDesc.getProviderID()))
+							{
+								SanityManager.THROWASSERT("mismatch providers");
+							}
+						}
+					}
+					else
+					{
+						finder = depDesc.getProviderFinder();
+						tempP = (Provider) finder.getDependable( depDesc.getProviderID() );
+						
+					}
+
 				} catch (java.sql.SQLException te) {
 					throw StandardException.newException(SQLState.DEP_UNABLE_TO_RESTORE, finder.getClass().getName(), te.getMessage());
 
@@ -1268,7 +1282,7 @@
 
 		@exception StandardException thrown if something goes wrong
 	 */
-	protected List getProviders (Dependent d) throws StandardException {
+	private List getProviders (Dependent d) throws StandardException {
 
 		List deps = (List) dependents.get(d.getObjectID());
 
@@ -1298,7 +1312,8 @@
 							getDataDictionary().
 								getDependentsDescriptorList(
 												d.getObjectID().toString()
-															)
+															),
+								(Provider) null
 													);
 
 			if (storedList.size() > 0)
@@ -1319,7 +1334,7 @@
 
 		@exception StandardException thrown if something goes wrong
 	 */
-	protected List getDependents (Provider p) 
+	private List getDependents (Provider p) 
 			throws StandardException {
 
 		List deps = (List) providers.get(p.getObjectID());
@@ -1330,7 +1345,7 @@
 		*/
 		if (! p.isPersistent())
 		{
-			return (deps == null? null : deps);
+			return deps;
 		}
 		else
 		{
@@ -1350,7 +1365,8 @@
 							getDataDictionary().
 								getProvidersDescriptorList(
 												p.getObjectID().toString()
-															)
+															),
+							p
 													);
 			if (storedList.size() > 0)
 			{