1. Derby
  2. DERBY-5283

Crash / process termination during SYSCS_DISABLE_LOG_ARCHIVE_MODE can leave broken


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s:,
    • Fix Version/s:,
    • Component/s: Miscellaneous
    • Labels:
    • Environment:
    • Bug behavior facts:
      Data corruption, Seen in production


      If Derby is terminated while SYSCS_DISABLE_LOG_ARCHIVE_MODE is being called can be left in a broken state.

      Depending on timing either of the two cases can happen:
      Case 1:
      "ERROR XBM0S: Unable to rename file 'C:\PATH_TO_DB\' to 'C:\PATH_TO_DB\service.propertiesold' " is thrown when next trying to call
      SYSCS_DISABLE_LOG_ARCHIVE_MODE(1). Both "" and "service.propertiesold" are present in the database directory. Removing "service.propertiesold" corrects the problem.

      Case 2:
      "SQLException: Database 'C:\PATH_TO_DB' not found" is thrown when booting the database. The file does not exist in the database directory but service.propertiesold does exist. Renaming the file back to "" corrects the problem.

      As mentioned above both cases have workarounds but they require manual intervention which is a problem for applications installed to a customer site. It would be great if a more reliable method to update the file could be found.

      The following sample code will reproduce the issue fairly reliably by terminating the java process:

      import java.sql.*;
      import org.apache.derby.jdbc.*;

      public class DerbyLogArchiveModeTest {

      public static void main(String[] args) {
      final EmbeddedDataSource ds = new EmbeddedDataSource();

      try {
      final Connection conn = ds.getConnection();

      try {
      final Statement stmt = conn.createStatement();

      try {
      while (true)

      { stmt.execute("call SYSCS_UTIL.SYSCS_DISABLE_LOG_ARCHIVE_MODE(1)"); }

      } finally

      { stmt.close(); }

      } finally

      { conn.close(); }

      } catch (SQLException e)

      { e.printStackTrace(); }


      1. derby-5283-2a-update_test_with_errorcodes.diff
        1 kB
        Kristian Waagan
      2. derby-5283-1c-recover.diff
        34 kB
        Kristian Waagan
      3. derby-5283-1b-recover.diff
        34 kB
        Kristian Waagan
      4. derby-5283-1a-recover.diff
        19 kB
        Kristian Waagan
      5. derby-5283_10_8_diff.txt
        27 kB
        Kathey Marsden

        Issue Links


          No work has yet been logged on this issue.


            • Assignee:
              Kristian Waagan
              Brett Mason
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created: