ITS#9584 avoid busy-loop while refresh is serialized

This commit is contained in:
Howard Chu 2021-07-29 13:28:05 +01:00
parent e893e0e8b6
commit 79d33fe40e
2 changed files with 6 additions and 9 deletions

View file

@ -923,6 +923,7 @@ check_syncprov(
#define SYNC_ERROR -101 #define SYNC_ERROR -101
#define SYNC_REPOLL -102 #define SYNC_REPOLL -102
#define SYNC_PAUSED -103 #define SYNC_PAUSED -103
#define SYNC_BUSY -104
static int static int
do_syncrep1( do_syncrep1(
@ -937,12 +938,8 @@ do_syncrep1(
void *ssl; void *ssl;
#endif #endif
while ( ldap_pvt_thread_mutex_trylock( &si->si_cookieState->cs_refresh_mutex )) { if ( ldap_pvt_thread_mutex_trylock( &si->si_cookieState->cs_refresh_mutex ))
if ( slapd_shutdown ) return SYNC_BUSY;
return SYNC_SHUTDOWN;
if ( !ldap_pvt_thread_pool_pausecheck( &connection_pool ))
ldap_pvt_thread_yield();
}
si->si_lastconnect = slap_get_time(); si->si_lastconnect = slap_get_time();
si->si_refreshDone = 0; si->si_refreshDone = 0;

View file

@ -165,7 +165,7 @@ PORT=`expr $BASEPORT + $n`
URI="ldap://${LOCALHOST}:$PORT/" URI="ldap://${LOCALHOST}:$PORT/"
echo "olcSyncRepl: rid=00$n provider=$URI binddn=\"cn=config\" bindmethod=simple" >> $TMP echo "olcSyncRepl: rid=00$n provider=$URI binddn=\"cn=config\" bindmethod=simple" >> $TMP
echo " credentials=$CONFIGPW searchbase=\"cn=config\" type=refreshAndPersist" >> $TMP echo " credentials=$CONFIGPW searchbase=\"cn=config\" type=refreshAndPersist" >> $TMP
echo " retry=\"3 10 300 5\" timeout=3" >> $TMP echo " retry=\"1 12 300 5\" timeout=3" >> $TMP
n=`expr $n + 1` n=`expr $n + 1`
done done
echo "-" >> $TMP echo "-" >> $TMP
@ -227,7 +227,7 @@ P2=`expr $BASEPORT + $j`
U2="ldap://${LOCALHOST}:$P2/" U2="ldap://${LOCALHOST}:$P2/"
echo "olcSyncRepl: rid=00$j provider=$U2 binddn=\"cn=config\" bindmethod=simple" >> $TMP echo "olcSyncRepl: rid=00$j provider=$U2 binddn=\"cn=config\" bindmethod=simple" >> $TMP
echo " credentials=$CONFIGPW searchbase=\"cn=config\" type=refreshAndPersist" >> $TMP echo " credentials=$CONFIGPW searchbase=\"cn=config\" type=refreshAndPersist" >> $TMP
echo " retry=\"3 10 300 5\" timeout=3" >> $TMP echo " retry=\"1 12 300 5\" timeout=3" >> $TMP
j=`expr $j + 1` j=`expr $j + 1`
done done
cat <<EOF >> $TMP cat <<EOF >> $TMP
@ -291,7 +291,7 @@ URI="ldap://${LOCALHOST}:$PORT/"
echo "olcSyncRepl: rid=01$n provider=$URI binddn=\"$MANAGERDN\" bindmethod=simple" >> $TMP echo "olcSyncRepl: rid=01$n provider=$URI binddn=\"$MANAGERDN\" bindmethod=simple" >> $TMP
echo " credentials=$PASSWD searchbase=\"$BASEDN\" $SYNCTYPE" >> $TMP echo " credentials=$PASSWD searchbase=\"$BASEDN\" $SYNCTYPE" >> $TMP
echo " retry=\"3 10 300 5\" timeout=3" >> $TMP echo " retry=\"1 12 300 5\" timeout=3" >> $TMP
n=`expr $n + 1` n=`expr $n + 1`
done done