Overview
Comment: | wip |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.7001-multi-db-02 |
Files: | files | file ages | folders |
SHA1: |
cd75b861addd00bdbc79896beeb335cd |
User & Date: | matt on 2022-03-13 20:27:42 |
Other Links: | branch diff | manifest | tags |
Context
2022-03-14
| ||
14:31 | missing edits check-in: 745600bad3 user: mrwellan tags: v1.7001-multi-db-02 | |
2022-03-13
| ||
20:27 | wip check-in: cd75b861ad user: matt tags: v1.7001-multi-db-02 | |
2022-03-12
| ||
20:28 | wip check-in: f6bba6dbbb user: matt tags: v1.7001-multi-db-02 | |
Changes
Modified api.scm from [c2c4883b3a] to [f83932a9cc].
︙ | ︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | (use srfi-69 posix) (declare (unit api)) (declare (uses rmt)) (declare (uses db)) (declare (uses dbmod)) (declare (uses tasks)) (import dbmod) ;; allow these queries through without starting a server ;; (define api:read-only-queries '(get-key-val-pairs get-var get-keys | > > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | (use srfi-69 posix) (declare (unit api)) (declare (uses rmt)) (declare (uses db)) (declare (uses dbmod)) (declare (uses dbfile)) (declare (uses tasks)) (import dbmod) (import dbfile) ;; allow these queries through without starting a server ;; (define api:read-only-queries '(get-key-val-pairs get-var get-keys |
︙ | ︙ |
Modified common.scm from [2307821bb2] to [b57269bcea].
︙ | ︙ | |||
1006 1007 1008 1009 1010 1011 1012 | (and (common:on-homehost?) (args:get-arg "-server"))) (define (common:human-time) (time->string (seconds->local-time (current-seconds)) "%Y-%m-%d %H:%M:%S")) | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 | (and (common:on-homehost?) (args:get-arg "-server"))) (define (common:human-time) (time->string (seconds->local-time (current-seconds)) "%Y-%m-%d %H:%M:%S")) (define (std-signal-handler signum) ;; (signal-mask! signum) (set! *time-to-exit* #t) ;;(debug:print-info 13 *default-log-port* "got signal "signum) (debug:print-error 0 *default-log-port* "Received signal " signum " aaa exiting promptly") ;; (std-exit-procedure) ;; shouldn't need this since we are exiting and it will be called anyway (exit)) |
︙ | ︙ |
Modified db.scm from [0f451ec65c] to [a8d0bf149e].
︙ | ︙ | |||
5188 5189 5190 5191 5192 5193 5194 5195 | (if (not *time-to-exit*) (loop)))) ;; ==> ;; time to exit, close the no-sync db here ;; ==> (db:no-sync-close-db no-sync-db stmt-cache) (if (common:low-noise-print 30) (debug:print-info 0 *default-log-port* "Exiting watchdog timer, *time-to-exit* = " *time-to-exit*" pid="(current-process-id) )))) ;; ))) ;;" this-wd-num="this-wd-num))))))) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 | (if (not *time-to-exit*) (loop)))) ;; ==> ;; time to exit, close the no-sync db here ;; ==> (db:no-sync-close-db no-sync-db stmt-cache) (if (common:low-noise-print 30) (debug:print-info 0 *default-log-port* "Exiting watchdog timer, *time-to-exit* = " *time-to-exit*" pid="(current-process-id) )))) ;; ))) ;;" this-wd-num="this-wd-num))))))) (define (std-exit-procedure) ;;(common:telemetry-log-close) (on-exit (lambda () 0)) ;;(debug:print-info 13 *default-log-port* "std-exit-procedure called; *time-to-exit*="*time-to-exit*) (let ((no-hurry (if *time-to-exit* ;; hurry up #f (begin (set! *time-to-exit* #t) #t)))) (debug:print-info 4 *default-log-port* "starting exit process, finalizing databases.") (if (and no-hurry (debug:debug-mode 18)) (rmt:print-db-stats)) (let ((th1 (make-thread (lambda () ;; thread for cleaning up, give it five seconds (if *dbstruct-dbs* (db:close-all *dbstruct-dbs*)) ;; one second allocated (if *task-db* (let ((db (cdr *task-db*))) (if (sqlite3:database? db) (begin (sqlite3:interrupt! db) (sqlite3:finalize! db #t) ;; (vector-set! *task-db* 0 #f) (set! *task-db* #f))))) (http-client#close-all-connections!) ;; (if (and *runremote* ;; (remote-conndat *runremote*)) ;; (begin ;; (http-client#close-all-connections!))) ;; for http-client (if (not (eq? *default-log-port* (current-error-port))) (close-output-port *default-log-port*)) (set! *default-log-port* (current-error-port))) "Cleanup db exit thread")) (th2 (make-thread (lambda () (debug:print 4 *default-log-port* "Attempting clean exit. Please be patient and wait a few seconds...") (if no-hurry (begin (thread-sleep! 5)) ;; give the clean up few seconds to do it's stuff (begin (thread-sleep! 2))) (debug:print 4 *default-log-port* " ... done") ) "clean exit"))) (thread-start! th1) (thread-start! th2) (thread-join! th1) ) ) 0) |
Modified dbfile.scm from [6f9211e5b8] to [ac7098dfd2].
︙ | ︙ | |||
152 153 154 155 156 157 158 | (conc apath"/"dbname)) (define (db:run-id->dbname run-id) (cond ((number? run-id) (conc ".db/" (modulo run-id 100) ".db")) ((not run-id) (conc ".db/main.db")) (else run-id))) | | > > > > > > > > > > > > > > > > > > > > > > > | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | (conc apath"/"dbname)) (define (db:run-id->dbname run-id) (cond ((number? run-id) (conc ".db/" (modulo run-id 100) ".db")) ((not run-id) (conc ".db/main.db")) (else run-id))) ;; Get/open a database ;; if run-id => get run specific db ;; if #f => get main db ;; if run-id is a string treat it as a filename ;; if db already open - return inmem ;; if db not open, open inmem, rundb and sync then return inmem ;; inuse gets set automatically for rundb's ;; (define (dbfile:get-dbh dbstruct run-id) ;; RENAME TO db:get-dbh (let* ((subdb (dbfile:get-subdb dbstruct run-id))) (if (stack? (dbr:subdb-dbstack subdb)) (if (stack-empty? (dbr:subdb-dbstack subdb)) #f (stack-pop! (dbr:subdb-dbstack subdb))) #f))) (define (dbfile:add-dbh dbstruct run-id db) (let* ((subdb (dbfile:get-subdb dbstruct run-id))) (if (not (stack? (dbr:subdb-dbstack subdb))) (dbr:subdb-dbstack-set! subdb (make-stack))) ) |