add.c bind.c compare.c delete.c modify.c modrdn.c search.c \
extended.c passwd.c referral.c operational.c \
attr.c index.c key.c dbcache.c filterindex.c \
- dn2entry.c dn2id.c error.c id2entry.c idl.c nextid.c cache.c
+ dn2entry.c dn2id.c error.c id2entry.c idl.c nextid.c cache.c trans.c
OBJS = init.lo tools.lo config.lo \
add.lo bind.lo compare.lo delete.lo modify.lo modrdn.lo search.lo \
extended.lo passwd.lo referral.lo operational.lo \
attr.lo index.lo key.lo dbcache.lo filterindex.lo \
- dn2entry.lo dn2id.lo error.lo id2entry.lo idl.lo nextid.lo cache.lo
+ dn2entry.lo dn2id.lo error.lo id2entry.lo idl.lo nextid.lo cache.lo trans.lo
LDAP_INCDIR= ../../../include
LDAP_LIBDIR= ../../../libraries
DB_LOCK lock;
int noop = 0;
+ int num_retries = 0;
+
#ifdef LDAP_SYNC
Operation* ps_list;
#endif
rs->sr_text = "internal error";
goto return_results;
}
+ bdb_trans_backoff( ++num_retries );
ldap_pvt_thread_yield();
}
int noop = 0;
+ int num_retries = 0;
+
#ifdef LDAP_SYNC
Operation* ps_list;
#endif
rs->sr_text = "internal error";
goto return_results;
}
+ bdb_trans_backoff( ++num_retries );
ldap_pvt_thread_yield();
}
int noop = 0;
+ int num_retries = 0;
+
#ifdef LDAP_SYNC
Operation* ps_list;
struct psid_entry *pm_list, *pm_prev;
rs->sr_text = "internal error";
goto return_results;
}
+ bdb_trans_backoff( ++num_retries );
ldap_pvt_thread_yield();
}
int noop = 0;
+ int num_retries = 0;
+
#ifdef LDAP_SYNC
Operation *ps_list;
struct psid_entry *pm_list, *pm_prev;
rs->sr_text = "internal error";
goto return_results;
}
+ bdb_trans_backoff( ++num_retries );
ldap_pvt_thread_yield();
}
u_int32_t locker = 0;
DB_LOCK lock;
+ int num_retries = 0;
+
assert( ber_bvcmp( &slap_EXOP_MODIFY_PASSWD, &op->oq_extended.rs_reqoid ) == 0 );
rc = slap_passwd_parse( op->oq_extended.rs_reqdata,
rs->sr_text = "internal error";
goto done;
}
+ bdb_trans_backoff( ++num_retries );
ldap_pvt_thread_yield();
}
struct berval *cookie );
#endif
+/*
+ * trans.c
+ */
+
+void
+bdb_trans_backoff( int num_retries );
LDAP_END_DECL
--- /dev/null
+/* trans.c - bdb backend transaction routines */
+/* $OpenLDAP$ */
+
+#include "portable.h"
+
+#include <stdio.h>
+#include <ac/string.h>
+
+#include "back-bdb.h"
+#include "external.h"
+#include "lber_pvt.h"
+
+
+/* Congestion avoidance code
+ * for Deadlock Rollback
+ */
+
+void
+bdb_trans_backoff( int num_retries )
+{
+ int i;
+ int delay = 0;
+ int pow_retries = 1;
+ unsigned long key = 0;
+ unsigned long max_key = -1;
+ struct timeval timeout;
+
+ lutil_entropy( &key, sizeof( unsigned long ));
+
+ for ( i = 0; i < num_retries; i++ ) {
+ if ( i >= 5 ) break;
+ pow_retries *= 4;
+ }
+
+ delay = 16384 * (key * (double) pow_retries / (double) max_key);
+ delay = delay ? delay : 1;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR, "delay = %d, num_retries = %d\n", delay, num_retries, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "delay = %d, num_retries = %d\n", delay, num_retries, 0 );
+#endif
+
+ timeout.tv_sec = delay / 1000000;
+ timeout.tv_usec = delay % 1000000;
+ select( 0, NULL, NULL, NULL, &timeout );
+}
#endif
LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) gmtime_mutex;
+LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) rand_mutex;
+
LDAP_SLAPD_V (AccessControl *) global_acl;
LDAP_SLAPD_V (ber_socket_t) dtblsize;