db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject svn commit: r168025 - in /incubator/derby/code/trunk/java: engine/org/apache/derby/impl/store/raw/data/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/tests/store/
Date Wed, 04 May 2005 00:16:46 GMT
Author: mikem
Date: Tue May  3 17:16:44 2005
New Revision: 168025

URL: http://svn.apache.org/viewcvs?rev=168025&view=rev
Log:
enhancing online compress testing.


Added:
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/OnlineCompressTest.out
Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/D_DiagnosticUtil.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/BaseTest.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/D_DiagnosticUtil.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/D_DiagnosticUtil.java?rev=168025&r1=168024&r2=168025&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/D_DiagnosticUtil.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/D_DiagnosticUtil.java
Tue May  3 17:16:44 2005
@@ -100,7 +100,6 @@
     }
 
     /* Public Methods of This class: */
-
     /**
      * Given a Database name and conglomid print out diagnostic info.
      * <p>
@@ -110,12 +109,19 @@
      * configuration, will only print out a fixed length (default 128 bytes),
      * so having ij print the string can be a problem.
      * <p>
-     * RESOLVE - example does not work in version 10.x and later 
      *
      * Can be called from ij to find out info about conglomid 19 in database
      * 'msgdb' by using the following syntax:
      *
-          values 
+       maximumdisplaywidth 9000;
+
+       CREATE FUNCTION D_CONGLOMID_PRINT(DBNAME VARCHAR(128), CONGLOMID INT)
+       RETURNS VARCHAR(32000) RETURNS NULL ON NULL INPUT
+       EXTERNAL NAME
+       'org.apache.derby.impl.store.raw.data.D_DiagnosticUtil.diag_conglomid_print'
+       LANGUAGE JAVA PARAMETER STYLE JAVA;
+
+       values D_CONGLOMID_PRINT('msgdb', 19);
           com.ibm.db2j.protocol.BasicServices.Diagnostic.T_Diagnosticable::
           diag_conglomid_print('msgdb', 19);
      *
@@ -154,6 +160,17 @@
      *     values 
      *     com.ibm.db2j.protocol.BasicServices.Diagnostic.T_Diagnosticable::
      *     diag_conglomid('msgdb', 19);
+       maximumdisplaywidth 9000;
+
+       CREATE FUNCTION DIAG_CONGLOMID(DBNAME VARCHAR(128), CONGLOMID INT)
+       RETURNS VARCHAR(32000) RETURNS NULL ON NULL INPUT
+       EXTERNAL NAME
+       'org.apache.derby.impl.store.raw.data.D_DiagnosticUtil.diag_conglomid'
+       LANGUAGE JAVA PARAMETER STYLE JAVA;
+
+       values DIAG_CONGLOMID('msgdb', 19);
+          com.ibm.db2j.protocol.BasicServices.Diagnostic.T_Diagnosticable::
+          diag_conglomid_print('msgdb', 19);
      *
      * RESOLVE - An interface that takes a table name would be nice.
      *
@@ -198,7 +215,6 @@
 
         return(ret_string);
     }
-
 
     /**
      * Dump raw contents of a page.

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java?rev=168025&r1=168024&r2=168025&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java
Tue May  3 17:16:44 2005
@@ -1399,12 +1399,8 @@
 				prev_alloc_page = null;
             }
 
-            System.out.println("calling flushAll()");
-
             // flush all changes to this file from cache.
             flushAll();
-
-            System.out.println("calling discard."); 
 
             // make sure all truncated pages are removed from the cache,
             // as it will get confused in the future if we allocate the same

Added: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/OnlineCompressTest.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/OnlineCompressTest.out?rev=168025&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/OnlineCompressTest.out
(added)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/OnlineCompressTest.out
Tue May  3 17:16:44 2005
@@ -0,0 +1,35 @@
+conn 2 from ij.startJBMS() = EmbedConnection
+Beginning test: test1
+Executing test: begin 0 row test, create = true, drop = false.
+Executing test: no delete case complete.
+Executing test: delete all rows case succeeded.
+Executing test: end 0 row test.
+Executing test: begin 0 row test, create = false, drop = true.
+Executing test: no delete case complete.
+Executing test: delete all rows case succeeded.
+Executing test: end 0 row test.
+Executing test: begin 1 row test, create = true, drop = false.
+Executing test: no delete case complete.
+Executing test: delete all rows case succeeded.
+Executing test: end 1 row test.
+Executing test: begin 1 row test, create = false, drop = true.
+Executing test: no delete case complete.
+Executing test: delete all rows case succeeded.
+Executing test: end 1 row test.
+Executing test: begin 50 row test, create = true, drop = false.
+Executing test: no delete case complete.
+Executing test: delete all rows case succeeded.
+Executing test: end 50 row test.
+Executing test: begin 50 row test, create = false, drop = true.
+Executing test: no delete case complete.
+Executing test: delete all rows case succeeded.
+Executing test: end 50 row test.
+Executing test: begin 10000 row test, create = true, drop = false.
+Executing test: no delete case complete.
+Executing test: delete all rows case succeeded.
+Executing test: end 10000 row test.
+Executing test: begin 10000 row test, create = false, drop = true.
+Executing test: no delete case complete.
+Executing test: delete all rows case succeeded.
+Executing test: end 10000 row test.
+Ending test: test1

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/BaseTest.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/BaseTest.java?rev=168025&r1=168024&r2=168025&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/BaseTest.java
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/BaseTest.java
Tue May  3 17:16:44 2005
@@ -26,12 +26,25 @@
 
 import java.sql.Connection;
 import java.sql.Statement;
+import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 
 
+
+/**
+Common utility functions that can be shared across store .java tests.
+<p>
+If more than one store tests wants a function, put it here rather than copy
+it.  Hopefully going forward, with enough utility functions adding new store
+tests will be easier.  New store tests should extend this test to pick
+up access to utility routines - see OnlineCompressTest.java as an example.
+
+**/
 public abstract class BaseTest
 {
+    private static boolean debug_system_procedures_created = false;
+
     abstract void testList(Connection conn) throws SQLException;
 
     void runTests(String[] argv)
@@ -126,5 +139,77 @@
         conn.commit();
 
         return(consistent);
+    }
+
+    /**
+     * Create a system procedures to access SANE debug table routines.
+     * <p>
+     **/
+    protected void createDebugSystemProcedures(
+    Connection  conn)
+		throws SQLException
+    {
+        Statement s = conn.createStatement();
+        s.executeUpdate(
+            "CREATE FUNCTION D_CONGLOMID_PRINT(DBNAME VARCHAR(128), CONGLOMID INT) RETURNS
VARCHAR(32000) RETURNS NULL ON NULL INPUT EXTERNAL NAME 'org.apache.derby.impl.store.raw.data.D_DiagnosticUtil.diag_conglomid'
LANGUAGE JAVA PARAMETER STYLE JAVA");
+        s.executeUpdate(
+            "CREATE FUNCTION DIAG_CONGLOMID(DBNAME VARCHAR(128), CONGLOMID INT) RETURNS VARCHAR(32000)
RETURNS NULL ON NULL INPUT EXTERNAL NAME 'org.apache.derby.impl.store.raw.data.D_DiagnosticUtil.diag_conglomid'
LANGUAGE JAVA PARAMETER STYLE JAVA");
+        s.close();
+        conn.commit();
+
+        debug_system_procedures_created = true;
+    }
+
+    /**
+     * Return string with table information.
+     * <p>
+     * Dumps summary store information about the table, also dumps extra
+     * information about individual pages into the error log file.
+     **/
+    String dump_table(
+    Connection  conn,
+    String      schemaName,
+    String      tableName)
+		throws SQLException
+    {
+        if (!debug_system_procedures_created)
+            createDebugSystemProcedures(conn);
+
+        // run the following query:
+        //
+        // select
+        //     sys.systables.tablename,
+        //     sys.sysconglomerates.conglomeratenumber,
+        //     DIAG_CONGLOMID('wombat', conglomeratenumber)
+        // from sys.systables, sys.sysconglomerates
+        // where
+        //     sys.systables.tableid = sys.sysconglomerates.tableid and
+        //     sys.systables.schemaid = sys.sysconglomerates.schemaid and
+        //     sys.systables.tablename = tableName;
+        //
+        // TODO - really should join with schemaName too.
+
+        PreparedStatement ps = 
+            conn.prepareStatement(
+                "select sys.systables.tablename, sys.sysconglomerates.conglomeratenumber,
DIAG_CONGLOMID('wombat', conglomeratenumber) from sys.systables, sys.sysconglomerates where
sys.systables.tableid = sys.sysconglomerates.tableid and sys.systables.schemaid = sys.sysconglomerates.schemaid
and sys.systables.tablename = ?");
+        ps.setString(1, tableName);
+        ResultSet rs = ps.executeQuery();
+
+        if (!rs.next())
+        {
+            if (SanityManager.DEBUG)
+            {
+                SanityManager.THROWASSERT("no value from values clause.");
+            }
+        }
+
+        String dump_table_info = rs.getString(3);
+
+        rs.close();
+
+        conn.commit();
+
+        return(dump_table_info);
+
     }
 }

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java?rev=168025&r1=168024&r2=168025&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineCompressTest.java
Tue May  3 17:16:44 2005
@@ -36,7 +36,7 @@
 
 public class OnlineCompressTest extends BaseTest
 {
-    boolean verbose = true;
+    boolean verbose = false;
 
     OnlineCompressTest()
     {
@@ -191,6 +191,24 @@
 
 
 
+    /**
+     * Create and load a table.
+     * <p>
+     * If create_table is set creates a test data table with indexes.
+     * Loads num_rows into the table.  This table defaults to 32k page size.
+     * This schema fits 25 rows per page
+     * <p>
+     *
+	 * @return The identifier to be used to open the conglomerate later.
+     *
+     * @param conn          Connection to use for sql execution.
+     * @param create_table  If true, create new table - otherwise load into
+     *                      existing table.
+     * @param tblname       table to use.
+     * @param num_rows      number of rows to add to the table.
+     *
+	 * @exception  StandardException  Standard exception policy.
+     **/
     private void createAndLoadTable(
     Connection  conn,
     boolean     create_table,
@@ -373,7 +391,7 @@
      * loop through testing interesting row count cases.  The cases are
      * 0  rows     - basic edge case, 2 page table: 1 alloc, 1 user page
      * 1  row      - another edge case, 2 page table: 1 alloc, 1 user page
-     * TODO        - 3 page table case: 1 alloc, 1 user page, 1 user page freed
+     * 50 rows     - 3 page table case: 1 alloc, 1 user page, 1 user page freed
      * 10000 rows  - reasonable number of pages to test out, still 1 alloc page
      *
      * These tests can be run relatively quickly, not a lot of rows needed.



Mime
View raw message