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

Jean-Noel Rouvignac
03.58.2013 e6213080a8f2332df41d85c42e855a881b27a007
OPENDJ-1217 Servers not synchronized after a conflicting replace on multi-valued attribute on 2 different servers


Fixed regression introduced in r9788 by introducing a similar behaviour as what the code was doing before.

Replica 1 was trying to read a change done on itself and send it to replica 2, but failed to do so.
Hence replica 2 did not receive this UpdateMsg and as a consequence could not resolve it.

Previous code was trying to cursor to a specific CSN in the DB. It could not find it, hence tried to move after it in the DB, but could not do it because the end of the DB was reached. Previous was throwing an exception there, later catching it and then returning an empty cursor.
Newer code removed the useless catch block which let the exception fail this process.
The fix removed throwing the exception and instead returned an empty cursor.



ReplicationDB.java:
In ctor, do not throw an exception, but return an empty cursor instead (Previous code was throwing an exception, catching and ignoring it, then returning an empty cursor).

MessageHandler.java:
Prevented a NullPointerException from being thrown, then caught and ignored.
2 files modified
20 ■■■■■ changed files
opends/src/server/org/opends/server/replication/server/MessageHandler.java 8 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java 12 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/MessageHandler.java
@@ -459,9 +459,13 @@
    {
      cursor = replicationServerDomain.getCursorFrom(serverState);
      cursor.next();
      return cursor.getRecord().getCSN();
      if (cursor.getRecord() != null)
      {
        return cursor.getRecord().getCSN();
      }
      return null;
    }
    catch (Exception e)
    catch (ChangelogException e)
    {
      return null;
    }
opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
@@ -595,8 +595,11 @@
          // We could not move the cursor to the expected startCSN
          if (localCursor.getSearchKeyRange(key, data, DEFAULT) != SUCCESS)
          {
            // We could not even move the cursor close to it => failure
            throw new ChangelogException(Message.raw("CSN not available"));
            // We could not even move the cursor close to it
            // => return empty cursor
            isClosed = true;
            cursor = null;
            return;
          }
          // We can move close to the startCSN.
@@ -612,11 +615,6 @@
        cursor = localCursor;
        cursorHeld = cursor != null;
      }
      catch (ChangelogException e)
      {
        StaticUtils.close(localCursor);
        throw e;
      }
      catch (DatabaseException e)
      {
        StaticUtils.close(localCursor);