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 ma...@apache.org on 2008/05/15 21:21:30 UTC

svn commit: r656797 - /db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java

Author: mamta
Date: Thu May 15 12:21:30 2008
New Revision: 656797

URL: http://svn.apache.org/viewvc?rev=656797&view=rev
Log:
DERBY-3674

Inplace compress test in store/TransactionTable.sql started failing after the checkin for DERBY-1062.
Prior to the fix for DERBY-1062, an inplace compress request on VTI would return with no exception
although the code just ignored the compress request on VTI. After DERBY-1062 fix, Derby started
throwing exception. With the changes going through this commit, I am restoring the behavior to no-op
on inplace compress on VTI. I am doing this by making the check for VTI in SystemProcedure and returning
from it if it is a VTI. All the other inplace compress request get fulfilled through internal
generation of ALTER TABLE sql.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java?rev=656797&r1=656796&r2=656797&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java Thu May 15 12:21:30 2008
@@ -52,7 +52,10 @@
 import org.apache.derby.impl.load.Import;
 import org.apache.derby.impl.sql.execute.JarUtil;
 import org.apache.derby.jdbc.InternalDriver;
-
+import org.apache.derby.iapi.store.access.TransactionController;
+import org.apache.derby.iapi.sql.dictionary.DataDictionary;
+import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
+import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 
 /**
 	Some system built-in procedures, and help routines.  Now used for network server.
@@ -1053,7 +1056,33 @@
     int     truncateEnd)
 		throws SQLException
     {
- 
+    	//Inplace compress let's the user call compress on VTI but it
+    	//is really a no-op. In order to avoid having to go throught
+    	//the ALTER TABLE code just for a no-op, we simply do the check
+    	//here and return if we are dealing with VTI.
+		LanguageConnectionContext lcc       = ConnectionUtil.getCurrentLCC();
+		TransactionController     tc        = lcc.getTransactionExecute();
+
+		try 
+        {
+            DataDictionary data_dictionary = lcc.getDataDictionary();
+            SchemaDescriptor sd = 
+                data_dictionary.getSchemaDescriptor(schema, tc, true);
+            TableDescriptor  td = 
+                data_dictionary.getTableDescriptor(tablename, sd, tc);
+
+            if (td != null && td.getTableType() == TableDescriptor.VTI_TYPE)
+            {
+                return;
+            }
+        }
+		catch (StandardException se)
+		{
+			throw PublicAPI.wrapStandardException(se);
+		}
+
+		//Send all the other inplace compress requests to ALTER TABLE
+		//machinery
         String query = 
             "alter table " + "\"" + schema + "\"" + "." + "\"" +  tablename + "\"" + 
 			" compress inplace" +  (purgeRows != 0 ? " purge" : "")