From cc5e41723430ebe1d37c1307b6d6bb015af059a0 Mon Sep 17 00:00:00 2001 From: Jong Hyuk Choi Date: Wed, 5 Nov 2003 16:10:43 +0000 Subject: [PATCH] second level interval support, interval=dd:hh:mm:ss changed the test scripts and test conf files accordingly --- servers/slapd/config.c | 63 +++++++++++++------ tests/data/slapd-syncrepl-slave-refresh1.conf | 2 +- tests/data/slapd-syncrepl-slave-refresh2.conf | 2 +- tests/scripts/test017-syncreplication-refresh | 8 +-- tests/scripts/test018-syncreplication-persist | 8 +-- tests/scripts/test019-syncreplication-cascade | 8 +-- 6 files changed, 57 insertions(+), 34 deletions(-) diff --git a/servers/slapd/config.c b/servers/slapd/config.c index a694ef5b1d..347f3239b0 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -3053,28 +3053,51 @@ parse_syncrepl_line( } else if ( !strncasecmp( cargv[ i ], INTERVALSTR, sizeof( INTERVALSTR ) - 1 ) ) { - char *hstr; - char *mstr; - char *dstr; val = cargv[ i ] + sizeof( INTERVALSTR ); - dstr = val; - hstr = strchr( dstr, ':' ); - if ( hstr == NULL ) { - fprintf( stderr, "Error: parse_syncrepl_line: " - "invalid interval \"%s\"\n", val ); - return 1; - } - *hstr++ = '\0'; - mstr = strchr( hstr, ':' ); - if ( mstr == NULL ) { - fprintf( stderr, "Error: parse_syncrepl_line: " - "invalid interval \"%s\"\n", val ); - return 1; + if ( si->si_type == LDAP_SYNC_REFRESH_AND_PERSIST ) { + si->si_interval = 0; + } else { + char *hstr; + char *mstr; + char *dstr; + char *sstr; + int dd, hh, mm, ss; + dstr = val; + hstr = strchr( dstr, ':' ); + if ( hstr == NULL ) { + fprintf( stderr, "Error: parse_syncrepl_line: " + "invalid interval \"%s\"\n", val ); + return 1; + } + *hstr++ = '\0'; + mstr = strchr( hstr, ':' ); + if ( mstr == NULL ) { + fprintf( stderr, "Error: parse_syncrepl_line: " + "invalid interval \"%s\"\n", val ); + return 1; + } + *mstr++ = '\0'; + sstr = strchr( mstr, ':' ); + if ( sstr == NULL ) { + fprintf( stderr, "Error: parse_syncrepl_line: " + "invalid interval \"%s\"\n", val ); + return 1; + } + *sstr++ = '\0'; + + dd = atoi( dstr ); + hh = atoi( hstr ); + mm = atoi( mstr ); + ss = atoi( sstr ); + if (( hh > 24 ) || ( hh < 0 ) || + ( mm > 60 ) || ( mm < 0 ) || + ( ss > 60 ) || ( ss < 0 ) || ( dd < 0 )) { + fprintf( stderr, "Error: parse_syncrepl_line: " + "invalid interval \"%s\"\n", val ); + return 1; + } + si->si_interval = (( dd * 24 + hh ) * 60 + mm ) * 60 + ss; } - *mstr++ = '\0'; - si->si_interval = (( atoi( dstr ) * 24 + atoi( hstr )) * 60 - + atoi( mstr )) * 60; - if ( si->si_interval < 0 ) { fprintf( stderr, "Error: parse_syncrepl_line: " "invalid interval \"%ld\"\n", diff --git a/tests/data/slapd-syncrepl-slave-refresh1.conf b/tests/data/slapd-syncrepl-slave-refresh1.conf index 1a0a60d0e4..d1aa086f60 100644 --- a/tests/data/slapd-syncrepl-slave-refresh1.conf +++ b/tests/data/slapd-syncrepl-slave-refresh1.conf @@ -42,4 +42,4 @@ syncrepl id=1 schemachecking=off scope=sub type=refreshOnly - interval=00:00:01 + interval=00:00:00:10 diff --git a/tests/data/slapd-syncrepl-slave-refresh2.conf b/tests/data/slapd-syncrepl-slave-refresh2.conf index c68c91fa6b..f9271cc2c9 100644 --- a/tests/data/slapd-syncrepl-slave-refresh2.conf +++ b/tests/data/slapd-syncrepl-slave-refresh2.conf @@ -42,4 +42,4 @@ syncrepl id=1 schemachecking=off scope=sub type=refreshOnly - interval=00:00:01 + interval=00:00:00:10 diff --git a/tests/scripts/test017-syncreplication-refresh b/tests/scripts/test017-syncreplication-refresh index a9a1cebc31..637f338355 100755 --- a/tests/scripts/test017-syncreplication-refresh +++ b/tests/scripts/test017-syncreplication-refresh @@ -91,8 +91,8 @@ if test $RC != 0 ; then exit $RC fi -echo "Waiting 90 seconds for syncrepl to receive changes..." -sleep 90 +echo "Waiting 15 seconds for syncrepl to receive changes..." +sleep 15 echo "Using ldapmodify to modify master directory..." @@ -180,8 +180,8 @@ if test $RC != 0 ; then exit $RC fi -echo "Waiting 90 seconds for syncrepl to receive changes..." -sleep 90 +echo "Waiting 15 seconds for syncrepl to receive changes..." +sleep 15 echo "Using ldapsearch to read all the entries from the master..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \ diff --git a/tests/scripts/test018-syncreplication-persist b/tests/scripts/test018-syncreplication-persist index 03b72f7abf..ce47051c6d 100755 --- a/tests/scripts/test018-syncreplication-persist +++ b/tests/scripts/test018-syncreplication-persist @@ -91,8 +91,8 @@ if test $RC != 0 ; then exit $RC fi -echo "Waiting 20 seconds for syncrepl to receive changes..." -sleep 20 +echo "Waiting 15 seconds for syncrepl to receive changes..." +sleep 15 echo "Using ldapmodify to modify master directory..." @@ -180,8 +180,8 @@ if test $RC != 0 ; then exit $RC fi -echo "Waiting 20 seconds for syncrepl to receive changes..." -sleep 20 +echo "Waiting 15 seconds for syncrepl to receive changes..." +sleep 15 echo "Using ldapsearch to read all the entries from the master..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \ diff --git a/tests/scripts/test019-syncreplication-cascade b/tests/scripts/test019-syncreplication-cascade index 3f470be3b7..2a92834d68 100755 --- a/tests/scripts/test019-syncreplication-cascade +++ b/tests/scripts/test019-syncreplication-cascade @@ -203,8 +203,8 @@ if test $RC != 0 ; then exit $RC fi -echo "Waiting 90 seconds for syncrepl to receive changes..." -sleep 90 +echo "Waiting 25 seconds for syncrepl to receive changes..." +sleep 25 echo "Using ldapmodify to modify master directory..." @@ -292,8 +292,8 @@ if test $RC != 0 ; then exit $RC fi -echo "Waiting 90 seconds for syncrepl to receive changes..." -sleep 90 +echo "Waiting 25 seconds for syncrepl to receive changes..." +sleep 25 echo "Using ldapsearch to read all the entries from the master..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \ -- 2.39.5