From 9bac7b4f5bd4c3fa6abd420e17b90418663faec6 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. 

---
 opendj-sdk/opends/src/server/org/opends/server/backends/jeb/AttributeIndex.java |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/AttributeIndex.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/AttributeIndex.java
index a509e1d..31d423b 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/AttributeIndex.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/AttributeIndex.java
@@ -27,11 +27,7 @@
 package org.opends.server.backends.jeb;
 import org.opends.messages.Message;
 
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 import com.sleepycat.je.*;
 
@@ -161,6 +157,7 @@
                                      state,
                                      indexEntryLimit,
                                      cursorEntryLimit,
+                                     false,
                                      env,
                                      entryContainer);
     }
@@ -174,6 +171,7 @@
                                      state,
                                      indexEntryLimit,
                                      cursorEntryLimit,
+                                     false,
                                      env,
                                      entryContainer);
     }
@@ -195,6 +193,7 @@
                                      state,
                                      indexEntryLimit,
                                      cursorEntryLimit,
+                                     false,
                                      env,
                                      entryContainer);
     }
@@ -215,6 +214,7 @@
                                      state,
                                      indexEntryLimit,
                                      cursorEntryLimit,
+                                     false,
                                      env,
                                      entryContainer);
     }
@@ -234,6 +234,7 @@
                                         state,
                                         indexEntryLimit,
                                         cursorEntryLimit,
+                                        false,
                                         env,
                                         entryContainer);
     }
@@ -571,7 +572,8 @@
       // index substring length, and read those keys.
 
       // Eliminate duplicates by putting the keys into a set.
-      Set<byte[]> set = new HashSet<byte[]>();
+      Set<byte[]> set =
+          new TreeSet<byte[]>(substringIndex.indexer.getComparator());
 
       // Example: The value is ABCDE and the substring length is 3.
       // We produce the keys ABC BCD CDE.
@@ -1238,6 +1240,7 @@
                                     state,
                                     indexEntryLimit,
                                     cursorEntryLimit,
+                                    false,
                                     env,
                                     entryContainer);
           equalityIndex.open();
@@ -1297,6 +1300,7 @@
                                     state,
                                     indexEntryLimit,
                                     cursorEntryLimit,
+                                    false,
                                     env,
                                     entryContainer);
           presenceIndex.open();
@@ -1356,6 +1360,7 @@
                                      state,
                                      indexEntryLimit,
                                      cursorEntryLimit,
+                                     false,
                                      env,
                                      entryContainer);
           substringIndex.open();
@@ -1420,6 +1425,7 @@
                                     state,
                                     indexEntryLimit,
                                     cursorEntryLimit,
+                                    false,
                                     env,
                                     entryContainer);
           orderingIndex.open();
@@ -1478,6 +1484,7 @@
                                        state,
                                        indexEntryLimit,
                                        cursorEntryLimit,
+                                       false,
                                        env,
                                        entryContainer);
           approximateIndex.open();

--
Gitblit v1.10.0