mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
allow a friendly behavior of write stress testers...
This commit is contained in:
parent
203525a64b
commit
e730640c02
@ -41,7 +41,8 @@ get_add_entry( char *filename, LDAPMod ***mods );
|
||||
|
||||
static void
|
||||
do_addel( char *uri, char *host, int port, char *manager, char *passwd,
|
||||
char *dn, LDAPMod **attrs, int maxloop, int maxretries, int delay );
|
||||
char *dn, LDAPMod **attrs, int maxloop, int maxretries, int delay,
|
||||
int friendly );
|
||||
|
||||
static void
|
||||
usage( char *name )
|
||||
@ -73,10 +74,15 @@ main( int argc, char **argv )
|
||||
int loops = LOOPS;
|
||||
int retries = RETRIES;
|
||||
int delay = 0;
|
||||
int friendly = 0;
|
||||
LDAPMod **attrs = NULL;
|
||||
|
||||
while ( (i = getopt( argc, argv, "H:h:p:D:w:f:l:r:t:" )) != EOF ) {
|
||||
while ( (i = getopt( argc, argv, "FH:h:p:D:w:f:l:r:t:" )) != EOF ) {
|
||||
switch( i ) {
|
||||
case 'F':
|
||||
friendly++;
|
||||
break;
|
||||
|
||||
case 'H': /* the server's URI */
|
||||
uri = strdup( optarg );
|
||||
break;
|
||||
@ -141,7 +147,7 @@ main( int argc, char **argv )
|
||||
}
|
||||
|
||||
do_addel( uri, host, port, manager, passwd, entry, attrs,
|
||||
loops, retries, delay );
|
||||
loops, retries, delay, friendly );
|
||||
|
||||
exit( EXIT_SUCCESS );
|
||||
}
|
||||
@ -272,7 +278,8 @@ do_addel(
|
||||
LDAPMod **attrs,
|
||||
int maxloop,
|
||||
int maxretries,
|
||||
int delay
|
||||
int delay,
|
||||
int friendly
|
||||
)
|
||||
{
|
||||
LDAP *ld = NULL;
|
||||
@ -333,6 +340,9 @@ retry:;
|
||||
/* NOTE: this likely means
|
||||
* the delete failed
|
||||
* during the previous round... */
|
||||
if ( !friendly ) {
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
|
||||
case LDAP_BUSY:
|
||||
@ -363,6 +373,9 @@ retry:;
|
||||
/* NOTE: this likely means
|
||||
* the add failed
|
||||
* during the previous round... */
|
||||
if ( !friendly ) {
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
|
||||
case LDAP_BUSY:
|
||||
|
@ -35,7 +35,7 @@
|
||||
static void
|
||||
do_modify( char *uri, char *host, int port, char *manager, char *passwd,
|
||||
char *entry, char *attr, char *value, int maxloop,
|
||||
int maxretries, int delay );
|
||||
int maxretries, int delay, int friendly );
|
||||
|
||||
|
||||
static void
|
||||
@ -69,9 +69,14 @@ main( int argc, char **argv )
|
||||
int loops = LOOPS;
|
||||
int retries = RETRIES;
|
||||
int delay = 0;
|
||||
int friendly = 0;
|
||||
|
||||
while ( (i = getopt( argc, argv, "H:h:p:D:w:e:a:l:r:t:" )) != EOF ) {
|
||||
while ( (i = getopt( argc, argv, "FH:h:p:D:w:e:a:l:r:t:" )) != EOF ) {
|
||||
switch( i ) {
|
||||
case 'F':
|
||||
friendly++;
|
||||
break;
|
||||
|
||||
case 'H': /* the server uri */
|
||||
uri = strdup( optarg );
|
||||
break;
|
||||
@ -144,7 +149,7 @@ main( int argc, char **argv )
|
||||
value++;
|
||||
|
||||
do_modify( uri, host, port, manager, passwd, entry, ava, value,
|
||||
loops, retries, delay );
|
||||
loops, retries, delay, friendly );
|
||||
exit( EXIT_SUCCESS );
|
||||
}
|
||||
|
||||
@ -152,7 +157,7 @@ main( int argc, char **argv )
|
||||
static void
|
||||
do_modify( char *uri, char *host, int port, char *manager,
|
||||
char *passwd, char *entry, char* attr, char* value,
|
||||
int maxloop, int maxretries, int delay )
|
||||
int maxloop, int maxretries, int delay, int friendly )
|
||||
{
|
||||
LDAP *ld = NULL;
|
||||
int i = 0, do_retry = maxretries;
|
||||
@ -225,6 +230,9 @@ retry:;
|
||||
/* NOTE: this likely means
|
||||
* the second modify failed
|
||||
* during the previous round... */
|
||||
if ( !friendly ) {
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
|
||||
case LDAP_BUSY:
|
||||
@ -249,6 +257,9 @@ retry:;
|
||||
/* NOTE: this likely means
|
||||
* the first modify failed
|
||||
* during the previous round... */
|
||||
if ( !friendly ) {
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
|
||||
case LDAP_BUSY:
|
||||
|
@ -38,7 +38,8 @@
|
||||
|
||||
static void
|
||||
do_modrdn( char *uri, char *host, int port, char *manager, char *passwd,
|
||||
char *entry, int maxloop, int maxretries, int delay );
|
||||
char *entry, int maxloop, int maxretries, int delay,
|
||||
int friendly );
|
||||
|
||||
static void
|
||||
usage( char *name )
|
||||
@ -69,9 +70,14 @@ main( int argc, char **argv )
|
||||
int loops = LOOPS;
|
||||
int retries = RETRIES;
|
||||
int delay = 0;
|
||||
int friendly = 0;
|
||||
|
||||
while ( (i = getopt( argc, argv, "H:h:p:D:w:e:l:r:t:" )) != EOF ) {
|
||||
while ( (i = getopt( argc, argv, "FH:h:p:D:w:e:l:r:t:" )) != EOF ) {
|
||||
switch( i ) {
|
||||
case 'F':
|
||||
friendly++;
|
||||
break;
|
||||
|
||||
case 'H': /* the server uri */
|
||||
uri = strdup( optarg );
|
||||
break;
|
||||
@ -125,14 +131,16 @@ main( int argc, char **argv )
|
||||
|
||||
}
|
||||
|
||||
do_modrdn( uri, host, port, manager, passwd, entry, loops, retries, delay );
|
||||
do_modrdn( uri, host, port, manager, passwd, entry,
|
||||
loops, retries, delay, friendly );
|
||||
exit( EXIT_SUCCESS );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
do_modrdn( char *uri, char *host, int port, char *manager,
|
||||
char *passwd, char *entry, int maxloop, int maxretries, int delay )
|
||||
char *passwd, char *entry, int maxloop, int maxretries, int delay,
|
||||
int friendly )
|
||||
{
|
||||
LDAP *ld = NULL;
|
||||
int i = 0, do_retry = maxretries;
|
||||
@ -216,6 +224,9 @@ retry:;
|
||||
/* NOTE: this likely means
|
||||
* the second modrdn failed
|
||||
* during the previous round... */
|
||||
if ( !friendly ) {
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
|
||||
case LDAP_BUSY:
|
||||
@ -238,6 +249,9 @@ retry:;
|
||||
/* NOTE: this likely means
|
||||
* the first modrdn failed
|
||||
* during the previous round... */
|
||||
if ( !friendly ) {
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
|
||||
case LDAP_BUSY:
|
||||
|
@ -80,8 +80,9 @@ usage( char *name )
|
||||
"[-j <maxchild>] "
|
||||
"[-l <loops>] "
|
||||
"-P <progdir> "
|
||||
"[-r <maxretries>]"
|
||||
"[-t <delay>]\n",
|
||||
"[-r <maxretries>] "
|
||||
"[-t <delay>] "
|
||||
"[-F]\n",
|
||||
name );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
@ -133,8 +134,9 @@ main( int argc, char **argv )
|
||||
char *modreqs[MAXREQS];
|
||||
char *moddn[MAXREQS];
|
||||
int modnum = 0;
|
||||
int friendly = 0;
|
||||
|
||||
while ( (i = getopt( argc, argv, "D:d:H:h:j:l:P:p:r:t:w:" )) != EOF ) {
|
||||
while ( (i = getopt( argc, argv, "D:d:FH:h:j:l:P:p:r:t:w:" )) != EOF ) {
|
||||
switch( i ) {
|
||||
case 'D': /* slapd manager */
|
||||
manager = ArgDup( optarg );
|
||||
@ -144,6 +146,10 @@ main( int argc, char **argv )
|
||||
dirname = strdup( optarg );
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
friendly++;
|
||||
break;
|
||||
|
||||
case 'H': /* slapd uri */
|
||||
uri = strdup( optarg );
|
||||
break;
|
||||
@ -332,6 +338,9 @@ main( int argc, char **argv )
|
||||
margs[manum++] = retries;
|
||||
margs[manum++] = "-t";
|
||||
margs[manum++] = delay;
|
||||
if ( friendly ) {
|
||||
margs[manum++] = "-F";
|
||||
}
|
||||
margs[manum++] = "-e";
|
||||
margs[manum++] = NULL; /* will hold the modrdn entry */
|
||||
margs[manum++] = NULL;
|
||||
@ -363,6 +372,9 @@ main( int argc, char **argv )
|
||||
modargs[modanum++] = retries;
|
||||
modargs[modanum++] = "-t";
|
||||
modargs[modanum++] = delay;
|
||||
if ( friendly ) {
|
||||
modargs[modanum++] = "-F";
|
||||
}
|
||||
modargs[modanum++] = "-e";
|
||||
modargs[modanum++] = NULL; /* will hold the modify entry */
|
||||
modargs[modanum++] = "-a";;
|
||||
@ -396,6 +408,9 @@ main( int argc, char **argv )
|
||||
aargs[aanum++] = retries;
|
||||
aargs[aanum++] = "-t";
|
||||
aargs[aanum++] = delay;
|
||||
if ( friendly ) {
|
||||
aargs[aanum++] = "-F";
|
||||
}
|
||||
aargs[aanum++] = "-f";
|
||||
aargs[aanum++] = NULL; /* will hold the add data file */
|
||||
aargs[aanum++] = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user