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

Fabio Pistolesi
31.35.2015 87c9fb691b7b976d2c8aa072afb531de08780cab
OPENDJ-2182 CR-7793 Change number indexer prevent server from shutting down

Fixes a shutdown problem where cursoring through the changelog files was trying to skip didabled domains when none of the domains are enabled.
Should also work for the case where a domain is deleted from a running server.
2 files modified
44 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/ECLMultiDomainDBCursor.java 16 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/ECLMultiDomainDBCursorTest.java 28 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/ECLMultiDomainDBCursor.java
@@ -85,14 +85,18 @@
  @Override
  public boolean next() throws ChangelogException
  {
    // discard updates from non ECL enabled domains
    boolean hasNext;
    do
    if (!cursor.next())
    {
      hasNext = cursor.next();
      return false;
    }
    while (hasNext && !predicate.isECLEnabledDomain(cursor.getData()));
    return hasNext;
    // discard updates from non ECL enabled domains by removing the disabled domains from the cursor
    DN domain = cursor.getData();
    while (domain != null && !predicate.isECLEnabledDomain(domain))
    {
      cursor.removeDomain(domain);
      domain = cursor.getData();
    }
    return domain != null;
  }
  @Override
opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/ECLMultiDomainDBCursorTest.java
@@ -126,6 +126,7 @@
    final DN baseDN2 = DN.valueOf("cn=admin data");
    eclEnabledDomains.add(baseDN1);
    // At least two updates in an enabled domain
    final UpdateMsg msg1 = new FakeUpdateMsg(1);
    final UpdateMsg msg2 = new FakeUpdateMsg(2);
    final UpdateMsg msg3 = new FakeUpdateMsg(3);
@@ -134,6 +135,33 @@
    addDomainCursorToCursor(baseDN2, new SequentialDBCursor(msg2, msg3));
    assertMessagesInOrder(baseDN1, msg1, msg4);
    assertEmpty();
    //Only one update in an enabled domain
    final UpdateMsg msg5 = new FakeUpdateMsg(5);
    final UpdateMsg msg6 = new FakeUpdateMsg(6);
    final UpdateMsg msg7 = new FakeUpdateMsg(7);
    addDomainCursorToCursor(baseDN1, new SequentialDBCursor(msg5));
    addDomainCursorToCursor(baseDN2, new SequentialDBCursor(msg6, msg7));
    assertMessagesInOrder(baseDN1, msg5, null);
    assertEmpty();
    // Two disabled domains
    final DN baseDN3 = DN.valueOf("cn=schema");
    final UpdateMsg msg8 = new FakeUpdateMsg(8);
    final UpdateMsg msg9 = new FakeUpdateMsg(9);
    final UpdateMsg msg10 = new FakeUpdateMsg(10);
    final UpdateMsg msg11 = new FakeUpdateMsg(11);
    final UpdateMsg msg12 = new FakeUpdateMsg(12);
    final UpdateMsg msg13 = new FakeUpdateMsg(13);
    addDomainCursorToCursor(baseDN1, new SequentialDBCursor(msg8, msg10));
    addDomainCursorToCursor(baseDN2, new SequentialDBCursor(msg9, msg11));
    addDomainCursorToCursor(baseDN3, new SequentialDBCursor(msg12, msg13));
    assertMessagesInOrder(baseDN1, msg8, msg10);
    assertEmpty();
  }
  private void assertEmpty() throws Exception