Megatest

Check-in [fc272da6d4]
Login
Overview
Comment:Turned back on the server exit on transport fail. Few other changes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.80
Files: files | file ages | folders
SHA1: fc272da6d4c7e6df6103449a516cdbed6dde6cd5
User & Date: matt on 2023-05-22 06:13:19
Other Links: branch diff | manifest | tags
Context
2023-05-22
08:37
Few tweaks to be a bit more resiliant on database blockages. Root cause of blockages are not known yet. check-in: b55a88229c user: matt tags: v1.80
06:13
Turned back on the server exit on transport fail. Few other changes. check-in: fc272da6d4 user: matt tags: v1.80
05:04
Removed attempt to exit server on handler failure. It did not seem to be working. check-in: 47cfd09de7 user: matt tags: v1.80
Changes

Modified common.scm from [8763974ace] to [4943a8edf6].

250
251
252
253
254
255
256
257
258
259
260
261
262
263
264

(define *common:this-exe-fullpath* (common:get-this-exe-fullpath))
(define *common:this-exe-dir*      (pathname-directory *common:this-exe-fullpath*))
(define *common:this-exe-name*     (pathname-strip-directory *common:this-exe-fullpath*))

(define (common:get-sync-lock-filepath)
  (let* ((tmp-area     (common:get-db-tmp-area))
         (lockfile     (conc tmp-area "/megatest.db.sync-lock")))
    lockfile))

(define *common:logpro-exit-code->status-sym-alist*
  '( ( 0 . pass )
     ( 1 . fail )
     ( 2 . warn )
     ( 3 . check )







|







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264

(define *common:this-exe-fullpath* (common:get-this-exe-fullpath))
(define *common:this-exe-dir*      (pathname-directory *common:this-exe-fullpath*))
(define *common:this-exe-name*     (pathname-strip-directory *common:this-exe-fullpath*))

(define (common:get-sync-lock-filepath)
  (let* ((tmp-area     (common:get-db-tmp-area))
         (lockfile     (conc tmp-area "/megatest.db.lock")))
    lockfile))

(define *common:logpro-exit-code->status-sym-alist*
  '( ( 0 . pass )
     ( 1 . fail )
     ( 2 . warn )
     ( 3 . check )

Modified dashboard-transport-mode.scm.template from [9dcd4f036e] to [a7eb4115fd].

11
12
13
14
15
16
17
18
19
20
21
22

;; uncomment this block to test without tcp or cachedb
;; (dbfile:sync-method 'none)
;; (dbfile:cache-method 'none)
;; (rmt:transport-mode 'nfs)

;; uncomment this block to test with tcp and cachedb
(dbfile:sync-method 'original)
(dbfile:cache-method 'none)
(rmt:transport-mode 'nfs)









|




11
12
13
14
15
16
17
18
19
20
21
22

;; uncomment this block to test without tcp or cachedb
;; (dbfile:sync-method 'none)
;; (dbfile:cache-method 'none)
;; (rmt:transport-mode 'nfs)

;; uncomment this block to test with tcp and cachedb
(dbfile:sync-method 'none) ;; original was causing crash on start. 
(dbfile:cache-method 'none)
(rmt:transport-mode 'nfs)


Modified dbmod.scm from [0bbb55895a] to [550b97413e].

151
152
153
154
155
156
157

158
159
160

161
162
163
164
165
166
167
168
		    (dbfile:cache-method))
       #f)))

(define (dbmod:safely-open-db dbfullname init-proc write-access)
  (dbfile:with-simple-file-lock
   (conc dbfullname".lock")
   (lambda ()

     (let* ((db      (sqlite3:open-database dbfullname))
	    (handler (sqlite3:make-busy-timeout 136000)))
       (sqlite3:set-busy-handler! db handler)

       (if write-access
	   (init-proc db))
       db))))

(define *sync-in-progress* #f)

;; Open the cachedb db and the on-disk db
;; populate the cachedb db with data







>
|
|

>
|







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
		    (dbfile:cache-method))
       #f)))

(define (dbmod:safely-open-db dbfullname init-proc write-access)
  (dbfile:with-simple-file-lock
   (conc dbfullname".lock")
   (lambda ()
     (let* ((dbexists (file-exists? dbfullname))
	    (db       (sqlite3:open-database dbfullname))
	    (handler  (sqlite3:make-busy-timeout 136000)))
       (sqlite3:set-busy-handler! db handler)
       (if (and dbexists
		write-access)
	   (init-proc db))
       db))))

(define *sync-in-progress* #f)

;; Open the cachedb db and the on-disk db
;; populate the cachedb db with data

Modified megatest.scm from [bce410093b] to [885b3caa0f].

2579
2580
2581
2582
2583
2584
2585

2586

2587
2588
2589
2590
2591
2592



2593
2594
2595
2596
2597
2598
2599

2600
2601
2602
2603
2604
2605
2606
	   (keys        (db:get-keys #f))
	   )
      
      (if (and src-db dest-db)
	  (if (file-exists? src-db)
	      (if (file-exists? lockfile)
		  (debug:print 0 *default-log-port* "Lock "lockfile" exists, skipping sync...")

		  (begin

		    (with-output-to-file lockfile
		      (lambda ()
			(print (current-process-id))))
		    (debug:print-info 0 *default-log-port* "Attempting to sync data from "src-db" to "dest-db"...")
		    (if (not (file-exists? dest-db))
			(begin



			  (debug:print 0 *default-log-port* "Using copy to create "dest-db" from "src-db)
			  (file-copy src-db dest-db))
			(let ((res (dbmod:db-to-db-sync src-db dest-db 0 (dbfile:db-init-proc) keys)))
			  (if res
			      (debug:print-info 0 *default-log-port* "Synced " res " records from "src-db" to "dest-db)
			      (debug:print-info 0 *default-log-port* "No sync due to permissions or other issue."))))
		    (delete-file* lockfile)))

	      (debug:print 0 *default-log-port* "No sync due to unreadble or non-existant source file"src-db))
	  (debug:print 0 *default-log-port* "Usage for -db2db; -to and -from must be specified"))
      (set! *didsomething* #t)))

(if (args:get-arg "-list-test-time")
     (let* ((toppath (launch:setup))) 
     (task:get-test-times)  







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







2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
	   (keys        (db:get-keys #f))
	   )
      
      (if (and src-db dest-db)
	  (if (file-exists? src-db)
	      (if (file-exists? lockfile)
		  (debug:print 0 *default-log-port* "Lock "lockfile" exists, skipping sync...")
		  (dbfile:with-simple-file-lock
		   lockfile
		   (lambda ()
		     ;;(with-output-to-file lockfile
		     ;;  (lambda ()
		     ;;	(print (current-process-id))))
		     (debug:print-info 0 *default-log-port* "Attempting to sync data from "src-db" to "dest-db"...")
		     (if #f ;; (not (file-exists? dest-db))
			 (begin
			   (dbfile:with-simple-file-lock
			    (conc dest-db ".lock") ;; is the db being opened right now?
			    (lambda ()
			      (debug:print 0 *default-log-port* "Using copy to create "dest-db" from "src-db)
			      (file-copy src-db dest-db))))
			 (let ((res (dbmod:db-to-db-sync src-db dest-db 0 (dbfile:db-init-proc) keys)))
			   (if res
			       (debug:print-info 0 *default-log-port* "Synced " res " records from "src-db" to "dest-db)
			       (debug:print-info 0 *default-log-port* "No sync due to permissions or other issue."))))
		     ;; (delete-file* lockfile)
		     )))
	      (debug:print 0 *default-log-port* "No sync due to unreadble or non-existant source file"src-db))
	  (debug:print 0 *default-log-port* "Usage for -db2db; -to and -from must be specified"))
      (set! *didsomething* #t)))

(if (args:get-arg "-list-test-time")
     (let* ((toppath (launch:setup))) 
     (task:get-test-times)  

Modified tcp-transportmod.scm from [217673e266] to [02829c3b33].

793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
						   (let ((res (handle-exceptions
								  exn
								(let* ((errdat (condition->list exn)))
								  (set! exn-result errdat)
								  (debug:print 0 *default-log-port* "ERROR: handler exception, these are bad, will exit in five seconds.")
								  (pp errdat *default-log-port*)
								  ;; these are always bad, set up an exit thread
								  #;(thread-start! (make-thread (lambda ()
												(thread-sleep! 5)
												(exit))))
								  #f)
								(handler indat) ;; this is the proc being called by the remote client
								)))
						     (set! result res)))))
				(full-result (list result exn-result (if (equal? stdout-result "") #f stdout-result))))







|







793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
						   (let ((res (handle-exceptions
								  exn
								(let* ((errdat (condition->list exn)))
								  (set! exn-result errdat)
								  (debug:print 0 *default-log-port* "ERROR: handler exception, these are bad, will exit in five seconds.")
								  (pp errdat *default-log-port*)
								  ;; these are always bad, set up an exit thread
								  (thread-start! (make-thread (lambda ()
												(thread-sleep! 5)
												(exit))))
								  #f)
								(handler indat) ;; this is the proc being called by the remote client
								)))
						     (set! result res)))))
				(full-result (list result exn-result (if (equal? stdout-result "") #f stdout-result))))