Changeset: 9e8aed14ca80 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9e8aed14ca80
Modified Files:
        gdk/gdk_logger.c
        gdk/gdk_logger_internals.h
Branch: default
Log Message:

added warning when too many log files are created (first time (by default) at 5)
next message is at *2.


diffs (52 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2418,6 +2418,7 @@ log_new(int debug, const char *fn, const
 
        lng max_dropped = GDKgetenv_int("wal_max_dropped", 100000);
        lng max_file_age = GDKgetenv_int("wal_max_file_age", 600);
+       lng max_pending = GDKgetenv_int("wal_max_pending", 5);
        lng max_file_size = 0;
 
        if (GDKdebug & TESTINGMASK) {
@@ -2455,6 +2456,8 @@ log_new(int debug, const char *fn, const
                .file_age = 0,
                .max_file_age = max_file_age >= 0 ? max_file_age * 1000000 : 
600000000,
                .max_file_size = max_file_size >= 0 ? max_file_size : 
2147483648,
+               .max_pending = max_pending,
+               .cur_max_pending = max_pending,
 
                .id = 0,
                .saved_id = getBBPlogno(),      /* get saved log number from 
bbp */
@@ -2722,8 +2725,17 @@ log_flush(logger *lg, ulng ts)
                        TRC_ERROR(GDK, "failed to commit");
                return GDK_SUCCEED;
        }
-       if (lg->saved_id >= lid)
+       if (lg->saved_id >= lid) {
+               /* if too many pending */
+               if (lg->saved_id + lg->cur_max_pending > lg->id) {
+                       lg->cur_max_pending *= 2; /* when too warn again */
+                       TRC_WARNING(GDK, "Too many pending log files " LLFMT 
"\n", (lg->id - lg->saved_id));
+               }
+               /* log files went down, reduce cur_max_pending */
+               if (lg->cur_max_pending > lg->max_pending && (int)(lg->id - 
lg->saved_id) < (lg->cur_max_pending/2))
+                       lg->cur_max_pending /= 2;
                return GDK_SUCCEED;
+       }
        rotation_lock(lg);
        ulng lgid = lg->id;
        rotation_unlock(lg);
diff --git a/gdk/gdk_logger_internals.h b/gdk/gdk_logger_internals.h
--- a/gdk/gdk_logger_internals.h
+++ b/gdk/gdk_logger_internals.h
@@ -72,6 +72,9 @@ struct logger {
        // synchronized by store->flush
        bool flushnow;
        bool flushing;          /* log_flush only */
+       int max_pending, cur_max_pending;
+                               /* iff log files pending is larger then
+                                  this number, throw a warning */
        logged_range *pending;  /* log_flush only */
        stream *input_log;      /* log_flush only: current stream to flush */
 
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to