From a72ae6523fc66a21ced5b5ab04c23e1629ae4d20 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Thu, 20 Dec 2007 17:45:49 +0000
Subject: [PATCH] Updated indexes to order the keys before inserting them into the database. This assures no deadlocks will occur between multiple adds and mods.  Disabled lock timeouts for add and mod operations since deadlocks can not occur. This prevents txn aborts and op retry expiration due to lock timeouts of add and mod operations when the server is under high write load. 

---
 opends/src/server/org/opends/server/backends/jeb/EntryContainer.java |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java b/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
index e810c93..75143ae 100644
--- a/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
+++ b/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
@@ -498,12 +498,12 @@
 
       id2children = new Index(databasePrefix + "_" + ID2CHILDREN_DATABASE_NAME,
                               new ID2CIndexer(), state,
-                              indexEntryLimit, 0,
+                              indexEntryLimit, 0, true,
                               env,this);
       id2children.open();
       id2subtree = new Index(databasePrefix + "_" + ID2SUBTREE_DATABASE_NAME,
                              new ID2SIndexer(), state,
-                             indexEntryLimit, 0,
+                             indexEntryLimit, 0, true,
                              env, this);
       id2subtree.open();
 
@@ -1810,7 +1810,10 @@
      */
     public Transaction beginOperationTransaction() throws DatabaseException
     {
-      return beginTransaction();
+      Transaction txn =  beginTransaction();
+      // Multiple adds should never encounter a deadlock.
+      txn.setLockTimeout(0);
+      return txn;
     }
 
     /**
@@ -2300,7 +2303,10 @@
      */
     public Transaction beginOperationTransaction() throws DatabaseException
     {
-      return beginTransaction();
+      Transaction txn =  beginTransaction();
+      // Multiple deletes should never encounter a deadlock.
+      txn.setLockTimeout(0);
+      return txn;
     }
 
     /**
@@ -2843,7 +2849,10 @@
      */
     public Transaction beginOperationTransaction() throws DatabaseException
     {
-      return beginTransaction();
+      Transaction txn =  beginTransaction();
+      // Multiple replace operations should never encounter a deadlock.
+      txn.setLockTimeout(0);
+      return txn;
     }
 
     /**
@@ -3214,7 +3223,8 @@
      */
     public Transaction beginOperationTransaction() throws DatabaseException
     {
-      return beginTransaction();
+      Transaction txn =  beginTransaction();
+      return txn;
     }
 
     /**

--
Gitblit v1.10.0