From 5548a2dd0cbfe7d8621efe6e368fcc789afa25a4 Mon Sep 17 00:00:00 2001 From: Jong Hyuk Choi Date: Thu, 28 Aug 2003 22:29:12 +0000 Subject: [PATCH] Sync replication config option format change (interval) --- servers/slapd/config.c | 27 ++++++++++++++++--- tests/data/slapd-syncrepl-slave-refresh1.conf | 2 +- tests/data/slapd-syncrepl-slave-refresh2.conf | 2 +- tests/scripts/test017-syncreplication-refresh | 8 +++--- .../scripts/test020-syncreplication-cascading | 8 +++--- 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 5f072309db..64a29bef4a 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -3001,10 +3001,31 @@ parse_syncrepl_line( } else if ( !strncasecmp( cargv[ i ], INTERVALSTR, sizeof( INTERVALSTR ) - 1 ) ) { val = cargv[ i ] + sizeof( INTERVALSTR ); - if ( si->type == LDAP_SYNC_REFRESH_AND_PERSIST ) + if ( si->type == LDAP_SYNC_REFRESH_AND_PERSIST ) { si->interval = 0; - else - si->interval = atoi( val ); + } else { + char *dstr; + char *hstr; + char *mstr; + 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'; + si->interval = (( atoi( dstr ) * 24 + atoi( hstr )) * 60 + + atoi( mstr )) * 60; + fprintf(stderr, "interval = %d\n", si->interval ); + } if ( 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 fdb41f096f..b1279c835e 100644 --- a/tests/data/slapd-syncrepl-slave-refresh1.conf +++ b/tests/data/slapd-syncrepl-slave-refresh1.conf @@ -42,4 +42,4 @@ syncrepl id=1 lastmod=req scope=sub type=refreshOnly - interval=10 + interval=00:00:01 diff --git a/tests/data/slapd-syncrepl-slave-refresh2.conf b/tests/data/slapd-syncrepl-slave-refresh2.conf index a6bdc14a27..64f66f07cc 100644 --- a/tests/data/slapd-syncrepl-slave-refresh2.conf +++ b/tests/data/slapd-syncrepl-slave-refresh2.conf @@ -42,4 +42,4 @@ syncrepl id=1 lastmod=req scope=sub type=refreshOnly - interval=10 + interval=00:00:01 diff --git a/tests/scripts/test017-syncreplication-refresh b/tests/scripts/test017-syncreplication-refresh index ff173ee1f1..3f1d42e27d 100755 --- a/tests/scripts/test017-syncreplication-refresh +++ b/tests/scripts/test017-syncreplication-refresh @@ -94,8 +94,8 @@ if test $RC != 0 ; then exit $RC fi -echo "Waiting 30 seconds for syncrepl to receive changes..." -sleep 30 +echo "Waiting 90 seconds for syncrepl to receive changes..." +sleep 90 echo "Using ldapmodify to modify master directory..." @@ -176,8 +176,8 @@ changetype: delete EOMODS -echo "Waiting 30 seconds for syncrepl to receive changes..." -sleep 30 +echo "Waiting 90 seconds for syncrepl to receive changes..." +sleep 90 echo "Using ldapsearch to read all the entries from the master..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \ diff --git a/tests/scripts/test020-syncreplication-cascading b/tests/scripts/test020-syncreplication-cascading index e84d595281..6ffb6852c6 100755 --- a/tests/scripts/test020-syncreplication-cascading +++ b/tests/scripts/test020-syncreplication-cascading @@ -205,8 +205,8 @@ if test $RC != 0 ; then exit $RC fi -echo "Waiting 60 seconds for syncrepl to receive changes..." -sleep 60 +echo "Waiting 90 seconds for syncrepl to receive changes..." +sleep 90 echo "Using ldapmodify to modify master directory..." @@ -287,8 +287,8 @@ changetype: delete EOMODS -echo "Waiting 60 seconds for syncrepl to receive changes..." -sleep 60 +echo "Waiting 90 seconds for syncrepl to receive changes..." +sleep 90 echo "Using ldapsearch to read all the entries from the master..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \ -- 2.39.5