db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r692495 - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/sql/dictionary/ engine/org/apache/derby/impl/sql/catalog/ engine/org/apache/derby/impl/sql/depend/ engine/org/apache/derby/impl/sql/execute/ storeless/org/apache/derby/imp...
Date Fri, 05 Sep 2008 17:22:24 GMT
Author: kahatlen
Date: Fri Sep  5 10:22:24 2008
New Revision: 692495

URL: http://svn.apache.org/viewvc?rev=692495&view=rev
Log:
DERBY-3850: Remove unneeded workarounds for DERBY-177 and DERBY-3693

Removed the wait parameter from methods called from
SPSDescriptor.updateSYSSTATEMENTS() since waiting is prevented by
another mechanism now.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SPSDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/TabInfoImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTriggerConstantAction.java
    db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java?rev=692495&r1=692494&r2=692495&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
Fri Sep  5 10:22:24 2008
@@ -1072,15 +1072,13 @@
 	 *
 	 * @param descriptor	The descriptor to add
 	 * @param tc			The transaction controller
-	 * @param wait			To wait for lock or not
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
 	public void	addSPSDescriptor
 	(
 		SPSDescriptor 			descriptor,
-		TransactionController	tc,
-		boolean					wait
+		TransactionController	tc
 	) throws StandardException;
 
 	/**
@@ -1092,10 +1090,7 @@
 	 * @param recompile		whether to recompile or invalidate
 	 * @param updateSYSCOLUMNS indicate whether syscolumns needs to be updated
 	 *							or not.
-	 * @param wait		If true, then the caller wants to wait for locks. False will be
 	 * @param firstCompilation  first time SPS is getting compiled.
-	 * when we using a nested user xaction - we want to timeout right away if
-	 * the parent holds the lock.  (bug 4821)
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
@@ -1104,7 +1099,6 @@
 			TransactionController	tc,
 			boolean                 recompile,
 			boolean					updateSYSCOLUMNS,
-			boolean					wait,
 			boolean                 firstCompilation)
 						throws StandardException;
 
@@ -1947,36 +1941,6 @@
 		throws StandardException;
 
 
-	/**
-	 * Adds a descriptor to a system catalog identified by the catalogNumber. 
-	 *
-	 * @param tuple			   descriptor to insert.
-	 * @param parent           parent descriptor; e.g for a column parent is the
-	 * tabledescriptor to which the descriptor is beign inserted. for most other
-	 * objects it is the schema descriptor.
-	 * @param catalogNumber	   a value which identifies the catalog into which
-	 * the descriptor should be inserted. It is the users responsibility to
-	 * ensure that the catalogNumber is consistent with the tuple being
-	 * inserted. 
-	 * @see DataDictionary#SYSCONGLOMERATES_CATALOG_NUM
-	 * @param allowsDuplicates whether an exception should be thrown if the
-	 * insert results in a duplicate; if this parameter is FALSE then one
-	 * of the following exception will be thrown; LANG_OBJECT_ALREADY_EXISTS (if
-	 * parent is null) or LANG_OBJECT_ALREADY_EXISTS_IN_OBJECT (if parent is not
-	 * null). The error message is created by getting the name and type of the
-	 * tuple and parent.
-	 * @see org.apache.derby.impl.sql.catalog.DataDictionaryImpl#duplicateDescriptorException
-	 * @param 	tc	the transaction controller to use to do all of this.
-	 * @param wait  If true, then the caller wants to wait for locks. False will
-	 *	            be when we using a nested user xaction - we want to timeout 
-	 *              right away if the parent holds the lock. 
-	 * @see #addDescriptorArray
-	 */
-	public void addDescriptor(TupleDescriptor tuple, TupleDescriptor parent,
-							  int catalogNumber, boolean allowsDuplicates,
-							  TransactionController tc, boolean wait) 
-		throws StandardException;
-	
 	/** 
 	 * Remove all of the stored dependencies for a given dependent's ID 
 	 * from the data dictionary.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SPSDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SPSDescriptor.java?rev=692495&r1=692494&r2=692495&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SPSDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SPSDescriptor.java
Fri Sep  5 10:22:24 2008
@@ -1072,10 +1072,7 @@
 	private void updateSYSSTATEMENTS(LanguageConnectionContext lcc, int mode, TransactionController
tc)
 		throws StandardException
 	{
-		int[] 					colsToUpdate;
 		boolean					updateSYSCOLUMNS,  recompile;
-		//bug 4821 - we want to wait for locks if updating sysstatements on parent transaction
-		boolean wait = false;
 		boolean firstCompilation = false;
 		if (mode == RECOMPILE)
 		{
@@ -1106,14 +1103,12 @@
 
 		if (tc == null) { //bug 4821 - tc will passed null if we want to use the user transaction
 			tc = lcc.getTransactionExecute();
-			wait = true;
 		}
 
 		dd.updateSPS(this,
 					 tc, 
 					 recompile,
 					 updateSYSCOLUMNS,
-					 wait,
 					 firstCompilation);
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=692495&r1=692494&r2=692495&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
Fri Sep  5 10:22:24 2008
@@ -1790,23 +1790,12 @@
 							  TransactionController tc)
 		throws StandardException
 	{
-		addDescriptor(td, parent, catalogNumber, duplicatesAllowed, tc, true);
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	public void addDescriptor(TupleDescriptor td, TupleDescriptor parent,
-							  int catalogNumber, boolean duplicatesAllowed,
-							  TransactionController tc, boolean wait)
-		throws StandardException
-	{
 		TabInfoImpl ti =  (catalogNumber < NUM_CORE) ? coreInfo[catalogNumber] :
 			getNonCoreTI(catalogNumber);
 
 		ExecRow row = ti.getCatalogRowFactory().makeRow(td, parent);
 
-		int insertRetCode = ti.insertRow(row, tc, wait);
+		int insertRetCode = ti.insertRow(row, tc);
 
 		if (!duplicatesAllowed)
 		{
@@ -3377,9 +3366,6 @@
 	 * @param colsToSet 			Array of ints of columns to be modified,
 	 *								1 based.  May be null (all cols).
 	 * @param tc					The TransactionController to use
-	 * @param wait		If true, then the caller wants to wait for locks. False will be
-	 * when we using a nested user xaction - we want to timeout right away if the parent
-	 * holds the lock.  (bug 4821)
 	 *
 	 * @exception StandardException		Thrown on failure
 	 */
@@ -3387,8 +3373,7 @@
 										UUID		formerUUID,
 										String		formerName,
 										int[]		colsToSet,
-										TransactionController tc,
-										boolean wait)
+										TransactionController tc)
 		throws StandardException
 	{
 		ExecIndexRow				keyRow1 = null;
@@ -3458,8 +3443,7 @@
 					 SYSCOLUMNSRowFactory.SYSCOLUMNS_INDEX1_ID,
 					 bArray,
 					 colsToSet,
-					 tc,
-					 wait);
+					 tc);
 	}
 
 	/**
@@ -3959,8 +3943,7 @@
 	public void	addSPSDescriptor
 	(
 		SPSDescriptor 			descriptor,
-		TransactionController	tc,
-		boolean wait
+		TransactionController	tc
 	) throws StandardException
 	{
 		ExecRow        			row;
@@ -3982,7 +3965,7 @@
 			row = rf.makeSYSSTATEMENTSrow(compileMe, descriptor);
 	
 			// insert row into catalog and all its indices
-			insertRetCode = ti.insertRow(row, tc, wait);
+			insertRetCode = ti.insertRow(row, tc);
 		}
 
 		// Throw an exception duplicate table descriptor
@@ -3995,14 +3978,14 @@
 												 descriptor.getSchemaDescriptor().getSchemaName());
 		}
 
-		addSPSParams(descriptor, tc, wait);
+		addSPSParams(descriptor, tc);
 	}
 
 	/**
 	 * Add a column in SYS.SYSCOLUMNS for each parameter in the
 	 * parameter list.
 	 */
-	private void addSPSParams(SPSDescriptor spsd, TransactionController tc, boolean wait)
+	private void addSPSParams(SPSDescriptor spsd, TransactionController tc)
 			throws StandardException
 	{
 		UUID 					uuid = spsd.getUUID();
@@ -4034,7 +4017,7 @@
 										
 			addDescriptor(cd, null, SYSCOLUMNS_CATALOG_NUM, 
 						  false, // no chance of duplicates here
-						  tc, wait);
+						  tc);
 		}
 	}
 
@@ -4079,13 +4062,9 @@
 	 * @param tc			The transaction controller
 	 * @param updateParamDescriptors If true, will update the
 	 *						parameter descriptors in SYS.SYSCOLUMNS.
-	 * @param wait		If true, then the caller wants to wait for locks. False will be
 	 * @param firstCompilation  true, if Statement is getting compiled for first
 	 *                          time and SPS was created with NOCOMPILE option.
 	 *
-	 * when we using a nested user xaction - we want to timeout right away if the parent
-	 * holds the lock.  (bug 4821)
-	 *
 	 * @exception StandardException		Thrown on error
 	 */
 	public void	updateSPS(
@@ -4093,14 +4072,12 @@
 			TransactionController	tc,
 			boolean                 recompile,
 			boolean					updateParamDescriptors,
-			boolean					wait,
 			boolean                 firstCompilation)
 						throws StandardException
 	{
 		ExecIndexRow				keyRow1 = null;
 		ExecRow    					row;
 		DataValueDescriptor			idOrderable;
-		DataValueDescriptor			columnNameOrderable;
 		TabInfoImpl						ti = getNonCoreTI(SYSSTATEMENTS_CATALOG_NUM);
 		SYSSTATEMENTSRowFactory  rf = (SYSSTATEMENTSRowFactory) ti.getCatalogRowFactory();
 		int[] updCols;
@@ -4148,8 +4125,7 @@
 					 SYSSTATEMENTSRowFactory.SYSSTATEMENTS_INDEX1_ID,
 					 bArray,
 					 updCols,
-					 tc,
-					 wait);
+					 tc);
 
 
 		/*
@@ -4180,7 +4156,7 @@
 			 *creation time. As this is the first time we are compiling paramter
 			 *infor should be inserted instead of the update.
 			 */
-			addSPSParams(spsd, tc, wait);
+			addSPSParams(spsd, tc);
 		}
 		else
 		{
@@ -4220,8 +4196,7 @@
 									   cd.getReferencingUUID(), 
 									   cd.getColumnName(),
 									   columnsToSet, 
-									   tc,
-									   wait);
+									   tc);
 			}
 		}
 	}
@@ -5796,7 +5771,7 @@
 		}
 
 		// insert row into catalog and all its indices
-		ti.insertRow(row, tc, true);
+		ti.insertRow(row, tc);
 	}
 
 	/**
@@ -7309,8 +7284,7 @@
 								td.getUUID(),
 								columnName,
 								columnNameColArray, 
-								tc,
-								true);
+								tc);
 
 	}
 
@@ -7949,7 +7923,7 @@
 		TabInfoImpl						ti = getNonCoreTI(SYSDUMMY1_CATALOG_NUM);
 		ExecRow row = ti.getCatalogRowFactory().makeRow(null, null);
 
-		int insertRetCode = ti.insertRow(row, tc, true);
+		int insertRetCode = ti.insertRow(row, tc);
 	}
 
 	/**
@@ -9388,7 +9362,7 @@
 												   spsText, //sps text
 												   !nocompile );
 			
-			addSPSDescriptor(spsd, tc, true);
+			addSPSDescriptor(spsd, tc);
 		}
 	}
 
@@ -11834,7 +11808,7 @@
             //so that means we have to enter a new row in system catalog for
             //this grant.
             ExecRow row = ti.getCatalogRowFactory().makeRow( perm, (TupleDescriptor) null);
-            int insertRetCode = ti.insertRow(row, tc, true /* wait */);
+            int insertRetCode = ti.insertRow(row, tc);
             if( SanityManager.DEBUG)
                 SanityManager.ASSERT( insertRetCode == TabInfoImpl.ROWNOTDUPLICATE,
                                       "Race condition in inserting table privilege.");
@@ -11883,7 +11857,8 @@
                         changedColCount == colsToUpdate.length,
                         "return value of " + rf.getClass().getName() +
                         ".orPermissions does not match the number of booleans it set in colsChanged.");
-                ti.updateRow( key, existingRow, primaryIndexNumber, indicesToUpdate, colsToUpdate,
tc, true /* wait */);
+                ti.updateRow(key, existingRow, primaryIndexNumber,
+                             indicesToUpdate, colsToUpdate, tc);
             }
         }
         // Remove cached permissions data. The cache may hold permissions data for this key
even if

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/TabInfoImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/TabInfoImpl.java?rev=692495&r1=692494&r2=692495&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/TabInfoImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/TabInfoImpl.java Fri
Sep  5 10:22:24 2008
@@ -413,19 +413,18 @@
 	 *
 	 *	@param	row			row to insert
 	 *	@param	tc			transaction
-	 *	@param	wait		to wait on lock or quickly TIMEOUT
 	 *	@return	row number (>= 0) if duplicate row inserted into an index
 	 *			ROWNOTDUPLICATE otherwise
 	 *
 	 * @exception StandardException		Thrown on failure
 	 */
-	int insertRow( ExecRow row, TransactionController tc, boolean wait)
+	int insertRow( ExecRow row, TransactionController tc)
 		throws StandardException
 	{
 
 		RowLocation[] 			notUsed = new RowLocation[1]; 
 
-		return insertRowListImpl(new ExecRow[] {row},tc,notUsed, wait);
+		return insertRowListImpl(new ExecRow[] {row},tc,notUsed);
 	}
 
 	/**
@@ -446,7 +445,7 @@
 	{
 		RowLocation[] 			notUsed = new RowLocation[1]; 
 
-		return insertRowListImpl(rowList,tc,notUsed, true);
+		return insertRowListImpl(rowList,tc,notUsed);
 	}
 
 	/**
@@ -461,12 +460,11 @@
 	  @param tc	transaction controller
 	  @param rowLocationOut on output rowLocationOut[0] is set to the
 	         last RowLocation inserted.
-	  @param wait   to wait on lock or quickly TIMEOUT
 	  @return row number (>= 0) if duplicate row inserted into an index
 	  			ROWNOTDUPLICATE otherwise
 	 */
-	private int insertRowListImpl(ExecRow[] rowList, TransactionController tc, RowLocation[]
rowLocationOut,
-								   boolean wait)
+	private int insertRowListImpl(ExecRow[] rowList, TransactionController tc,
+                                  RowLocation[] rowLocationOut)
 		throws StandardException
 	{
 		ConglomerateController		heapController;
@@ -482,8 +480,7 @@
             tc.openConglomerate(
                 getHeapConglomerate(), 
                 false,
-				(TransactionController.OPENMODE_FORUPDATE |
-                    ((wait) ? 0 : TransactionController.OPENMODE_LOCK_NOWAIT)),
+				TransactionController.OPENMODE_FORUPDATE,
                 TransactionController.MODE_RECORD,
                 TransactionController.ISOLATION_REPEATABLE_READ);
 		
@@ -504,8 +501,7 @@
 		            tc.openConglomerate( 
 			            conglomNumber, 
                         false,
-						(TransactionController.OPENMODE_FORUPDATE |
-                    		((wait) ? 0 : TransactionController.OPENMODE_LOCK_NOWAIT)),
+						TransactionController.OPENMODE_FORUPDATE,
 					    TransactionController.MODE_RECORD,
 						TransactionController.ISOLATION_REPEATABLE_READ);
 			}
@@ -935,44 +931,12 @@
 						   int						indexNumber,
 						   boolean[]				indicesToUpdate,
 						   int[]					colsToUpdate,
-						   TransactionController	tc )
-		throws StandardException
-	{
-		updateRow(key, newRow, indexNumber, indicesToUpdate, colsToUpdate, tc, true);
-	}
-
-	/**
-	 * Updates a base row in a catalog and updates all the corresponding
-	 * index rows.
-	 *
-	 *	@param	key			key row
-	 *	@param	newRow		new version of the row
-	 *	@param	indexNumber	index that key operates
-	 *	@param	indicesToUpdate	array of booleans, one for each index on the catalog.
-	 *							if a boolean is true, that means we must update the
-	 *							corresponding index because changes in the newRow
-	 *							affect it.
-	 *	@param  colsToUpdate	array of ints indicating which columns (1 based)
-	 *							to update.  If null, do all.
-	 *	@param	tc			transaction controller
-	 *	@param wait		If true, then the caller wants to wait for locks. False will be
-	 *	when we using a nested user xaction - we want to timeout right away if the parent
-	 *	holds the lock.  (bug 4821)
-	 *
-	 * @exception StandardException		Thrown on failure
-	 */
-	void updateRow( ExecIndexRow				key, 
-						   ExecRow					newRow, 
-						   int						indexNumber,
-						   boolean[]				indicesToUpdate,
-						   int[]					colsToUpdate,
-						   TransactionController	tc,
-						   boolean	wait )
+						   TransactionController	tc)
 		throws StandardException
 	{
 		ExecRow[] newRows = new ExecRow[1];
 		newRows[0] = newRow;
-		updateRow(key, newRows, indexNumber, indicesToUpdate, colsToUpdate, tc, wait);
+		updateRow(key, newRows, indexNumber, indicesToUpdate, colsToUpdate, tc, true);
 	}
 
 	/**

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=692495&r1=692494&r2=692495&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
Fri Sep  5 10:22:24 2008
@@ -162,14 +162,16 @@
 				/* Add a stored dependency */
 				LanguageConnectionContext	lcc = getLanguageConnectionContext(cm);
 				DependencyDescriptor		dependencyDescriptor;
-				boolean wait = (tc == null);
+                // tc == null means do it in the user transaction
+                TransactionController tcToUse =
+                        (tc == null) ? lcc.getTransactionExecute() : tc;
 			
 				dependencyDescriptor = new DependencyDescriptor(d, p);
 
 				/* We can finally call the DataDictionary to store the dependency */
 				dd.addDescriptor(dependencyDescriptor, null,
 								 DataDictionary.SYSDEPENDS_CATALOG_NUM, true,
-								 ((wait)?lcc.getTransactionExecute():tc), wait);
+								 tcToUse);
 			}
 		}
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTriggerConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTriggerConstantAction.java?rev=692495&r1=692494&r2=692495&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTriggerConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTriggerConstantAction.java
Fri Sep  5 10:22:24 2008
@@ -399,7 +399,7 @@
 		spsd.prepareAndRelease(lcc, triggerTable);
 
 
-		dd.addSPSDescriptor(spsd, tc, true);
+		dd.addSPSDescriptor(spsd, tc);
 
 		return spsd;
 	}

Modified: db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java?rev=692495&r1=692494&r2=692495&view=diff
==============================================================================
--- db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
(original)
+++ db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
Fri Sep  5 10:22:24 2008
@@ -450,13 +450,13 @@
 	}
 
 	public void addSPSDescriptor(SPSDescriptor descriptor,
-			TransactionController tc, boolean wait) throws StandardException {
+			TransactionController tc) throws StandardException {
 		// TODO Auto-generated method stub
 
 	}
 
 	public void updateSPS(SPSDescriptor spsd, TransactionController tc,
-			boolean recompile, boolean updateSYSCOLUMNS, boolean wait,
+			boolean recompile, boolean updateSYSCOLUMNS,
 			boolean firstCompilation) throws StandardException {
 		// TODO Auto-generated method stub
 
@@ -794,12 +794,6 @@
 		return null;
 	}
 
-	public void addDescriptor(TupleDescriptor tuple, TupleDescriptor parent,
-			int catalogNumber, boolean allowsDuplicates,
-			TransactionController tc, boolean wait) throws StandardException {
-	}
-
-
 	public void dropDependentsStoredDependencies(UUID dependentsUUID,
 			TransactionController tc, boolean wait) throws StandardException {
 		// TODO Auto-generated method stub



Mime
View raw message