This looks like a bug to me, I recommend you open one. †You might also try SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE. †If you can copy the DB to your dev environment, reproduce the issue, and run a derby 10.8.2.2 built with line numbers, it would probably help the devs pinpoint the issue.

Brett

On Wed, Sep 5, 2012 at 5:11 AM, Erick Lichtas <elichtas@lichtasweb.com> wrote:

Hi Everyone,

I am having an issue with the SYSCS_UTIL.SYSCS_COMPRESS_TABLE operation on a large table in Derby 10.8.2.2.

Statement stmt = null;

CallableStatement cs = null;

try {

†††††† String sql = "select schemaname, tablename from sys.sysschemas s, "

††††††††††††† + "sys.systables t where s.schemaid=t.schemaid and t.tabletype='T'";

†††††† stmt = con.createStatement();

†††††† ResultSet rs = stmt.executeQuery(sql);

†††††† cs = con.prepareCall("call SYSCS_UTIL.SYSCS_COMPRESS_TABLE(?, ?, ?)");

†††††† while (rs.next()) {

††††††††††††† String schema = rs.getString(1).trim();

††††††††††††† String table = rs.getString(2).trim();

††††††††††††† log("Compressing " + schema + "." + table + "...");

††††††††††††† cs.setString(1, schema);

††††††††††††† cs.setString(2, table);

††††††††††††† cs.setShort(3, (short) 1);

††††††††††††† cs.execute();

†††††† }

}

finally {

†††††† if (stmt != null) {

††††††††††††† stmt.close();

†††††† }

†††††† if (cs != null) {

††††††††††††† cs.close();

†††††† }

}

The above code, successfully runs over 3 of 20 some tables, then hits the 4th table with over 2 million records.† After working on this table for about 5 minutes, the process terminates with an SQLException wrapping a NPE.†

This happened in a production instance and I have not yet set up a reproduction in a development environment.† Iím wondering if anyone has any thoughts based on the stacktrace below?

com.linoma.gaservices.upgrader.UpgradeException: Java exception: ': java.lang.NullPointerException'.

††††††††††††††† at com.linoma.gaservices.upgrader.DefaultUpgrader.upgrade(DefaultUpgrader.java:227)

††††††††††††††† at com.linoma.gaservices.upgrader.UnixUpgrader.upgrade(UnixUpgrader.java:32)

††††††††††††††† at com.linoma.gaservices.upgrader.UpgradeStarter.startUpgrade(UpgradeStarter.java:25)

††††††††††††††† at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

††††††††††††††† at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)

††††††††††††††† at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

††††††††††††††† at java.lang.reflect.Method.invoke(Method.java:618)

††††††††††††††† at my.app.upgrader.Startup.main(Startup.java:72)

Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.

††††††††††††††† at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)

††††††††††††††† at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)

††††††††††††††† at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)

††††††††††††††† at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)

††††††††††††††† at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)

††††††††††††††† at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)

††††††††††††††† at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)

††††††††††††††† at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Unknown Source)

††††††††††††††† at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)

††††††††††††††† at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)

††††††††††††††† at java.sql.DriverManager.getConnection(DriverManager.java:572)

††††††††††††††† at java.sql.DriverManager.getConnection(DriverManager.java:218)

††††††††††††††† at my.app.upgrader.db.DerbyDatabaseUpgrader.closeDB(DerbyDatabaseUpgrader.java:99)

††††††††††††††† at my.app.upgrader.DefaultUpgrader.upgrade(DefaultUpgrader.java:223)

††††††††††††††† ... 7 more††††††††††††††††††††††††††††

Caused by: java.lang.NullPointerException

††††††††††††††† at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Unknown Source)

††††††††††††††† at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Unknown Source)

††††††††††††††† at org.apache.derby.impl.store.raw.xact.Xact.openContainer(Unknown Source)

††††††††††††††† at org.apache.derby.impl.store.access.conglomerate.OpenConglomerate.init(Unknown Source)

††††††††††††††† at org.apache.derby.impl.store.access.heap.Heap.open(Unknown Source)

††††††††††††††† at org.apache.derby.impl.store.access.RAMTransaction.openConglomerate(Unknown Source)

††††††††††††††† at org.apache.derby.impl.store.access.RAMTransaction.openConglomerate(Unknown Source)

††††††††††††††† at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndexMinion(Unknown Source)

††††††††††††††† at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndex(Unknown Source)

††††††††††††††† at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.locateSchemaRow(Unknown Source)

††††††††††††††† at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getSchemaDescriptor(Unknown Source)

††††††††††††††† at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.initDefaultSchemaDescriptor(Unknown Source)

††††††††††††††† at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.initialize(Unknown Source)

††††††††††††††† at org.apache.derby.impl.db.BasicDatabase.setupConnection(Unknown Source)

††††††††††††††† at org.apache.derby.impl.jdbc.TransactionResourceImpl.startTransaction(Unknown Source)

††††††††††††††† at org.apache.derby.impl.jdbc.EmbedConnection.checkUserIsNotARole(Unknown Source)

††††††††††††††† at org.apache.derby.impl.jdbc.EmbedConnection.checkUserCredentials(Unknown Source)

††††††††††††††† ... 15 more†

Regards,

Erick