Derby
  1. Derby
  2. DERBY-1667

Future Backups fails with "ERROR XSRS4: Error renaming file" after a consistency check is performed on the Backedup database and is not shutdown

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.1.3.1, 10.2.1.6
    • Fix Version/s: None
    • Component/s: Documentation
    • Urgency:
      Low

      Description

      After performing a consistency check on the backedup database, all future attempts to backup the original database fails. this happens with both SYSCS_UTIL.SYSCS_ONLINE_BACKUP_DATABASE (online and offline) and SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE (online and offline).

      Following is the reproduction of this scenario using online backup:

      Derby version: latest synced up trunk - 10.2.0.5 alpha - (430519). The offline backup version in 10.1.3 also fails with the same error.

      ij version 10.2
      ij> connect 'jdbc:derby:testdb;create=true';
      ij> –
      -- Attempt for an online backup - SUCCESS

      CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE_NOWAIT('backupdir',1);
      0 rows inserted/updated/deleted
      ij> create table t(id int, col1 char(2));
      0 rows inserted/updated/deleted
      ij> insert into t values(1,'ca');
      1 row inserted/updated/deleted
      ij> insert into t values(2,'wa');
      1 row inserted/updated/deleted
      ij> –
      -- Attempt for an online backup - SUCCESS

      CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE_NOWAIT('backupdir',1);
      0 rows inserted/updated/deleted
      ij> connect 'jdbc:derby:backupdir/testdb';
      ij(CONNECTION1)> –
      -- Check consistency on the backedup dir

      SELECT schemaname, tablename, SYSCS_UTIL.SYSCS_CHECK_TABLE(schemaname, tablename) FROM sys.sysschemas s, sys.systables t WHERE s.schemaid = t.schemaid;
      SCHEMANAME |TABLENAME |3
      -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      SYS |SYSALIASES |1
      SYS |SYSCHECKS |1
      SYS |SYSCOLPERMS |1
      SYS |SYSCOLUMNS |1
      SYS |SYSCONGLOMERATES |1
      SYS |SYSCONSTRAINTS |1
      SYS |SYSDEPENDS |1
      SYSIBM |SYSDUMMY1 |1
      SYS |SYSFILES |1
      SYS |SYSFOREIGNKEYS |1
      SYS |SYSKEYS |1
      SYS |SYSREQUIREDPERM |1
      SYS |SYSROUTINEPERMS |1
      SYS |SYSSCHEMAS |1
      SYS |SYSSTATEMENTS |1
      SYS |SYSSTATISTICS |1
      SYS |SYSTABLEPERMS |1
      SYS |SYSTABLES |1
      SYS |SYSTRIGGERS |1
      SYS |SYSVIEWS |1
      APP |T |1

      21 rows selected
      ij(CONNECTION1)> disconnect;
      ij> show connections;
      CONNECTION0 - jdbc:derby:testdb
      No current connection
      ij> –
      -- Reconnect to the same original db

      set connection CONNECTION0;
      ij> show connections;
      CONNECTION0* - jdbc:derby:testdb

      • = current connection
        ij> –
        • Third attempt for an online backup - FAILS

          CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE_NOWAIT('backupdir',1);
          ERROR XSRS4: Error renaming file (during backup) from backupdir\testdb to backupdir\testdb.OLD.
          ij> disconnect;
          ij> –
        • No connections present

          show connections;
          No connections available.
          ij> connect 'jdbc:derby:testdb;create=true';
          WARNING 01J01: Database 'testdb' not created, connection made to existing database instead.
          ij> –
        • Another attempt for an online backup with a fresh connection - FAILS TOO

          CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE_NOWAIT('backupdir',1);
          ERROR XSRS4: Error renaming file (during backup) from backupdir\testdb to backupdir\testdb.OLD.

        Activity

        Hide
        Suresh Thalamati added a comment -

        I think this is not a bug. In the above test case connection is made directly to backup copy and it is not
        shutdown before attempting another backup in the main database to the same location. Backup renames the old copy , before replacing it with new copy. I think it is failing on rename because
        files in the old backup are opened when it is booted.

        Show
        Suresh Thalamati added a comment - I think this is not a bug. In the above test case connection is made directly to backup copy and it is not shutdown before attempting another backup in the main database to the same location. Backup renames the old copy , before replacing it with new copy. I think it is failing on rename because files in the old backup are opened when it is booted.
        Hide
        Rajesh Kartha added a comment -

        I agree, added the line connect 'jdbc:derby:backupdir/testdb;shutdown=true'; before the second set of backups and it was successful.

        After performing the consistency check a shutdown got things working (a bit strange, even though a disconnect was issued previously and there were no other connections to the backedup database).

        Seems like a word of caution about this deserves a mention in the documentation. Changing the component and priority.

        Show
        Rajesh Kartha added a comment - I agree, added the line connect 'jdbc:derby:backupdir/testdb;shutdown=true'; before the second set of backups and it was successful. After performing the consistency check a shutdown got things working (a bit strange, even though a disconnect was issued previously and there were no other connections to the backedup database). Seems like a word of caution about this deserves a mention in the documentation. Changing the component and priority.

          People

          • Assignee:
            Unassigned
            Reporter:
            Rajesh Kartha
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development