mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

lutoff
02.04.2008 655e5aea7a9fbac72f445e5100eb6ae2320d377e
Fix on issue #3185 (restore --dry-run *does* actually do something to the backend)

If we are in the "verifyOnly" mode (option --dry-run), don't disable the backend
1 files modified
16 ■■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/tasks/RestoreTask.java 16 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/tasks/RestoreTask.java
@@ -347,11 +347,12 @@
    DirectoryServer.notifyRestoreBeginning(backend, restoreConfig);
    // Disable the backend.
    if ( !verifyOnly)
    {
    try
    {
      TaskUtils.disableBackend(backendID);
    }
    catch (DirectoryException e)
      } catch (DirectoryException e)
    {
      if (debugEnabled())
      {
@@ -361,13 +362,14 @@
      logError(e.getMessageObject());
      return TaskState.STOPPED_BY_ERROR;
    }
    }
    // From here we must make sure to re-enable the backend before returning.
    boolean errorsEncountered = false;
    try
    {
      // Acquire an exclusive lock for the backend.
      if (lockBackend(backend))
      if (verifyOnly || lockBackend(backend))
      {
        // From here we must make sure to release the backend exclusive lock.
        try
@@ -397,7 +399,7 @@
        finally
        {
          // Release the exclusive lock on the backend.
          if (!unlockBackend(backend))
          if ( (!verifyOnly) && !unlockBackend(backend))
          {
            errorsEncountered = true;
          }
@@ -407,6 +409,8 @@
    finally
    {
      // Enable the backend.
      if (! verifyOnly)
      {
      try
      {
        TaskUtils.enableBackend(backendID);
@@ -414,8 +418,7 @@
        // because disabling and enabling it again may have resulted
        // in a new backend being registered to the server.
        backend = DirectoryServer.getBackend(backendID);
      }
      catch (DirectoryException e)
        } catch (DirectoryException e)
      {
        if (debugEnabled())
        {
@@ -425,6 +428,7 @@
        logError(e.getMessageObject());
        errorsEncountered = true;
      }
      }
      DirectoryServer.notifyRestoreEnded(backend, restoreConfig, true);
    }