db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oystein.Grov...@Sun.COM (Øystein Grøvlen)
Subject Problem with backup in storerecovery test suite
Date Tue, 07 Jun 2005 14:03:33 GMT

As part of Derby-298, I am trying to make a test that recovers a
database on which backup was performed just before it stopped.
Following the scheme of the other tests in the storerecovery test
suite, I first have a test that stops without shutting down the
database and then another test that picks up the database and does
recovery.  (I must admit I have not quite understood how this works,
but it does work when running the tests in the testsuite.  I have not
been able to get this to work when manually running the tests).

My current problem is that my first test fails when doing backup.  The
backup command gets the following exception:

ERROR XSRS5: Error copying file (during backup) from /home/og136792/derby/clean/testdir/storerecovery/storerecovery/storerecovery/wombat
to extinout/backup/wombat.
	at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:333)
	at org.apache.derby.impl.store.raw.RawStore.backup(RawStore.java:565)
	at org.apache.derby.impl.store.raw.RawStore.backup(RawStore.java:474)
	at org.apache.derby.impl.store.raw.RawStore.backupAndEnableLogArchiveMode(RawStore.java:719)
	at org.apache.derby.impl.store.access.RAMAccessManager.backupAndEnableLogArchiveMode(RAMAccessManager.java:944)
	at org.apache.derby.impl.db.BasicDatabase.backupAndEnableLogArchiveMode(BasicDatabase.java:353)
	at org.apache.derby.catalog.SystemProcedures.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(SystemProcedures.java:698)
	at org.apache.derby.exe.ac601a400fx0104x5706x1431xffffd90a85692.g0(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.apache.derby.impl.services.reflect.ReflectMethod.invoke(ReflectMethod.java:45)
	at org.apache.derby.impl.sql.execute.CallStatementResultSet.open(CallStatementResultSet.java:67)
	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1108)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:517)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:475)
	at org.apache.derbyTesting.functionTests.tests.store.RecoveryAfterBackupSetup.main(RecoveryAfterBackupSetup.java:62)

Since the error message is not very informative with respect to how it
failed, I added some trace, and it turns out FileUtil.copyDirectory
fails when trying to create the target directory
("extinout/backup/wombat").  It seems like File.mkdirs() has
successfully created the parent directories (extinout and backup), but
not the target directory.  If I run this as a stand-alone test, the
backup works.

Does anyone have any idea to what goes wrong here?  The test program
is enclosed below.

-- 
Øystein


/*

   Derby - Class org.apache.derbyTesting.functionTests.store.LogChecksumSetup

   Copyright 2005 The Apache Software Foundation or its licensors, as applicable.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

 */

package org.apache.derbyTesting.functionTests.tests.store;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import org.apache.derby.tools.ij;

/*
 * This class will do the setup for testing recovery after backup.
 * This test will insert some records into a table, do a backup and
 * end without shutting down the database.  The succeeding test,
 * RecoveryAfterBackup, will then do recovery of the database.
 * 
 * @author oystein.grovlen@sun.com
 * @see RecoveryAfterBackup
 */

public class RecoveryAfterBackupSetup
{
    
    public static void main(String[] argv) throws Throwable 
    {
        try {
            ij.getPropertyArg(argv); 
            Connection conn = ij.startJBMS();
            conn.setAutoCommit(true);

            Statement s = conn.createStatement();
            try { // Drop table if it exists
                s.execute("DROP TABLE t1");
            } catch (SQLException e) {
                if (e.getSQLState().equals("42Y55")) {
                    // IGNORE. Table did not exist. That is our target.
                } else {
                    throw e;
                }
            }
            s.execute("CREATE TABLE t1(a INT)");
            s.execute("INSERT INTO t1 VALUES(0)");
            s.execute("INSERT INTO t1 VALUES(1)");
            s.execute("CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE('extinout/backup',
0)");
        } catch (SQLException sqle) {
            org.apache.derby.tools.JDBCDisplayUtil.ShowSQLException(System.out, 
                                                                    sqle);
            sqle.printStackTrace(System.out);
        }
    }
}


Mime
View raw message