Browse Source

Ticket 48978 - Fine tune error logging

Description:  Only report erorr log level adjustments if it's not
              using the default levels.  Also added logging around
              the changelog RUV construction.

https://fedorahosted.org/389/ticket/48978

Reviewed by: nhosoi(Thanks!)
Mark Reynolds 9 years ago
parent
commit
3a5cc4d0b0
2 changed files with 26 additions and 10 deletions
  1. 14 6
      ldap/servers/plugins/replication/cl5_api.c
  2. 12 4
      ldap/servers/slapd/config.c

+ 14 - 6
ldap/servers/plugins/replication/cl5_api.c

@@ -4298,7 +4298,7 @@ static int _cl5WriteRUV (CL5DBFile *file, PRBool purge)
 
 /* This is a very slow process since we have to read every changelog entry.
    Hopefully, this function is not called too often */
-static int  _cl5ConstructRUV (const char *replGen, Object *obj, PRBool purge)
+static int _cl5ConstructRUV (const char *replGen, Object *obj, PRBool purge)
 {
     int rc;
     CL5Entry entry;
@@ -4320,11 +4320,15 @@ static int  _cl5ConstructRUV (const char *replGen, Object *obj, PRBool purge)
     if (rc != RUV_SUCCESS)
     {
         slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name_cl, "_cl5ConstructRUV - "
-				"Failed to initialize %s RUV for file %s; ruv error - %d\n", 
+                "Failed to initialize %s RUV for file %s; ruv error - %d\n",
                 purge? "purge" : "upper bound", file->name, rc);
         return CL5_RUV_ERROR;
     }    
 
+    slapi_log_err(SLAPI_LOG_NOTICE, repl_plugin_name_cl,
+            "_cl5ConstructRUV - Rebuilding the replication changelog RUV, "
+            "this may take several minutes...\n");
+
     entry.op = &op;
     rc = _cl5GetFirstEntry (obj, &entry, &iterator, NULL);
     while (rc == CL5_SUCCESS)
@@ -4333,7 +4337,7 @@ static int  _cl5ConstructRUV (const char *replGen, Object *obj, PRBool purge)
             rid = csn_get_replicaid (op.csn);
         } else {
             slapi_log_err(SLAPI_LOG_WARNING, repl_plugin_name_cl, "_cl5ConstructRUV - "
-                "Operation missing csn, moving on to next entry.\n");
+                    "Operation missing csn, moving on to next entry.\n");
             cl5_operation_parameters_done (&op);
             rc = _cl5GetNextEntry (&entry, iterator);
             continue;
@@ -4341,7 +4345,7 @@ static int  _cl5ConstructRUV (const char *replGen, Object *obj, PRBool purge)
         if(is_cleaned_rid(rid)){
             /* skip this entry as the rid is invalid */
             slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name_cl, "_cl5ConstructRUV - "
-                "Skipping entry because its csn contains a cleaned rid(%d)\n", rid);
+                    "Skipping entry because its csn contains a cleaned rid(%d)\n", rid);
             cl5_operation_parameters_done (&op);
             rc = _cl5GetNextEntry (&entry, iterator);
             continue;
@@ -4355,8 +4359,8 @@ static int  _cl5ConstructRUV (const char *replGen, Object *obj, PRBool purge)
         if (rc != RUV_SUCCESS)
         {
             slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name_cl, "_cl5ConstructRUV - "
-				"Failed to updated %s RUV for file %s; ruv error - %d\n", 
-                purge ? "purge" : "upper bound", file->name, rc);
+			        "Failed to update %s RUV for file %s; ruv error - %d\n",
+                    purge ? "purge" : "upper bound", file->name, rc);
             rc = CL5_RUV_ERROR;
             continue;
         }
@@ -4381,6 +4385,10 @@ static int  _cl5ConstructRUV (const char *replGen, Object *obj, PRBool purge)
             ruv_destroy (&file->maxRUV);
     }
 
+    slapi_log_err(SLAPI_LOG_NOTICE, repl_plugin_name_cl,
+            "_cl5ConstructRUV - Rebuilding replication changelog RUV complete.  Result %d (%s)\n",
+            rc, rc?"Failed to rebuild changelog RUV":"Success");
+
     return rc;
 }
 

+ 12 - 4
ldap/servers/slapd/config.c

@@ -189,7 +189,7 @@ slapd_bootstrap_config(const char *configdir)
 			char syntaxlogging[BUFSIZ];
 			char plugintracking[BUFSIZ];
 			char dn_validate_strict[BUFSIZ];
-                        char moddn_aci[BUFSIZ];
+			char moddn_aci[BUFSIZ];
 			Slapi_DN plug_dn;
 
 			workpath[0] = loglevel[0] = maxdescriptors[0] = '\0';
@@ -291,9 +291,17 @@ slapd_bootstrap_config(const char *configdir)
 					}
 					else
 					{
-						slapi_log_err(SLAPI_LOG_ERR, "slapd_bootstrap_config",
-							"%s: ignoring %s (since -d %d was given on the command line)\n",
-							CONFIG_LOGLEVEL_ATTRIBUTE, loglevel, config_get_errorlog_level());
+						if (strcmp(loglevel, "0") ||
+						    config_get_errorlog_level() != SLAPD_DEFAULT_ERRORLOG_LEVEL)
+						{
+							/*
+							 * loglevel of zero and SLAPD_DEFAULT_ERRORLOG_LEVEL are the
+							 * same.  Only report an error if they are different.
+							 */
+							slapi_log_err(SLAPI_LOG_NOTICE, "slapd_bootstrap_config",
+								"%s: ignoring %s (since -d %d was given on the command line)\n",
+								CONFIG_LOGLEVEL_ATTRIBUTE, loglevel, config_get_errorlog_level());
+						}
 					}
 				}