]> granicus.if.org Git - vnstat/commitdiff
improve database error retry error message, increase retry count from 3 to 5, clarify...
authorTeemu Toivola <git@humdi.net>
Tue, 13 Aug 2019 20:51:39 +0000 (23:51 +0300)
committerTeemu Toivola <git@humdi.net>
Tue, 13 Aug 2019 20:51:39 +0000 (23:51 +0300)
CHANGES
src/common.h
src/daemon.c

diff --git a/CHANGES b/CHANGES
index cc249d1a6d05f9f67ff5d8e1ea3f1bfa6275118f..1ef23913eec9ccbafc7589eebd7aa608cac9fb02 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
 2.4 / <not released yet>
 
  - Fixed
+   - Daemon didn't correctly wait when acquiring database lock for data write
+     which could result in unnecessary errors and even process exit if an
+     external database read operation had exactly the same timing as the
+     daemon write operation
    - Daemon didn't fork() even when requested to with --daemon when started
      by PID 1 (issue seen at least in Docker containers)
    - Move vnstatd man page from section 1 to section 8
index a2dce02d36780750a7ae0a71b01111fa7d419423..2f411c815cdc82c2fcb9b006ead56849b857e760 100644 (file)
@@ -257,8 +257,10 @@ and most can be changed later from the config file.
 #define CTX "606060"
 #define CTXD "-"
 
-/* number of retries for non-fatal database errors */
-#define DBRETRYLIMIT 3
+/* number of retries after non-fatal database errors, */
+/* will result in given number + 1 tries in total before exit, */
+/* a full disk (as reported by sqlite) will no cause retries or exit */
+#define DBRETRYLIMIT 5
 
 /* internal config structure */
 typedef struct {
index 3f79b04e58c2e3b99ae1682de89adb0981eeb74b..3e27db95d6f1023e0ab89ddc7b4696c671f782a6 100644 (file)
@@ -697,8 +697,8 @@ void handledatabaseerror(DSTATE *s)
                        printe(PT_Error);
                } else {
                        s->dbretrycount++;
-                       if (s->dbretrycount >= DBRETRYLIMIT) {
-                               snprintf(errorstring, 1024, "Database error retry limit %d reached, exiting.", DBRETRYLIMIT);
+                       if (s->dbretrycount > DBRETRYLIMIT) {
+                               snprintf(errorstring, 1024, "Database error retry limit of %d reached, exiting.", DBRETRYLIMIT);
                                printe(PT_Error);
                                errorexitdaemon(s, 1);
                        }