db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject svn commit: r634540 - in /db/derby/code/trunk/java/engine/org/apache/derby: catalog/types/IndexDescriptorImpl.java impl/sql/execute/CreateIndexConstantAction.java impl/store/access/btree/BTreeController.java
Date Fri, 07 Mar 2008 05:15:54 GMT
Author: mikem
Date: Thu Mar  6 21:15:51 2008
New Revision: 634540

URL: http://svn.apache.org/viewvc?rev=634540&view=rev
Log:
DERBY-3330
submitted by Anurag Shekhar
This commit is of the derby-3330_followup_1_modified.diff.

CreateIndexConstantAction.java

I have changed the name of the variable and added comment to explain what its meant for.
I got confused while commenting last time. This property is required if
TransactionCoordinator has to select the non default Sorter.


BTreeController.java

I haven't optimized it yet. But instead of returning error code setting the ret value so the
latch
is cleared before return.


IndexDescriptorImpl.java

Updated both the place (using new name in toString () and using the new attribute in equals
methods).



Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/IndexDescriptorImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeController.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/IndexDescriptorImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/IndexDescriptorImpl.java?rev=634540&r1=634539&r2=634540&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/IndexDescriptorImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/IndexDescriptorImpl.java
Thu Mar  6 21:15:51 2008
@@ -216,7 +216,7 @@
 		if (isUnique)
 			sb.append("UNIQUE ");
 		else if (isUniqueWithDuplicateNulls)
-			sb.append ("ALMOST UNIQUE");
+			sb.append ("UNIQUE WITH DUPLICATE NULLS");
 
 		sb.append(indexType);
 
@@ -318,12 +318,14 @@
 			** Check all the fields for equality except for the array
 			** elements (this is hardest, so save for last)
 			*/
-			if ((id.isUnique == this.isUnique) &&
-				(id.isUnique == this.isUnique) &&
-				(id.baseColumnPositions.length ==
-										this.baseColumnPositions.length) &&
-				(id.numberOfOrderedColumns == this.numberOfOrderedColumns) &&
-					(id.indexType.equals(this.indexType)))
+			if ((id.isUnique == this.isUnique)       &&
+                (id.isUniqueWithDuplicateNulls == 
+                    this.isUniqueWithDuplicateNulls) &&
+                (id.baseColumnPositions.length ==
+                    this.baseColumnPositions.length) &&
+                (id.numberOfOrderedColumns     == 
+                    this.numberOfOrderedColumns)     &&
+                (id.indexType.equals(this.indexType)))
 			{
 				/*
 				** Everything but array elements known to be true -
@@ -335,8 +337,8 @@
 				{
 					/* If any array element is not equal, return false */
 					if ((id.baseColumnPositions[i] !=
-						this.baseColumnPositions[i]) || (id.isAscending[i] !=
-						this.isAscending[i]))
+						 this.baseColumnPositions[i]) || 
+                        (id.isAscending[i] != this.isAscending[i]))
 					{
 						retval = false;
 						break;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java?rev=634540&r1=634539&r2=634540&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java
Thu Mar  6 21:15:51 2008
@@ -727,19 +727,23 @@
 			 * so that we can reuse the wrappers during an external
 			 * sort.
 			 */
-			int numColumnOrderings;
-			SortObserver sortObserver = null;
+			int             numColumnOrderings;
+			SortObserver    sortObserver   = null;
+            Properties      sortProperties = null;
 			if (unique || uniqueWithDuplicateNulls)
 			{
-				// if the index is a constraint, use constraintname in possible error messagge
+				// if the index is a constraint, use constraintname in 
+                // possible error message
 				String indexOrConstraintName = indexName;
 				if  (conglomerateUUID != null)
 				{
-					ConglomerateDescriptor cd = dd.getConglomerateDescriptor(conglomerateUUID);
-					if ((isConstraint) && (cd != null && cd.getUUID() != null &&
td != null))
+					ConglomerateDescriptor cd = 
+                        dd.getConglomerateDescriptor(conglomerateUUID);
+					if ((isConstraint) && 
+                        (cd != null && cd.getUUID() != null && td != null))
 					{
-						ConstraintDescriptor conDesc = dd.getConstraintDescriptor(td,
-                                                                      cd.getUUID());
+						ConstraintDescriptor conDesc = 
+                            dd.getConstraintDescriptor(td, cd.getUUID());
 						indexOrConstraintName = conDesc.getConstraintName();
 					}
 				}
@@ -763,8 +767,10 @@
 
 					numColumnOrderings = baseColumnPositions.length + 1;
 
-					properties = new Properties();
-					properties.put(
+                    // tell transaction controller to use the unique with 
+                    // duplicate nulls sorter, when making createSort() call.
+					sortProperties = new Properties();
+					sortProperties.put(
                         AccessFactoryGlobals.IMPL_TYPE, 
                         AccessFactoryGlobals.SORT_UNIQUEWITHDUPLICATENULLS_EXTERNAL);
 					//use sort operator which treats nulls unequal
@@ -797,7 +803,7 @@
 			}
 
 			// create the sorter
-			sortId = tc.createSort((Properties)properties, 
+			sortId = tc.createSort((Properties)sortProperties, 
 					indexTemplateRow.getRowArrayClone(),
 					order,
 					sortObserver,

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeController.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeController.java?rev=634540&r1=634539&r2=634540&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeController.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeController.java
Thu Mar  6 21:15:51 2008
@@ -807,11 +807,15 @@
                 // on the page returned by the search.
                 insert_slot = sp.resultSlot + 1;
                 result_slot = insert_slot + 1;
-                if (getConglomerate().isUniqueWithDuplicateNulls()) {
+                if (getConglomerate().isUniqueWithDuplicateNulls()) 
+                {
                     int ret = compareLeftAndRightSiblings(rowToInsert, 
                             insert_slot, targetleaf);
-                    if (ret == MATCH_FOUND)
-                        return ConglomerateController.ROWISDUPLICATE;
+                    if (ret == MATCH_FOUND) 
+                    {
+                        ret_val = ConglomerateController.ROWISDUPLICATE;
+                        break;
+                    }
                     if (ret == RESCAN_REQUIRED)
                         continue;
                 }
@@ -844,11 +848,15 @@
 
                 // start splitting ...
             }
-            if (getConglomerate().isUniqueWithDuplicateNulls()) {
+            if (getConglomerate().isUniqueWithDuplicateNulls()) 
+            {
                 int ret = compareLeftAndRightSiblings(rowToInsert, 
                         insert_slot, targetleaf);
-                if (ret == MATCH_FOUND)
-                    return ConglomerateController.ROWISDUPLICATE;
+                if (ret == MATCH_FOUND) 
+                {
+                    ret_val = ConglomerateController.ROWISDUPLICATE;
+                    break;
+                }
                 if (ret == RESCAN_REQUIRED)
                     continue;
             }



Mime
View raw message