[Date Prev][Date Next] [Chronological] [Thread] [Top]

Rerunning rejected replog fails (by design?)



The subject is probably a little misleading.  It doesn't fail, the
replication is just skipped because the entries are too "old".  I found
someone who complained of this back in September of this year as well.
The solution as I found it was to:
1) backup all replog info to someplace safe
2) shut down slurpd daemon
3) delete slurpd.status and slurpd.replog
4) slurpd -r {slavename}*.rej -o (I used -d -1 to see everything)
5) start up slurpd daemon
6) check data exists in all locations where it should

It annoyed me that the documentation says only step #4 is required.  It
says that -r and -o make it ignore the main replog file.  But it doesn't
say that the slurpd.status file is still honored, which it is, as is
highlighted quite well by '-d -1'.  I propose a switch, such as -s, to
tell slurpd to ignore the status file.  In slurpd's help (looking at CVS
of 2.1 Release), it says there is a [-s Service Name], but the slurpd
binary barfs on that switch, so the help output is not current.

Is the following method "the right way" of implementing such a switch?
Note that the tabs have been converted to spaces in this paste.  I'm not
submitting this as a formal patch, it has not been tested for function
nor completeness.  I'm just looking for feedback as to whether this is
the preferred way to approach it (ie by not defining the status file in
the args.c file, or would it be better to not open the replog in the
replog.c file).  In both cases, the -s should only be a valid switch if
-r and -o are passed, otherwise silently ignore.  Here's what I was
thinking:


diff -ruN ldap.orig/servers/slurpd/args.c ldap/servers/slurpd/args.c
--- ldap.orig/servers/slurpd/args.c     2003-12-17 19:25:14.000000000
-0800
+++ ldap/servers/slurpd/args.c  2004-11-04 11:02:50.701252601 -0800
@@ -49,12 +49,12 @@
 static void
 usage( char *name )
 {
-    fprintf( stderr, "usage: %s\t[-d debug-level] [-s syslog-level]\n",
     name );
+    fprintf( stderr, "usage: %s\t[-d debug-level]\n", name );
     fprintf( stderr, "\t\t[-f slapd-config-file] [-r
replication-log-file]\n" );
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
-    fprintf( stderr, "\t\t[-t tmp-dir] [-o] [-k srvtab-file]\n" );
+    fprintf( stderr, "\t\t[-t tmp-dir] [-o] [-s] [-k srvtab-file]\n" );
 #else /* LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND */
-    fprintf( stderr, "\t\t[-t tmp-dir] [-o]\n" );
+    fprintf( stderr, "\t\t[-t tmp-dir] [-o] [-s]\n" );
 #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND */
     fprintf( stderr, "\t\t[-n service-name]\n" );
 }
@@ -73,6 +73,7 @@
 {
     int                i;
     int                rflag = 0;
+    int                sflag = 0;
 
     if ( (g->myname = strrchr( argv[0], LDAP_DIRSEP[0] )) == NULL ) {
        g->myname = strdup( argv[0] );
@@ -80,7 +81,7 @@
        g->myname = strdup( g->myname + 1 );
     }
 
-    while ( (i = getopt( argc, argv, "d:f:n:or:t:V" )) != EOF ) {
+    while ( (i = getopt( argc, argv, "d:f:n:or:st:V" )) != EOF ) {
        switch ( i ) {
        case 'd':       /* set debug level and 'do not detach' flag */
            g->no_detach = 1;
@@ -134,6 +135,9 @@
                        "%s", optarg );
            rflag++;
            break;
+       case 's':
+           sflag++;
+           break;
        case 't': {     /* dir to use for our copies of replogs */
                size_t sz;
            g->slurpd_rdir = (char *)malloc (sz = (strlen(optarg) +
sizeof("/replica")));
@@ -161,9 +165,12 @@
            DEFAULT_SLURPD_REPLOGFILE );
 
     /* Set location/name of the slurpd status file */
-    snprintf( g->slurpd_status_file, sizeof g->slurpd_status_file,
+    /* Do not set if -r and -s are used (-o is implicit) */
+    if ( !(rflag && sflag) ) {
+        snprintf( g->slurpd_status_file, sizeof g->slurpd_status_file,
                "%s" LDAP_DIRSEP "%s", g->slurpd_rdir,
            DEFAULT_SLURPD_STATUS_FILE );
+    }
 
        ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &ldap_debug);
        ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &ldap_debug);

-- 
Regards...		Todd
They that can give up essential liberty to obtain a little temporary 
safety deserve neither liberty nor safety.       --Benjamin Franklin
Linux kernel 2.6.8.1-12mdkenterprise   2 users,  load average: 0.02, 0.05, 0.08