Megatest

Check-in [a1c90b4301]
Login
Overview
Comment:removed another mutex but this seems to be worse than the last commit
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.80-revolution
Files: files | file ages | folders
SHA1: a1c90b4301150678d767253ba6b60bdd54ac7fed
User & Date: matt on 2023-11-21 20:50:21
Other Links: branch diff | manifest | tags
Context
2023-11-22
04:21
More cleanup of cleanup, removed all use of cleanup-proc check-in: f69329ec9a user: matt tags: v1.80-revolution
2023-11-21
20:50
removed another mutex but this seems to be worse than the last commit check-in: a1c90b4301 user: matt tags: v1.80-revolution
20:13
Removing some of the mutex enabling around db:with-db seems to improve performance check-in: 7e63ac6bde user: matt tags: v1.80-revolution
Changes

Modified db.scm from [70a7ff684e] to [a04781df0a].

2633
2634
2635
2636
2637
2638
2639
2640
2641


2642
2643
2644
2645
2646
2647
2648

2649
2650
2651
2652
2653
2654
2655
2633
2634
2635
2636
2637
2638
2639


2640
2641
2642
2643
2644
2645
2646
2647

2648
2649
2650
2651
2652
2653
2654
2655







-
-
+
+






-
+







  (db:with-db
   dbstruct
   run-id
   #f
   (lambda (dbdat db)
     (let ((res   (cons #f #f))
	   (stmth (db:get-cache-stmth dbdat db "SELECT state,status FROM tests WHERE id=? AND run_id=?;")))
       (db:with-mutex-for-stmth
	(lambda()
       ;; (db:with-mutex-for-stmth
	;; (lambda()
	  (sqlite3:for-each-row ;; attemptnum added to hold pid of top process (not Megatest) controlling a test
	   (lambda (state status)
	     (cons state status))
	   ;; db
	   stmth ;;"SELECT state,status FROM tests WHERE id=? AND run_id=?;" ;; stmth try not compiling this one - yes, this fixed the bind issue
	   test-id run-id)))
       res))))
       res)) ;; ))

;; Use db:test-get* to access
;; Get test data using test_ids. NB// Only works within a single run!!
;;
(define (db:get-test-info-by-ids dbstruct run-id test-ids)
  (db:with-db
   dbstruct

Modified dbfile.scm from [f0738065cd] to [a50374cb4f].

1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592







1593
1594
1579
1580
1581
1582
1583
1584
1585







1586
1587
1588
1589
1590
1591
1592
1593
1594







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


			  (let* ((newstmth (sqlite3:prepare db stmt)))
			    ;; (db:hoh-set! stmt-cache db stmt newstmth)
			    (hash-table-set! stmt-cache stmt newstmth)
			    newstmth))))
    (mutex-unlock! *get-cache-stmth-mutex*)
    result))

(define *mutex-stmth-call* (make-mutex))

(define (db:with-mutex-for-stmth proc)
  (mutex-lock! *mutex-stmth-call*)
  (let* ((res (proc)))
    (mutex-unlock! *mutex-stmth-call*)
    res))
;; (define *mutex-stmth-call* (make-mutex))
;; 
;; (define (db:with-mutex-for-stmth proc)
;;   (mutex-lock! *mutex-stmth-call*)
;;   (let* ((res (proc)))
;;     (mutex-unlock! *mutex-stmth-call*)
;;     res))

)

Modified dbmod.scm from [0a134beec4] to [918f6405bd].

93
94
95
96
97
98
99
100
101


102
103
104
105
106
107
108
93
94
95
96
97
98
99


100
101
102
103
104
105
106
107
108







-
-
+
+







  (let* ((use-mutex w/r) ;; (or (and w/r ;; use the mutex on queries that modify the db and for sync to disk
			     ;; (> *api-process-request-count* 5)) ;; when writes are happening throttle more
			;; (> *api-process-request-count* 50)))
	 (dbdat     (dbmod:open-db dbstruct run-id (dbfile:db-init-proc)))
	 (dbh       (dbr:dbdat-dbh dbdat)) ;; this will be the cachedb handle
	 (dbfile    (dbr:dbdat-dbfile dbdat)))
    ;; if nfs mode do a sync if delta > 2
    (let* ((last-update (dbr:dbstruct-last-update dbstruct))
	   (sync-proc   (dbr:dbstruct-sync-proc dbstruct))
    #;(let* ((last-update (dbr:dbstruct-last-update dbstruct))
	   ;; (sync-proc   (dbr:dbstruct-sync-proc dbstruct))
	   (curr-secs   (current-seconds)))
      (if (> (- curr-secs last-update) 5)
	  (begin
	    (sync-proc last-update)

	    ;; MOVE THIS CALL TO INSIDE THE sync-proc CALL
	    (dbr:dbstruct-last-update-set! dbstruct curr-secs)