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

boli
07.12.2008 f6f44d80e15b638b013a725396a8d7fe03031a1f
Fixed an issue where a NPE could be thrown when the server processes a mod DN operation with a new superior entry thats in the subtree to be moved. An informative error message is added so the user can fix the mistake. 

This patch also enables the debug logger to print the cause of an exception message as well as all the stack frames by default. It also removes the deadlock retry configuration parameter from the JE backend configuration definition since deadlocks can no longer occur in the JE backend.

Fix for issue 3236
10 files modified
89 ■■■■■ changed files
opends/resource/config/config.ldif 1 ●●●● patch | view | raw | blame | history
opends/resource/schema/02-config.ldif 6 ●●●●● patch | view | raw | blame | history
opends/src/admin/defn/org/opends/server/admin/std/DebugLogPublisherConfiguration.xml 6 ●●●● patch | view | raw | blame | history
opends/src/admin/defn/org/opends/server/admin/std/LocalDBBackendConfiguration.xml 24 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/core.properties 3 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/jeb.properties 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/EntryContainer.java 32 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/ID2Entry.java 3 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java 7 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/resource/config-changes.ldif 5 ●●●●● patch | view | raw | blame | history
opends/resource/config/config.ldif
@@ -184,7 +184,6 @@
ds-cfg-import-queue-size: 100
ds-cfg-import-thread-count: 8
ds-cfg-entries-compressed: false
ds-cfg-deadlock-retry-limit: 10
ds-cfg-compact-encoding: true
ds-cfg-db-cache-percent: 10
ds-cfg-db-cache-size: 0 megabytes
opends/resource/schema/02-config.ldif
@@ -1100,11 +1100,6 @@
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.225
  NAME 'ds-cfg-deadlock-retry-limit'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.226
  NAME 'ds-cfg-db-evictor-lru-only'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
@@ -2280,7 +2275,6 @@
        ds-cfg-import-queue-size $
        ds-cfg-import-thread-count $
        ds-cfg-entries-compressed $
        ds-cfg-deadlock-retry-limit $
        ds-cfg-db-directory-permissions $
        ds-cfg-db-cache-percent $
        ds-cfg-subtree-delete-batch-size $
opends/src/admin/defn/org/opends/server/admin/std/DebugLogPublisherConfiguration.xml
@@ -230,7 +230,7 @@
    </adm:synopsis>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>false</adm:value>
        <adm:value>true</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
@@ -249,11 +249,11 @@
    </adm:synopsis>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>0</adm:value>
        <adm:value>2147483647</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:integer lower-limit="0" />
      <adm:integer lower-limit="0" upper-limit="2147483647" />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
opends/src/admin/defn/org/opends/server/admin/std/LocalDBBackendConfiguration.xml
@@ -124,30 +124,6 @@
      </adm:defined>
    </adm:default-behavior>
  </adm:property-override>
  <adm:property name="deadlock-retry-limit" advanced="true">
    <adm:synopsis>
      Specifies the number of times that the server should retry an
      attempted operation in the backend if a deadlock results from two
      concurrent requests that interfere with each other in a
      conflicting manner.
    </adm:synopsis>
    <adm:description>
      A value of "0" indicates no limit.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>10</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:integer lower-limit="0" upper-limit="2147483647" />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:name>ds-cfg-deadlock-retry-limit</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="db-directory" mandatory="true">
    <adm:TODO>Default this to the db/backend-id</adm:TODO>
    <adm:synopsis>
opends/src/messages/messages/core.properties
@@ -1768,3 +1768,6 @@
  canceled
MILD_ERR_CANNOT_CANCEL_CANCEL_701=Cancel extended operations can not be \
  canceled
MILD_ERR_MODDN_NEW_SUPERIOR_IN_SUBTREE_702=The modify DN operation \
 for entry %s cannot be performed because the new superior entry %s is equal \
 to or a subordinate of the entry to be moved
opends/src/messages/messages/jeb.properties
@@ -73,7 +73,7 @@
 have indexing of type '%s' because it does not have a corresponding matching \
 rule
MILD_ERR_JEB_UNCHECKED_EXCEPTION_28=Unchecked exception during database \
 transaction
 transaction: %s
NOTICE_JEB_CLEAN_DATABASE_START_29=Starting database cleaning on %d log \
 file(s) in '%s'
NOTICE_JEB_CLEAN_DATABASE_MARKED_30=Marked %d log file(s) for cleaning
opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
@@ -194,7 +194,6 @@
  /**
   * Cached value from config so they don't have to be retrieved per operation.
   */
  private int deadlockRetryLimit;
  private int subtreeDeleteSizeLimit;
@@ -501,7 +500,6 @@
    }
    this.databasePrefix = builder.toString();
    this.deadlockRetryLimit = config.getDeadlockRetryLimit();
    this.subtreeDeleteSizeLimit = config.getSubtreeDeleteSizeLimit();
    this.subtreeDeleteBatchSize = config.getSubtreeDeleteBatchSize();
@@ -1781,7 +1779,6 @@
  {
    // Attempt the operation under a transaction until it fails or completes.
    boolean completed = false;
    int retryRemaining = deadlockRetryLimit;
    while (!completed)
    {
      // Start a transaction.
@@ -1796,18 +1793,6 @@
        EntryContainer.transactionCommit(txn);
        completed = true;
      }
      catch (DeadlockException deadlockException)
      {
        EntryContainer.transactionAbort(txn);
        if (retryRemaining-- <= 0)
        {
          throw deadlockException;
        }
        if (debugEnabled())
        {
          TRACER.debugCaught(DebugLogLevel.ERROR, deadlockException);
        }
      }
      catch (DatabaseException databaseException)
      {
        EntryContainer.transactionAbort(txn);
@@ -1827,7 +1812,12 @@
      {
        EntryContainer.transactionAbort(txn);
        Message message = ERR_JEB_UNCHECKED_EXCEPTION.get();
        String msg = e.getMessage();
        if (msg == null)
        {
          msg = stackTraceToSingleLineString(e);
        }
        Message message = ERR_JEB_UNCHECKED_EXCEPTION.get(msg);
        throw new JebException(message, e);
      }
    }
@@ -4247,8 +4237,13 @@
        {
          transactionAbort(txn);
          Message message = ERR_JEB_UNCHECKED_EXCEPTION.get();
          throw new JebException(message, e);
        String msg = e.getMessage();
        if (msg == null)
        {
          msg = stackTraceToSingleLineString(e);
        }
        Message message = ERR_JEB_UNCHECKED_EXCEPTION.get(msg);
        throw new JebException(message, e);
        }
      }
      else
@@ -4349,7 +4344,6 @@
    id2entry.setDataConfig(entryDataConfig);
    this.config = cfg;
    this.deadlockRetryLimit = config.getDeadlockRetryLimit();
    this.subtreeDeleteSizeLimit = config.getSubtreeDeleteSizeLimit();
    this.subtreeDeleteBatchSize = config.getSubtreeDeleteBatchSize();
    return new ConfigChangeResult(ResultCode.SUCCESS,
opends/src/server/org/opends/server/backends/jeb/ID2Entry.java
@@ -223,8 +223,7 @@
    DatabaseEntry data = new DatabaseEntry();
    OperationStatus status;
    status = read(txn, key, data,
                                 LockMode.DEFAULT);
    status = read(txn, key, data, lockMode);
    if (status != OperationStatus.SUCCESS)
    {
opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java
@@ -233,6 +233,13 @@
      }
      else
      {
        if(newSuperior.isDescendantOf(entryDN))
        {
          setResultCode(ResultCode.UNWILLING_TO_PERFORM);
          appendErrorMessage(ERR_MODDN_NEW_SUPERIOR_IN_SUBTREE.get(
              String.valueOf(entryDN), String.valueOf(newSuperior)));
          break modifyDNProcessing;
        }
        parentDN = newSuperior;
      }
opends/tests/unit-tests-testng/resource/config-changes.ldif
@@ -425,7 +425,6 @@
ds-cfg-import-queue-size: 100
ds-cfg-import-thread-count: 8
ds-cfg-entries-compressed: false
ds-cfg-deadlock-retry-limit: 10
ds-cfg-db-cache-percent: 2
dn: ds-cfg-attribute=oncRpcNumber,cn=Index,ds-cfg-backend-id=userRoot,cn=Backends,cn=config
@@ -659,7 +658,6 @@
ds-cfg-import-queue-size: 100
ds-cfg-import-thread-count: 8
ds-cfg-entries-compressed: false
ds-cfg-deadlock-retry-limit: 10
ds-cfg-db-cache-percent: 2
dn: cn=VLV Index,ds-cfg-backend-id=rebuildRoot,cn=Backends,cn=config
@@ -833,7 +831,6 @@
ds-cfg-import-queue-size: 100
ds-cfg-import-thread-count: 8
ds-cfg-entries-compressed: false
ds-cfg-deadlock-retry-limit: 10
ds-cfg-db-cache-percent: 2
dn: cn=VLV Index,ds-cfg-backend-id=importRoot,cn=Backends,cn=config
@@ -1002,7 +999,6 @@
ds-cfg-import-queue-size: 100
ds-cfg-import-thread-count: 8
ds-cfg-entries-compressed: false
ds-cfg-deadlock-retry-limit: 10
ds-cfg-db-cache-percent: 2
dn: cn=VLV Index,ds-cfg-backend-id=verifyRoot,cn=Backends,cn=config
@@ -1205,7 +1201,6 @@
ds-cfg-import-queue-size: 100
ds-cfg-import-thread-count: 8
ds-cfg-entries-compressed: false
ds-cfg-deadlock-retry-limit: 10
ds-cfg-db-cache-percent: 2
dn: cn=VLV Index,ds-cfg-backend-id=indexRoot,cn=Backends,cn=config