Megatest

Check-in [91f14f4824]
Login
Overview
Comment:Cherrypicked b34c
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.7001-rebase-wip | v1.7001-multi-db-rb01
Files: files | file ages | folders
SHA1: 91f14f48241c0814d7013244fa5b9c05105d32cc
User & Date: matt on 2022-04-21 20:13:14
Other Links: branch diff | manifest | tags
Context
2022-05-07
20:14
unknown changes Closed-Leaf check-in: 7e90cd0862 user: matt tags: v1.7001-multi-db-unknown, v1.7001-multi-db-rb01
2022-04-21
20:13
Cherrypicked b34c Closed-Leaf check-in: 91f14f4824 user: matt tags: v1.7001-rebase-wip, v1.7001-multi-db-rb01
20:06
Cherrypicked 7f0a and 98e7 check-in: 6d400573c0 user: matt tags: v1.7001-rebase-wip, v1.7001-multi-db-rb01
Changes

Modified db.scm from [1bb8f58d55] to [e4817a7a81].

2133
2134
2135
2136
2137
2138
2139


2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150











2151
2152
2153
2154
2155
2156
2157
2133
2134
2135
2136
2137
2138
2139
2140
2141











2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159







+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+







;; re-read the db over and over again for the keys since they never
;; change

;; why get the keys from the db? why not get from the *configdat*
;; using keys:config-get-fields?

(define (db:get-keys dbstruct)
  (keys:config-get-fields *configdat*)
)
  (if *db-keys* *db-keys* 
      (let ((res '()))
	(db:with-db dbstruct #f #f
		    (lambda (dbdat db)
		      (sqlite3:for-each-row 
		       (lambda (key)
			 (set! res (cons key res)))
		       db
		       "SELECT fieldname FROM keys ORDER BY id DESC;")))
	(set! *db-keys* res)
	res)))
;;  (if *db-keys* *db-keys* 
;;      (let ((res '()))
;;	(db:with-db dbstruct #f #f
;;		    (lambda (dbdat db)
;;		      (sqlite3:for-each-row 
;;		       (lambda (key)
;;			 (set! res (cons key res)))
;;		       db
;;		       "SELECT fieldname FROM keys ORDER BY id DESC;")))
;;	(set! *db-keys* res)
;;	res)))

;; extract index number given a header/data structure
(define (db:get-index-by-header header field)
  (list-index (lambda (x)(equal? x field)) header))

;; look up values in a header/data structure
(define (db:get-value-by-header row header field)

Modified dbfile.scm from [1fd4f57fed] to [6ed06fafe7].

461
462
463
464
465
466
467


468
469
470
471
472
473
474
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476







+
+







	   (retry))
      (exn (permission)(dbfile:print-err exn "ERROR: database " fname " has some permissions problem.")
	   (retry))
      (exn ()
	   (dbfile:print-err exn "ERROR: Unknown error with database " fname " message: "
			     ((condition-property-accessor 'exn 'message) exn))
	   (retry)))))
          ;; (if (file-write-access? fname) -- stuff lost in merge, what was here?
          ;; )

(define (dbfile:open-no-sync-db dbpath)
  (if (not (file-exists? dbpath))
      (create-directory dbpath #t))
  (let* ((dbname    (conc dbpath "/no-sync.db"))
	 (db-exists (file-exists? dbname))
	 (db        (dbfile:cautious-open-database dbname)))
551
552
553
554
555
556
557
558
559

560
553
554
555
556
557
558
559
560

561









-
+
-
         (file-list (if (eq? 0 (length glob-list))
			'("/no/such/file")
			glob-list)))
  (apply max
	 (map
	  dbfile:lazy-modification-time 
	  file-list))))


)
)

Modified megatest.scm from [bf3d77e132] to [bd12b0e542].

949
950
951
952
953
954
955
956
957
958



959
960
961
962
963
964
965
949
950
951
952
953
954
955



956
957
958
959
960
961
962
963
964
965







-
-
-
+
+
+







      (set! *didsomething* #t)))

(if (or (args:get-arg "-list-servers")
        (args:get-arg "-kill-servers"))
    (let ((tl (launch:setup)))
      (if tl ;; all roads from here exit
	  (let* ((servers (server:get-list *toppath*))
		 (fmtstr  "~8a~22a~20a~20a~8a\n"))
	    (format #t fmtstr "pid" "Interface:port" "age (hms)" "Last mod" "State")
	    (format #t fmtstr "===" "==============" "=========" "========" "=====")
		 (fmtstr  "~33a~22a~20a~20a~8a\n"))
	    (format #t fmtstr "ID" "host:port" "age (hms)" "Last mod" "State")
	    (format #t fmtstr "==" "=========" "=========" "========" "=====")
	    (for-each ;;  ( mod-time host port start-time pid )
	     (lambda (server)
	       (let* ((mtm (any->number (car server)))
		      (mod (if mtm (- (current-seconds) mtm) "unk"))
		      (age (- (current-seconds)(or (any->number (list-ref server 3)) (current-seconds))))
		      (url (conc (cadr server) ":" (caddr server)))
		      (pid (list-ref server 4))