Megatest

Check-in [aadd589324]
Login
Overview
Comment:Switch default cache db to inmem from tmp
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.80
Files: files | file ages | folders
SHA1: aadd58932416314033fd8c329d94c7f1a42c024c
User & Date: matt on 2023-04-11 18:25:18
Other Links: branch diff | manifest | tags
Context
2023-04-11
21:32
Throttle writes more than reads using mutex, avoid doing sync when writes are happening using mutex. This is a monte carlo approach. Might need tweaking. check-in: b5df408582 user: matt tags: v1.80
18:25
Switch default cache db to inmem from tmp check-in: aadd589324 user: matt tags: v1.80
15:12
Added control over inmem vs. tmp db caching. [setup] dbcache-mode inmem check-in: 9c90eedf66 user: mrwellan tags: v1.80
Changes

Modified dbfile.scm from [1443b07658] to [e57985b7a3].

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
;;
(define dbfile:testsuite-name (make-parameter #f))

(define keep-age-param        (make-parameter 10))      ;; qif file age, if over move to attic
(define num-run-dbs           (make-parameter 10))      ;; number of db's in .mtdb
(define dbfile:sync-method    (make-parameter 'attach)) ;; 'attach or 'original
(define dbfile:cache-method   (make-parameter 'inmem))  ;; 'direct
(define dbcache-mode (make-parameter 'tmp)) ;; 'inmem, 'tmp (changes what open inmem routine does)


;; 'original     - use old condition code
;; 'suicide-mode - create mtrah/stop-the-train with info on what went wrong
;; else use no condition code (should be production mode)
;;
(define no-condition-db-with-db (make-parameter 'suicide-mode))







|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
;;
(define dbfile:testsuite-name (make-parameter #f))

(define keep-age-param        (make-parameter 10))      ;; qif file age, if over move to attic
(define num-run-dbs           (make-parameter 10))      ;; number of db's in .mtdb
(define dbfile:sync-method    (make-parameter 'attach)) ;; 'attach or 'original
(define dbfile:cache-method   (make-parameter 'inmem))  ;; 'direct
(define dbcache-mode (make-parameter 'inmem)) ;; 'inmem, 'tmp (changes what open inmem routine does)


;; 'original     - use old condition code
;; 'suicide-mode - create mtrah/stop-the-train with info on what went wrong
;; else use no condition code (should be production mode)
;;
(define no-condition-db-with-db (make-parameter 'suicide-mode))

Modified dbmod.scm from [69508c5a25] to [96c421107b].

93
94
95
96
97
98
99


100


101
102
103
104
105
106
107
    ;; if nfs mode do a sync if delta > 2
    (let* ((last-update (dbr:dbstruct-last-update dbstruct))
	   (sync-proc   (dbr:dbstruct-sync-proc dbstruct))
	   (curr-secs   (current-seconds)))
      (if (> (- curr-secs last-update) 3)
	  (begin
	    (sync-proc last-update)


	    (dbr:dbstruct-last-update-set! dbstruct curr-secs))))


    (if use-mutex (mutex-lock! *db-with-db-mutex*))
    (let* ((res (apply proc dbdat dbh params)))
      (if use-mutex (mutex-unlock! *db-with-db-mutex*))
      res)))

(define (db:with-db dbstruct run-id r/w proc . params)
  (dbmod:with-db dbstruct run-id r/w proc params))







>
>
|
>
>







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
    ;; if nfs mode do a sync if delta > 2
    (let* ((last-update (dbr:dbstruct-last-update dbstruct))
	   (sync-proc   (dbr:dbstruct-sync-proc dbstruct))
	   (curr-secs   (current-seconds)))
      (if (> (- curr-secs last-update) 3)
	  (begin
	    (sync-proc last-update)

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

	    )))
    (if use-mutex (mutex-lock! *db-with-db-mutex*))
    (let* ((res (apply proc dbdat dbh params)))
      (if use-mutex (mutex-unlock! *db-with-db-mutex*))
      res)))

(define (db:with-db dbstruct run-id r/w proc . params)
  (dbmod:with-db dbstruct run-id r/w proc params))