Megatest

Check-in [a05b1e5025]
Login
Overview
Comment:Fixed an issue with log-rotate that was causing some run-away scenarios.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | server-log-handshaking
Files: files | file ages | folders
SHA1: a05b1e502560eadeeaf6a6895a96e182f35dc79d
User & Date: mrwellan on 2017-02-01 10:50:54
Other Links: branch diff | manifest | tags
Context
2017-02-02
13:53
Added +/- 180 seconds to the notion of a server getting tired and ready to retire. Closed-Leaf check-in: 9c439224c9 user: mrwellan tags: server-log-handshaking
2017-02-01
11:07
Automated merge of server-log-handshaking/a05b1e5025/integ into integ-home check-in: eb064be6a3 user: matt tags: integ-home
10:50
Fixed an issue with log-rotate that was causing some run-away scenarios. check-in: a05b1e5025 user: mrwellan tags: server-log-handshaking
09:48
Added accelerated back-off in server:kind-run check-in: 33121e3cd8 user: mrwellan tags: server-log-handshaking
Changes

Modified common.scm from [f57c29e310] to [1694e7ccde].

240
241
242
243
244
245
246



247
248
249
250
251
252

253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
;; WARNING: This proc operates assuming that it is in the directory above the
;;          logs directory you wish to log-rotate.
;;
(define (common:rotate-logs)
  (if (not (directory-exists? "logs"))(create-directory "logs"))
  (directory-fold 
   (lambda (file rem)



     (let* ((fullname (conc "logs/" file))
            (file-age (- (current-seconds)(file-modification-time fullname))))
       (if (or (and (string-match "^.*.log" file)
  	          (> (file-size (conc "logs/" file)) 200000))
               (and (string-match "^server-.*.log" file)
                    (> (- (current-seconds) (file-modification-time (conc "logs/" file))(* 8 60 60 60)))))

  	   (let ((gzfile (conc "logs/" file ".gz")))
  	     (if (file-exists? gzfile)
  	         (begin
  	  	   (debug:print-info 0 *default-log-port* "removing " gzfile)
  		   (delete-file gzfile)))
  	     (debug:print-info 0 *default-log-port* "compressing " file)
  	     (system (conc "gzip logs/" file)))
       (if (> file-age (* (string->number (or (configf:lookup *configdat* "setup" "log-expire-days") "30")) 24 3600))
           (handle-exceptions
	     exn
             #f
             (delete-file fullname)))))) 
   '()
   "logs"))

;; Force a megatest cleanup-db if version is changed and skip-version-check not specified
;;
(define (common:exit-on-version-changed)
  (if (common:version-changed?)







>
>
>
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|







240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
;; WARNING: This proc operates assuming that it is in the directory above the
;;          logs directory you wish to log-rotate.
;;
(define (common:rotate-logs)
  (if (not (directory-exists? "logs"))(create-directory "logs"))
  (directory-fold 
   (lambda (file rem)
     (handle-exceptions
      exn
      (debug:print-info 0 *default-log-port* "failed to rotate log " file ", probably handled by another process.")
      (let* ((fullname (conc "logs/" file))
             (file-age (- (current-seconds)(file-modification-time fullname))))
        (if (or (and (string-match "^.*.log" file)
                     (> (file-size fullname) 200000))
                (and (string-match "^server-.*.log" file)
                     (> (- (current-seconds) (file-modification-time fullname))
                        (* 8 60 60))))
            (let ((gzfile (conc fullname ".gz")))
              (if (file-exists? gzfile)
                  (begin
                    (debug:print-info 0 *default-log-port* "removing " gzfile)
                    (delete-file gzfile)))
              (debug:print-info 0 *default-log-port* "compressing " file)
              (system (conc "gzip " fullname)))
            (if (> file-age (* (string->number (or (configf:lookup *configdat* "setup" "log-expire-days") "30")) 24 3600))
                (handle-exceptions
                 exn
                 #f
                 (delete-file fullname)))))))
   '()
   "logs"))

;; Force a megatest cleanup-db if version is changed and skip-version-check not specified
;;
(define (common:exit-on-version-changed)
  (if (common:version-changed?)