Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
List overview
Download
389-commits
June 2013
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
389-commits@lists.fedoraproject.org
6 participants
107 discussions
Start a n
N
ew thread
Branch '389-ds-base-1.2.11' - ldap/servers
by Noriko Hosoi
28 Jun '13
28 Jun '13
ldap/servers/slapd/back-ldbm/ldbm_add.c | 2 +- ldap/servers/slapd/back-ldbm/ldbm_modify.c | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) New commits: commit bc62f8276924f836613a311a0f133c9b548fad9a Author: Noriko Hosoi <nhosoi(a)redhat.com> Date: Fri Jun 28 13:34:54 2013 -0700 Ticket #47412 - Modify RUV should be serialized in ldbm_back_modify/add Bug Description: Current ldbm_back_modify and _add allow RUV to update without respecting other threads in the backend's critical area. It gives a chance for 2 threads trying to modify RUV at the same time in the 2 different transactions which causes the DB deadlocks. Fix Description: This patch changes the policy for RUV to skip the backend serial lock.
https://fedorahosted.org/389/ticket/47412
Reviewed by Rich (Thank you!!) diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c index 158dc8e..78ca565 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_add.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c @@ -159,7 +159,7 @@ ldbm_back_add( Slapi_PBlock *pb ) * operations that the URP code in the Replication * plugin generates. */ - if(SERIALLOCK(li) && !is_fixup_operation) + if(SERIALLOCK(li) && (!is_fixup_operation || is_ruv)) { dblayer_lock_backend(be); dblock_acquired= 1; diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modify.c b/ldap/servers/slapd/back-ldbm/ldbm_modify.c index ca66b71..66b8ab8 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_modify.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_modify.c @@ -394,7 +394,7 @@ ldbm_back_modify( Slapi_PBlock *pb ) * operations that the URP code in the Replication * plugin generates. */ - if(SERIALLOCK(li) && !operation_is_flag_set(operation,OP_FLAG_REPL_FIXUP)) { + if(SERIALLOCK(li) && (!is_fixup_operation || is_ruv)) { dblayer_lock_backend(be); dblock_acquired= 1; } @@ -405,15 +405,14 @@ ldbm_back_modify( Slapi_PBlock *pb ) goto error_return; /* error result sent by find_entry2modify() */ } - if ( !is_fixup_operation ) - { - if (slapi_entry_flag_is_set(e->ep_entry, SLAPI_ENTRY_FLAG_TOMBSTONE) ) { - ldap_result_code = LDAP_UNWILLING_TO_PERFORM; - ldap_result_message = "Operation not allowed on tombstone entry."; - slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_modify", - "Attempt to modify a tombstone entry %s\n", slapi_sdn_get_dn(slapi_entry_get_sdn_const( e->ep_entry ))); - goto error_return; - } + if (!is_fixup_operation) { + if (slapi_entry_flag_is_set(e->ep_entry, SLAPI_ENTRY_FLAG_TOMBSTONE)) { + ldap_result_code = LDAP_UNWILLING_TO_PERFORM; + ldap_result_message = "Operation not allowed on tombstone entry."; + slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_modify", + "Attempt to modify a tombstone entry %s\n", slapi_sdn_get_dn(slapi_entry_get_sdn_const( e->ep_entry ))); + goto error_return; + } opcsn = operation_get_csn (operation); if (NULL == opcsn && operation->o_csngen_handler) {
1
0
0
0
Branch '389-ds-base-1.3.1' - ldap/servers
by Richard Allen Megginson
28 Jun '13
28 Jun '13
ldap/servers/slapd/back-ldbm/dblayer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ceaa9ac5267c04c23e3fb8e366e17295ffd6b93c Author: Rich Megginson <rmeggins(a)redhat.com> Date: Fri Jun 28 11:37:05 2013 -0600 Ticket #47409 - allow setting db deadlock rejection policy
https://fedorahosted.org/389/ticket/47409
Reviewed by: nhosoi (Thanks!) Branch: master Fix Description: Forgot to add flags parameter to last commit. Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: yes - document new config parameter (cherry picked from commit 67cbb2eac1300ae57acf75f4c3299103046a3323) diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c index 208f28a..5a85c9c 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.c +++ b/ldap/servers/slapd/back-ldbm/dblayer.c @@ -4316,7 +4316,7 @@ static int deadlock_threadmain(void *param) if (dblayer_db_uses_locking(db_env) && (deadlock_policy > DB_LOCK_NORUN)) { int rejected = 0; - if ((rval = LOCK_DETECT(db_env, 0, deadlock_policy, &rejected)) != 0) { + if ((rval = LOCK_DETECT(db_env, flags, deadlock_policy, &rejected)) != 0) { LDAPDebug(LDAP_DEBUG_ANY, "Serious Error---Failed in deadlock detect (aborted at 0x%x), err=%d (%s)\n", rejected, rval, dblayer_strerror(rval));
1
0
0
0
Branch '389-ds-base-1.3.0' - ldap/servers
by Richard Allen Megginson
28 Jun '13
28 Jun '13
ldap/servers/slapd/back-ldbm/dblayer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit e535ff5a45601c4279a14e92eaf1d68729866d38 Author: Rich Megginson <rmeggins(a)redhat.com> Date: Fri Jun 28 11:37:05 2013 -0600 Ticket #47409 - allow setting db deadlock rejection policy
https://fedorahosted.org/389/ticket/47409
Reviewed by: nhosoi (Thanks!) Branch: master Fix Description: Forgot to add flags parameter to last commit. Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: yes - document new config parameter (cherry picked from commit 67cbb2eac1300ae57acf75f4c3299103046a3323) (cherry picked from commit ceaa9ac5267c04c23e3fb8e366e17295ffd6b93c) diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c index 1b89e7e..5bbc34d 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.c +++ b/ldap/servers/slapd/back-ldbm/dblayer.c @@ -4289,7 +4289,7 @@ static int deadlock_threadmain(void *param) if (dblayer_db_uses_locking(db_env) && (deadlock_policy > DB_LOCK_NORUN)) { int rejected = 0; - if ((rval = LOCK_DETECT(db_env, 0, deadlock_policy, &rejected)) != 0) { + if ((rval = LOCK_DETECT(db_env, flags, deadlock_policy, &rejected)) != 0) { LDAPDebug(LDAP_DEBUG_ANY, "Serious Error---Failed in deadlock detect (aborted at 0x%x), err=%d (%s)\n", rejected, rval, dblayer_strerror(rval));
1
0
0
0
ldap/servers
by Richard Allen Megginson
28 Jun '13
28 Jun '13
ldap/servers/slapd/back-ldbm/dblayer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 67cbb2eac1300ae57acf75f4c3299103046a3323 Author: Rich Megginson <rmeggins(a)redhat.com> Date: Fri Jun 28 11:37:05 2013 -0600 Ticket #47409 - allow setting db deadlock rejection policy
https://fedorahosted.org/389/ticket/47409
Reviewed by: nhosoi (Thanks!) Branch: master Fix Description: Forgot to add flags parameter to last commit. Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: yes - document new config parameter diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c index bbe0ee4..04f87ac 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.c +++ b/ldap/servers/slapd/back-ldbm/dblayer.c @@ -4487,7 +4487,7 @@ static int deadlock_threadmain(void *param) if (dblayer_db_uses_locking(db_env) && (deadlock_policy > DB_LOCK_NORUN)) { int rejected = 0; - if ((rval = LOCK_DETECT(db_env, 0, deadlock_policy, &rejected)) != 0) { + if ((rval = LOCK_DETECT(db_env, flags, deadlock_policy, &rejected)) != 0) { LDAPDebug(LDAP_DEBUG_ANY, "Serious Error---Failed in deadlock detect (aborted at 0x%x), err=%d (%s)\n", rejected, rval, dblayer_strerror(rval));
1
0
0
0
Branch '389-ds-base-1.2.11' - ldap/servers
by Richard Allen Megginson
28 Jun '13
28 Jun '13
ldap/servers/slapd/back-ldbm/dblayer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 6c1a71310292e5992aa1fcc8c203a6b6d595ebe3 Author: Rich Megginson <rmeggins(a)redhat.com> Date: Fri Jun 28 11:37:05 2013 -0600 Ticket #47409 - allow setting db deadlock rejection policy
https://fedorahosted.org/389/ticket/47409
Reviewed by: nhosoi (Thanks!) Branch: master Fix Description: Forgot to add flags parameter to last commit. Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: yes - document new config parameter (cherry picked from commit 67cbb2eac1300ae57acf75f4c3299103046a3323) (cherry picked from commit ceaa9ac5267c04c23e3fb8e366e17295ffd6b93c) (cherry picked from commit e535ff5a45601c4279a14e92eaf1d68729866d38) diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c index 5bd808e..a42c07d 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.c +++ b/ldap/servers/slapd/back-ldbm/dblayer.c @@ -4231,7 +4231,7 @@ static int deadlock_threadmain(void *param) if (dblayer_db_uses_locking(db_env) && (deadlock_policy > DB_LOCK_NORUN)) { int rejected = 0; - if ((rval = LOCK_DETECT(db_env, 0, deadlock_policy, &rejected)) != 0) { + if ((rval = LOCK_DETECT(db_env, flags, deadlock_policy, &rejected)) != 0) { LDAPDebug(LDAP_DEBUG_ANY, "Serious Error---Failed in deadlock detect (aborted at 0x%x), err=%d (%s)\n", rejected, rval, dblayer_strerror(rval));
1
0
0
0
Branch '389-ds-base-1.3.1' - ldap/servers
by Richard Allen Megginson
28 Jun '13
28 Jun '13
ldap/servers/slapd/back-ldbm/dblayer.c | 19 ++++++++++----- ldap/servers/slapd/back-ldbm/dblayer.h | 1 ldap/servers/slapd/back-ldbm/ldbm_config.c | 35 +++++++++++++++++++++++++++++ ldap/servers/slapd/back-ldbm/ldbm_config.h | 2 + ldap/servers/slapd/slapi-plugin.h | 3 ++ 5 files changed, 54 insertions(+), 6 deletions(-) New commits: commit d62cd9b69c8a4a852e7bea0345285dc8c3e1e547 Author: Rich Megginson <rmeggins(a)redhat.com> Date: Tue Jun 25 19:48:17 2013 -0600 Ticket #47409 - allow setting db deadlock rejection policy
https://fedorahosted.org/389/ticket/47409
Reviewed by: nhosoi (Thanks!) Branch: 389-ds-base-1.3.1 Fix Description: Add the db config attribute nsslapd-db-deadlock-policy. This takes values from 1-9. The values correspond to the deadlock detector modes in db.h. These are the valid values to pass to the DBENV->lock_detect method for the atype parameter. The default value is 9 (DB_LOCK_YOUNGEST) - select the youngest locker and reject it. A value of 0 (DB_LOCK_NORUN) means to disable deadlock detection and rejection - not recommended except for testing purposes. Attempting to use other values will cause an error. Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: yes - document new config parameter diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c index 82454b8..208f28a 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.c +++ b/ldap/servers/slapd/back-ldbm/dblayer.c @@ -4295,6 +4295,7 @@ static int deadlock_threadmain(void *param) dblayer_private *priv = NULL; struct ldbminfo *li = NULL; PRIntervalTime interval; /*NSPR timeout stuffy*/ + u_int32_t flags = 0; PR_ASSERT(NULL != param); li = (struct ldbminfo*)param; @@ -4309,13 +4310,19 @@ static int deadlock_threadmain(void *param) { if (priv->dblayer_enable_transactions) { - if (dblayer_db_uses_locking(priv->dblayer_env->dblayer_DB_ENV)) { - int aborted; - if ((rval = LOCK_DETECT(priv->dblayer_env->dblayer_DB_ENV, - 0, DB_LOCK_YOUNGEST, &aborted)) != 0) { + DB_ENV *db_env = priv->dblayer_env->dblayer_DB_ENV; + u_int32_t deadlock_policy = priv->dblayer_deadlock_policy; + + if (dblayer_db_uses_locking(db_env) && (deadlock_policy > DB_LOCK_NORUN)) { + int rejected = 0; + + if ((rval = LOCK_DETECT(db_env, 0, deadlock_policy, &rejected)) != 0) { LDAPDebug(LDAP_DEBUG_ANY, - "Serious Error---Failed in deadlock detect (aborted at 0x%x), err=%d (%s)\n", - aborted, rval, dblayer_strerror(rval)); + "Serious Error---Failed in deadlock detect (aborted at 0x%x), err=%d (%s)\n", + rejected, rval, dblayer_strerror(rval)); + } else if (rejected) { + LDAPDebug1Arg(LDAP_DEBUG_TRACE, "deadlock_threadmain: found and rejected %d lock requests\n", rejected); + } } } diff --git a/ldap/servers/slapd/back-ldbm/dblayer.h b/ldap/servers/slapd/back-ldbm/dblayer.h index ab9a85d..7f3200c 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.h +++ b/ldap/servers/slapd/back-ldbm/dblayer.h @@ -178,6 +178,7 @@ struct dblayer_private PRCondVar *thread_count_cv; /* condition variable for housekeeping thread shutdown */ int dblayer_lockdown; /* use DB_LOCKDOWN */ int dblayer_lock_config; + u_int32_t dblayer_deadlock_policy; /* i.e. the atype to DB_ENV->lock_detect in deadlock_threadmain */ }; #if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300 diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c index eeae22b..44ccf78 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_config.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c @@ -1326,6 +1326,40 @@ static int ldbm_config_db_tx_max_set( return retval; } +static void *ldbm_config_db_deadlock_policy_get(void *arg) +{ + struct ldbminfo *li = (struct ldbminfo *) arg; + + return (void *) ((uintptr_t)li->li_dblayer_private->dblayer_deadlock_policy); +} + +static int ldbm_config_db_deadlock_policy_set(void *arg, void *value, char *errorbuf, int phase, int apply) +{ + struct ldbminfo *li = (struct ldbminfo *) arg; + int retval = LDAP_SUCCESS; + u_int32_t val = (u_int32_t) ((uintptr_t)value); + + if ((val < DB_LOCK_NORUN) || (val > DB_LOCK_YOUNGEST)) { + PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, + "Error: Invalid value for %s (%d). Must be between %d and %d inclusive", + CONFIG_DB_DEADLOCK_POLICY, val, DB_LOCK_DEFAULT, DB_LOCK_YOUNGEST); + LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s\n", errorbuf); + return LDAP_UNWILLING_TO_PERFORM; + } + if (val == DB_LOCK_NORUN) { + PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, + "Warning: Setting value for %s to (%d) will disable deadlock detection", + CONFIG_DB_DEADLOCK_POLICY, val); + LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s\n", errorbuf); + } + + if (apply) { + li->li_dblayer_private->dblayer_deadlock_policy = val; + } + + return retval; +} + /*------------------------------------------------------------------------ * Configuration array for ldbm and dblayer variables @@ -1385,6 +1419,7 @@ static config_info ldbm_config[] = { {CONFIG_PAGEDLOOKTHROUGHLIMIT, CONFIG_TYPE_INT, "0", &ldbm_config_pagedlookthroughlimit_get, &ldbm_config_pagedlookthroughlimit_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_PAGEDIDLISTSCANLIMIT, CONFIG_TYPE_INT, "0", &ldbm_config_pagedallidsthreshold_get, &ldbm_config_pagedallidsthreshold_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_RANGELOOKTHROUGHLIMIT, CONFIG_TYPE_INT, "5000", &ldbm_config_rangelookthroughlimit_get, &ldbm_config_rangelookthroughlimit_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, + {CONFIG_DB_DEADLOCK_POLICY, CONFIG_TYPE_INT, STRINGIFYDEFINE(DB_LOCK_YOUNGEST), &ldbm_config_db_deadlock_policy_get, &ldbm_config_db_deadlock_policy_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {NULL, 0, NULL, NULL, NULL, 0} }; diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h b/ldap/servers/slapd/back-ldbm/ldbm_config.h index 33eb078..553d387 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_config.h +++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h @@ -159,6 +159,8 @@ struct config_info { #define CONFIG_USE_LEGACY_ERRORCODE "nsslapd-do-not-use-vlv-error" +#define CONFIG_DB_DEADLOCK_POLICY "nsslapd-db-deadlock-policy" + #define CONFIG_LDBM_DN "cn=config,cn=ldbm database,cn=plugins,cn=config" #define LDBM_INSTANCE_CONFIG_DONT_WRITE 1 diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h index fd580ea..632c081 100644 --- a/ldap/servers/slapd/slapi-plugin.h +++ b/ldap/servers/slapd/slapi-plugin.h @@ -107,6 +107,9 @@ NSPR_API(PRUint32) PR_fprintf(struct PRFileDesc* fd, const char *fmt, ...) #define BERLEN_T "u" #endif +#define DEFINETOSTR(xxx) #xxx +#define STRINGIFYDEFINE(xxx) DEFINETOSTR(xxx) + /* Common check on berval before accessing the contents. */ /* bv is a struct berval *bv */ #define BV_HAS_DATA(bv) ((bv != NULL) && (bv->bv_len > 0) && (bv->bv_val != NULL))
1
0
0
0
Branch '389-ds-base-1.3.0' - ldap/servers
by Richard Allen Megginson
28 Jun '13
28 Jun '13
ldap/servers/slapd/back-ldbm/dblayer.c | 19 ++++++++++----- ldap/servers/slapd/back-ldbm/dblayer.h | 1 ldap/servers/slapd/back-ldbm/ldbm_config.c | 35 +++++++++++++++++++++++++++++ ldap/servers/slapd/back-ldbm/ldbm_config.h | 2 + ldap/servers/slapd/slapi-plugin.h | 3 ++ 5 files changed, 54 insertions(+), 6 deletions(-) New commits: commit 42a3ef2644d31355da4d82e1f11b2b2eada554a7 Author: Rich Megginson <rmeggins(a)redhat.com> Date: Tue Jun 25 19:48:17 2013 -0600 Ticket #47409 - allow setting db deadlock rejection policy
https://fedorahosted.org/389/ticket/47409
Reviewed by: nhosoi (Thanks!) Branch: 389-ds-base-1.3.0 Fix Description: Add the db config attribute nsslapd-db-deadlock-policy. This takes values from 1-9. The values correspond to the deadlock detector modes in db.h. These are the valid values to pass to the DBENV->lock_detect method for the atype parameter. The default value is 9 (DB_LOCK_YOUNGEST) - select the youngest locker and reject it. A value of 0 (DB_LOCK_NORUN) means to disable deadlock detection and rejection - not recommended except for testing purposes. Attempting to use other values will cause an error. Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: yes - document new config parameter (cherry picked from commit d62cd9b69c8a4a852e7bea0345285dc8c3e1e547) diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c index 1e67a5d..1b89e7e 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.c +++ b/ldap/servers/slapd/back-ldbm/dblayer.c @@ -4268,6 +4268,7 @@ static int deadlock_threadmain(void *param) dblayer_private *priv = NULL; struct ldbminfo *li = NULL; PRIntervalTime interval; /*NSPR timeout stuffy*/ + u_int32_t flags = 0; PR_ASSERT(NULL != param); li = (struct ldbminfo*)param; @@ -4282,13 +4283,19 @@ static int deadlock_threadmain(void *param) { if (priv->dblayer_enable_transactions) { - if (dblayer_db_uses_locking(priv->dblayer_env->dblayer_DB_ENV)) { - int aborted; - if ((rval = LOCK_DETECT(priv->dblayer_env->dblayer_DB_ENV, - 0, DB_LOCK_YOUNGEST, &aborted)) != 0) { + DB_ENV *db_env = priv->dblayer_env->dblayer_DB_ENV; + u_int32_t deadlock_policy = priv->dblayer_deadlock_policy; + + if (dblayer_db_uses_locking(db_env) && (deadlock_policy > DB_LOCK_NORUN)) { + int rejected = 0; + + if ((rval = LOCK_DETECT(db_env, 0, deadlock_policy, &rejected)) != 0) { LDAPDebug(LDAP_DEBUG_ANY, - "Serious Error---Failed in deadlock detect (aborted at 0x%x), err=%d (%s)\n", - aborted, rval, dblayer_strerror(rval)); + "Serious Error---Failed in deadlock detect (aborted at 0x%x), err=%d (%s)\n", + rejected, rval, dblayer_strerror(rval)); + } else if (rejected) { + LDAPDebug1Arg(LDAP_DEBUG_TRACE, "deadlock_threadmain: found and rejected %d lock requests\n", rejected); + } } } diff --git a/ldap/servers/slapd/back-ldbm/dblayer.h b/ldap/servers/slapd/back-ldbm/dblayer.h index ab9a85d..7f3200c 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.h +++ b/ldap/servers/slapd/back-ldbm/dblayer.h @@ -178,6 +178,7 @@ struct dblayer_private PRCondVar *thread_count_cv; /* condition variable for housekeeping thread shutdown */ int dblayer_lockdown; /* use DB_LOCKDOWN */ int dblayer_lock_config; + u_int32_t dblayer_deadlock_policy; /* i.e. the atype to DB_ENV->lock_detect in deadlock_threadmain */ }; #if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300 diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c index eeae22b..44ccf78 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_config.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c @@ -1326,6 +1326,40 @@ static int ldbm_config_db_tx_max_set( return retval; } +static void *ldbm_config_db_deadlock_policy_get(void *arg) +{ + struct ldbminfo *li = (struct ldbminfo *) arg; + + return (void *) ((uintptr_t)li->li_dblayer_private->dblayer_deadlock_policy); +} + +static int ldbm_config_db_deadlock_policy_set(void *arg, void *value, char *errorbuf, int phase, int apply) +{ + struct ldbminfo *li = (struct ldbminfo *) arg; + int retval = LDAP_SUCCESS; + u_int32_t val = (u_int32_t) ((uintptr_t)value); + + if ((val < DB_LOCK_NORUN) || (val > DB_LOCK_YOUNGEST)) { + PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, + "Error: Invalid value for %s (%d). Must be between %d and %d inclusive", + CONFIG_DB_DEADLOCK_POLICY, val, DB_LOCK_DEFAULT, DB_LOCK_YOUNGEST); + LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s\n", errorbuf); + return LDAP_UNWILLING_TO_PERFORM; + } + if (val == DB_LOCK_NORUN) { + PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, + "Warning: Setting value for %s to (%d) will disable deadlock detection", + CONFIG_DB_DEADLOCK_POLICY, val); + LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s\n", errorbuf); + } + + if (apply) { + li->li_dblayer_private->dblayer_deadlock_policy = val; + } + + return retval; +} + /*------------------------------------------------------------------------ * Configuration array for ldbm and dblayer variables @@ -1385,6 +1419,7 @@ static config_info ldbm_config[] = { {CONFIG_PAGEDLOOKTHROUGHLIMIT, CONFIG_TYPE_INT, "0", &ldbm_config_pagedlookthroughlimit_get, &ldbm_config_pagedlookthroughlimit_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_PAGEDIDLISTSCANLIMIT, CONFIG_TYPE_INT, "0", &ldbm_config_pagedallidsthreshold_get, &ldbm_config_pagedallidsthreshold_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_RANGELOOKTHROUGHLIMIT, CONFIG_TYPE_INT, "5000", &ldbm_config_rangelookthroughlimit_get, &ldbm_config_rangelookthroughlimit_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, + {CONFIG_DB_DEADLOCK_POLICY, CONFIG_TYPE_INT, STRINGIFYDEFINE(DB_LOCK_YOUNGEST), &ldbm_config_db_deadlock_policy_get, &ldbm_config_db_deadlock_policy_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {NULL, 0, NULL, NULL, NULL, 0} }; diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h b/ldap/servers/slapd/back-ldbm/ldbm_config.h index 33eb078..553d387 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_config.h +++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h @@ -159,6 +159,8 @@ struct config_info { #define CONFIG_USE_LEGACY_ERRORCODE "nsslapd-do-not-use-vlv-error" +#define CONFIG_DB_DEADLOCK_POLICY "nsslapd-db-deadlock-policy" + #define CONFIG_LDBM_DN "cn=config,cn=ldbm database,cn=plugins,cn=config" #define LDBM_INSTANCE_CONFIG_DONT_WRITE 1 diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h index b1a4fe7..b216363 100644 --- a/ldap/servers/slapd/slapi-plugin.h +++ b/ldap/servers/slapd/slapi-plugin.h @@ -107,6 +107,9 @@ NSPR_API(PRUint32) PR_fprintf(struct PRFileDesc* fd, const char *fmt, ...) #define BERLEN_T "u" #endif +#define DEFINETOSTR(xxx) #xxx +#define STRINGIFYDEFINE(xxx) DEFINETOSTR(xxx) + /* Common check on berval before accessing the contents. */ /* bv is a struct berval *bv */ #define BV_HAS_DATA(bv) ((bv != NULL) && (bv->bv_len > 0) && (bv->bv_val != NULL))
1
0
0
0
ldap/servers
by Richard Allen Megginson
28 Jun '13
28 Jun '13
ldap/servers/slapd/back-ldbm/dblayer.c | 19 ++++++++++----- ldap/servers/slapd/back-ldbm/dblayer.h | 1 ldap/servers/slapd/back-ldbm/ldbm_config.c | 35 +++++++++++++++++++++++++++++ ldap/servers/slapd/back-ldbm/ldbm_config.h | 2 + ldap/servers/slapd/slapi-plugin.h | 3 ++ 5 files changed, 54 insertions(+), 6 deletions(-) New commits: commit 4989e77e2866d53c8bd79a3439b7dd84390cf576 Author: Rich Megginson <rmeggins(a)redhat.com> Date: Tue Jun 25 19:48:17 2013 -0600 Ticket #47409 - allow setting db deadlock rejection policy
https://fedorahosted.org/389/ticket/47409
Reviewed by: nhosoi (Thanks!) Branch: master Fix Description: Add the db config attribute nsslapd-db-deadlock-policy. This takes values from 1-9. The values correspond to the deadlock detector modes in db.h. These are the valid values to pass to the DBENV->lock_detect method for the atype parameter. The default value is 9 (DB_LOCK_YOUNGEST) - select the youngest locker and reject it. A value of 0 (DB_LOCK_NORUN) means to disable deadlock detection and rejection - not recommended except for testing purposes. Attempting to use other values will cause an error. Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: yes - document new config parameter diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c index dbe1886..bbe0ee4 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.c +++ b/ldap/servers/slapd/back-ldbm/dblayer.c @@ -4466,6 +4466,7 @@ static int deadlock_threadmain(void *param) dblayer_private *priv = NULL; struct ldbminfo *li = NULL; PRIntervalTime interval; /*NSPR timeout stuffy*/ + u_int32_t flags = 0; PR_ASSERT(NULL != param); li = (struct ldbminfo*)param; @@ -4480,13 +4481,19 @@ static int deadlock_threadmain(void *param) { if (priv->dblayer_enable_transactions) { - if (dblayer_db_uses_locking(priv->dblayer_env->dblayer_DB_ENV)) { - int aborted; - if ((rval = LOCK_DETECT(priv->dblayer_env->dblayer_DB_ENV, - 0, DB_LOCK_YOUNGEST, &aborted)) != 0) { + DB_ENV *db_env = priv->dblayer_env->dblayer_DB_ENV; + u_int32_t deadlock_policy = priv->dblayer_deadlock_policy; + + if (dblayer_db_uses_locking(db_env) && (deadlock_policy > DB_LOCK_NORUN)) { + int rejected = 0; + + if ((rval = LOCK_DETECT(db_env, 0, deadlock_policy, &rejected)) != 0) { LDAPDebug(LDAP_DEBUG_ANY, - "Serious Error---Failed in deadlock detect (aborted at 0x%x), err=%d (%s)\n", - aborted, rval, dblayer_strerror(rval)); + "Serious Error---Failed in deadlock detect (aborted at 0x%x), err=%d (%s)\n", + rejected, rval, dblayer_strerror(rval)); + } else if (rejected) { + LDAPDebug1Arg(LDAP_DEBUG_TRACE, "deadlock_threadmain: found and rejected %d lock requests\n", rejected); + } } } diff --git a/ldap/servers/slapd/back-ldbm/dblayer.h b/ldap/servers/slapd/back-ldbm/dblayer.h index ab9a85d..7f3200c 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.h +++ b/ldap/servers/slapd/back-ldbm/dblayer.h @@ -178,6 +178,7 @@ struct dblayer_private PRCondVar *thread_count_cv; /* condition variable for housekeeping thread shutdown */ int dblayer_lockdown; /* use DB_LOCKDOWN */ int dblayer_lock_config; + u_int32_t dblayer_deadlock_policy; /* i.e. the atype to DB_ENV->lock_detect in deadlock_threadmain */ }; #if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300 diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c index a10f0c7..c39e69b 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_config.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c @@ -1394,6 +1394,40 @@ static int ldbm_config_db_tx_max_set( return retval; } +static void *ldbm_config_db_deadlock_policy_get(void *arg) +{ + struct ldbminfo *li = (struct ldbminfo *) arg; + + return (void *) ((uintptr_t)li->li_dblayer_private->dblayer_deadlock_policy); +} + +static int ldbm_config_db_deadlock_policy_set(void *arg, void *value, char *errorbuf, int phase, int apply) +{ + struct ldbminfo *li = (struct ldbminfo *) arg; + int retval = LDAP_SUCCESS; + u_int32_t val = (u_int32_t) ((uintptr_t)value); + + if ((val < DB_LOCK_NORUN) || (val > DB_LOCK_YOUNGEST)) { + PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, + "Error: Invalid value for %s (%d). Must be between %d and %d inclusive", + CONFIG_DB_DEADLOCK_POLICY, val, DB_LOCK_DEFAULT, DB_LOCK_YOUNGEST); + LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s\n", errorbuf); + return LDAP_UNWILLING_TO_PERFORM; + } + if (val == DB_LOCK_NORUN) { + PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, + "Warning: Setting value for %s to (%d) will disable deadlock detection", + CONFIG_DB_DEADLOCK_POLICY, val); + LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s\n", errorbuf); + } + + if (apply) { + li->li_dblayer_private->dblayer_deadlock_policy = val; + } + + return retval; +} + /*------------------------------------------------------------------------ * Configuration array for ldbm and dblayer variables @@ -1458,6 +1492,7 @@ static config_info ldbm_config[] = { {CONFIG_PAGEDIDLISTSCANLIMIT, CONFIG_TYPE_INT, "0", &ldbm_config_pagedallidsthreshold_get, &ldbm_config_pagedallidsthreshold_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_RANGELOOKTHROUGHLIMIT, CONFIG_TYPE_INT, "5000", &ldbm_config_rangelookthroughlimit_get, &ldbm_config_rangelookthroughlimit_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_BACKEND_OPT_LEVEL, CONFIG_TYPE_INT, "1", &ldbm_config_backend_opt_level_get, &ldbm_config_backend_opt_level_set, CONFIG_FLAG_ALWAYS_SHOW}, + {CONFIG_DB_DEADLOCK_POLICY, CONFIG_TYPE_INT, STRINGIFYDEFINE(DB_LOCK_YOUNGEST), &ldbm_config_db_deadlock_policy_get, &ldbm_config_db_deadlock_policy_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {NULL, 0, NULL, NULL, NULL, 0} }; diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h b/ldap/servers/slapd/back-ldbm/ldbm_config.h index b0a7fab..f420707 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_config.h +++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h @@ -164,6 +164,8 @@ struct config_info { #define CONFIG_USE_LEGACY_ERRORCODE "nsslapd-do-not-use-vlv-error" +#define CONFIG_DB_DEADLOCK_POLICY "nsslapd-db-deadlock-policy" + #define CONFIG_LDBM_DN "cn=config,cn=ldbm database,cn=plugins,cn=config" #define LDBM_INSTANCE_CONFIG_DONT_WRITE 1 diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h index 9a66f2a..f08540f 100644 --- a/ldap/servers/slapd/slapi-plugin.h +++ b/ldap/servers/slapd/slapi-plugin.h @@ -107,6 +107,9 @@ NSPR_API(PRUint32) PR_fprintf(struct PRFileDesc* fd, const char *fmt, ...) #define BERLEN_T "u" #endif +#define DEFINETOSTR(xxx) #xxx +#define STRINGIFYDEFINE(xxx) DEFINETOSTR(xxx) + /* Common check on berval before accessing the contents. */ /* bv is a struct berval *bv */ #define BV_HAS_DATA(bv) ((bv != NULL) && (bv->bv_len > 0) && (bv->bv_val != NULL))
1
0
0
0
Branch '389-ds-base-1.2.11' - ldap/servers
by Richard Allen Megginson
28 Jun '13
28 Jun '13
ldap/servers/slapd/back-ldbm/dblayer.c | 19 ++++++++++----- ldap/servers/slapd/back-ldbm/dblayer.h | 1 ldap/servers/slapd/back-ldbm/ldbm_config.c | 35 +++++++++++++++++++++++++++++ ldap/servers/slapd/back-ldbm/ldbm_config.h | 2 + ldap/servers/slapd/slapi-plugin.h | 3 ++ 5 files changed, 54 insertions(+), 6 deletions(-) New commits: commit f7548908d4749db429f17e23c01624475c121def Author: Rich Megginson <rmeggins(a)redhat.com> Date: Tue Jun 25 19:48:17 2013 -0600 Ticket #47409 - allow setting db deadlock rejection policy
https://fedorahosted.org/389/ticket/47409
Reviewed by: nhosoi (Thanks!) Branch: 389-ds-base-1.2.11 Fix Description: Add the db config attribute nsslapd-db-deadlock-policy. This takes values from 1-9. The values correspond to the deadlock detector modes in db.h. These are the valid values to pass to the DBENV->lock_detect method for the atype parameter. The default value is 9 (DB_LOCK_YOUNGEST) - select the youngest locker and reject it. A value of 0 (DB_LOCK_NORUN) means to disable deadlock detection and rejection - not recommended except for testing purposes. Attempting to use other values will cause an error. Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: yes - document new config parameter (cherry picked from commit d62cd9b69c8a4a852e7bea0345285dc8c3e1e547) (cherry picked from commit 42a3ef2644d31355da4d82e1f11b2b2eada554a7) diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c index e90022f..5bd808e 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.c +++ b/ldap/servers/slapd/back-ldbm/dblayer.c @@ -4210,6 +4210,7 @@ static int deadlock_threadmain(void *param) dblayer_private *priv = NULL; struct ldbminfo *li = NULL; PRIntervalTime interval; /*NSPR timeout stuffy*/ + u_int32_t flags = 0; PR_ASSERT(NULL != param); li = (struct ldbminfo*)param; @@ -4224,13 +4225,19 @@ static int deadlock_threadmain(void *param) { if (priv->dblayer_enable_transactions) { - if (dblayer_db_uses_locking(priv->dblayer_env->dblayer_DB_ENV)) { - int aborted; - if ((rval = LOCK_DETECT(priv->dblayer_env->dblayer_DB_ENV, - 0, DB_LOCK_YOUNGEST, &aborted)) != 0) { + DB_ENV *db_env = priv->dblayer_env->dblayer_DB_ENV; + u_int32_t deadlock_policy = priv->dblayer_deadlock_policy; + + if (dblayer_db_uses_locking(db_env) && (deadlock_policy > DB_LOCK_NORUN)) { + int rejected = 0; + + if ((rval = LOCK_DETECT(db_env, 0, deadlock_policy, &rejected)) != 0) { LDAPDebug(LDAP_DEBUG_ANY, - "Serious Error---Failed in deadlock detect (aborted at 0x%x), err=%d (%s)\n", - aborted, rval, dblayer_strerror(rval)); + "Serious Error---Failed in deadlock detect (aborted at 0x%x), err=%d (%s)\n", + rejected, rval, dblayer_strerror(rval)); + } else if (rejected) { + LDAPDebug1Arg(LDAP_DEBUG_TRACE, "deadlock_threadmain: found and rejected %d lock requests\n", rejected); + } } } diff --git a/ldap/servers/slapd/back-ldbm/dblayer.h b/ldap/servers/slapd/back-ldbm/dblayer.h index ab9a85d..7f3200c 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.h +++ b/ldap/servers/slapd/back-ldbm/dblayer.h @@ -178,6 +178,7 @@ struct dblayer_private PRCondVar *thread_count_cv; /* condition variable for housekeeping thread shutdown */ int dblayer_lockdown; /* use DB_LOCKDOWN */ int dblayer_lock_config; + u_int32_t dblayer_deadlock_policy; /* i.e. the atype to DB_ENV->lock_detect in deadlock_threadmain */ }; #if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300 diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c index eeae22b..44ccf78 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_config.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c @@ -1326,6 +1326,40 @@ static int ldbm_config_db_tx_max_set( return retval; } +static void *ldbm_config_db_deadlock_policy_get(void *arg) +{ + struct ldbminfo *li = (struct ldbminfo *) arg; + + return (void *) ((uintptr_t)li->li_dblayer_private->dblayer_deadlock_policy); +} + +static int ldbm_config_db_deadlock_policy_set(void *arg, void *value, char *errorbuf, int phase, int apply) +{ + struct ldbminfo *li = (struct ldbminfo *) arg; + int retval = LDAP_SUCCESS; + u_int32_t val = (u_int32_t) ((uintptr_t)value); + + if ((val < DB_LOCK_NORUN) || (val > DB_LOCK_YOUNGEST)) { + PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, + "Error: Invalid value for %s (%d). Must be between %d and %d inclusive", + CONFIG_DB_DEADLOCK_POLICY, val, DB_LOCK_DEFAULT, DB_LOCK_YOUNGEST); + LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s\n", errorbuf); + return LDAP_UNWILLING_TO_PERFORM; + } + if (val == DB_LOCK_NORUN) { + PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, + "Warning: Setting value for %s to (%d) will disable deadlock detection", + CONFIG_DB_DEADLOCK_POLICY, val); + LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s\n", errorbuf); + } + + if (apply) { + li->li_dblayer_private->dblayer_deadlock_policy = val; + } + + return retval; +} + /*------------------------------------------------------------------------ * Configuration array for ldbm and dblayer variables @@ -1385,6 +1419,7 @@ static config_info ldbm_config[] = { {CONFIG_PAGEDLOOKTHROUGHLIMIT, CONFIG_TYPE_INT, "0", &ldbm_config_pagedlookthroughlimit_get, &ldbm_config_pagedlookthroughlimit_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_PAGEDIDLISTSCANLIMIT, CONFIG_TYPE_INT, "0", &ldbm_config_pagedallidsthreshold_get, &ldbm_config_pagedallidsthreshold_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_RANGELOOKTHROUGHLIMIT, CONFIG_TYPE_INT, "5000", &ldbm_config_rangelookthroughlimit_get, &ldbm_config_rangelookthroughlimit_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, + {CONFIG_DB_DEADLOCK_POLICY, CONFIG_TYPE_INT, STRINGIFYDEFINE(DB_LOCK_YOUNGEST), &ldbm_config_db_deadlock_policy_get, &ldbm_config_db_deadlock_policy_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {NULL, 0, NULL, NULL, NULL, 0} }; diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h b/ldap/servers/slapd/back-ldbm/ldbm_config.h index 33eb078..553d387 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_config.h +++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h @@ -159,6 +159,8 @@ struct config_info { #define CONFIG_USE_LEGACY_ERRORCODE "nsslapd-do-not-use-vlv-error" +#define CONFIG_DB_DEADLOCK_POLICY "nsslapd-db-deadlock-policy" + #define CONFIG_LDBM_DN "cn=config,cn=ldbm database,cn=plugins,cn=config" #define LDBM_INSTANCE_CONFIG_DONT_WRITE 1 diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h index 4a2544e..0fdb206 100644 --- a/ldap/servers/slapd/slapi-plugin.h +++ b/ldap/servers/slapd/slapi-plugin.h @@ -107,6 +107,9 @@ NSPR_API(PRUint32) PR_fprintf(struct PRFileDesc* fd, const char *fmt, ...) #define BERLEN_T "u" #endif +#define DEFINETOSTR(xxx) #xxx +#define STRINGIFYDEFINE(xxx) DEFINETOSTR(xxx) + /* Common check on berval before accessing the contents. */ /* bv is a struct berval *bv */ #define BV_HAS_DATA(bv) ((bv != NULL) && (bv->bv_len > 0) && (bv->bv_val != NULL))
1
0
0
0
Branch '389-ds-base-1.3.1' - ldap/servers
by Noriko Hosoi
28 Jun '13
28 Jun '13
ldap/servers/slapd/tools/rsearch/scripts/dbgen.pl.in | 69 +++++++++++++------ 1 file changed, 50 insertions(+), 19 deletions(-) New commits: commit 91e3ba63d006a77a704811e532c5c05e1375e3d8 Author: Noriko Hosoi <nhosoi(a)redhat.com> Date: Thu Jun 27 16:13:00 2013 -0700 Ticket #47374 - flush.pl is not included in perl5 Fix description: replaced obsolete flush.pl and getopts.pl with perl5 equivalents.
https://fedorahosted.org/389/ticket/47374
Reviewed by Rich (Thank you!!) (cherry picked from commit 8bb10ab2c2a1283aac4540a023acb0361f56f003) diff --git a/ldap/servers/slapd/tools/rsearch/scripts/dbgen.pl.in b/ldap/servers/slapd/tools/rsearch/scripts/dbgen.pl.in index ce18f7c..51af0db 100755 --- a/ldap/servers/slapd/tools/rsearch/scripts/dbgen.pl.in +++ b/ldap/servers/slapd/tools/rsearch/scripts/dbgen.pl.in @@ -55,6 +55,7 @@ ## Now, dc style namingcontext can be used. #------------------------------------------------------------------------ +use Getopt::Long; sub PrintUsage { print STDERR @@ -68,8 +69,7 @@ sub PrintUsage { "\t -m naming attribute for RDN\n", "\t -n number of entries to generate\n", "\t -b beginning number for RDN (default 1 - ending number is -n value)\n", - "\t -O for organizationalPersons, default is inetOrgPerson\n", - "\t -p for piranha style aci's, default is barracuda\n", + "\t -p for organizationalPersons, default is inetOrgPerson\n", "\t -r seed---seed number for random number generator\n", "\t -g print extra entries for orgchart\n", "\t -x suppress printing pre amble\n", @@ -533,30 +533,61 @@ my $mycert = ); @managers = (\%m0, \%m1, \%m2, \%m3, \%m4, \%m5, \%m6, \%m7, \%m8, \%m9, \%m10, \%m11, \%m12, \%m13, \%m14, \%m15, \%m16, \%m17); -require "flush.pl"; -require "getopts.pl"; -&Getopts('n:o:s:r:cOvpqgxyl:z:m:b:j:'); - -$Number_To_Generate = $opt_n; -$Verbose = $opt_v; -$Quiet = $opt_q; -$Output_File_Name = $opt_o; -$Random_Seed = $opt_r || 0xdbdbdbdb; -$TargetServer = $opt_t; -$debug = $opt_d; -$Suffix = $opt_s || 'dc=example,dc=com'; +sub flush { + local($old) = select(shift); + $| = 1; + print ""; + $| = 0; + select($old); +} + +my $Number_To_Generate = 1; +$Output_File_Name = "output.ldif"; +$Random_Seed = 1; +$Suffix = 'dc=example,dc=com'; +$NamingType = "uid"; +$inetOrgPerson = "objectClass: inetOrgPerson\n"; +$PrintOrgChartDat = 0; +$DataDir = "/usr/share/dirsrv/data"; +$BeginNum = 0; + +$Verbose = 0; +$debug = 0; +$Quiet = 0; + +$opt_x = 0; +$opt_y = 0; +$opt_z = ""; + +GetOptions('number=i' => \$Number_To_Generate, + 'output=s' => \$Output_File_Name, + 'random=i' => \$Random_Seed, + 'suffix=s' => \$Suffix, + 'cnInDn' => \$opt_c, + 'moreChoices=s' => \$opt_m, + 'person' => \$opt_p, + 'graph' => \$PrintOrgChartDat, + 'location=s' => \$DataDir, + 'beginNum=i' => \$BeginNum, + 'x' => \$opt_x, + 'y' => \$opt_y, + 'z' => \$opt_z, + 'j' => \$opt_j, + 'verbose' => \$Verbose, + 'debug' => \$debug, + 'quiet' => \$Quiet, + ); + +$Random_Seed = $Random_Seed || 0xdbdbdbdb; $NamingType = "cn" if ($opt_c); -$NamingType = "uid" if (!$opt_c); $NamingType = $opt_m if ($opt_m); -$inetOrgPerson = "objectClass: inetOrgPerson\n" if (!$opt_O); -$PrintOrgChartDat = $opt_g; -$DataDir = $opt_l || "@templatedir@"; +$inetOrgPerson = "" if ($opt_p); + $ExtraObjClasses = ""; if ($opt_z) { $ExtraObjClasses = join "\n", map { "objectClass: $_" } split(/ /, $opt_z); $ExtraObjClasses .= "\n"; } -$BeginNum = $opt_b || 0; $printpreamble = 1; if ("" != $opt_x) {
1
0
0
0
← Newer
1
2
3
4
...
11
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
Results per page:
10
25
50
100
200