Overview
Comment: | Server now runs |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | inmem-per-run-db |
Files: | files | file ages | folders |
SHA1: |
51983eb150f35061906adbc17b7b8c80 |
User & Date: | matt on 2013-11-24 21:42:18 |
Other Links: | branch diff | manifest | tags |
Context
2013-11-24
| ||
22:41 | Progressing check-in: d5867f23a9 user: matt tags: inmem-per-run-db | |
21:42 | Server now runs check-in: 51983eb150 user: matt tags: inmem-per-run-db | |
20:16 | rundb, inmem and main structures written check-in: b81b7645b9 user: matt tags: inmem-per-run-db | |
Changes
Modified db.scm from [7ad6d7a9bd] to [7efe9252ff].
︙ | |||
34 35 36 37 38 39 40 | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | - - - - - - + - + + - - - + + + + + + + + + + - + - - - - - - - - - - + - - - - - + + + + + - | (declare (uses filedb)) (include "common_records.scm") (include "db_records.scm") (include "key_records.scm") (include "run_records.scm") |
︙ | |||
117 118 119 120 121 122 123 124 125 126 127 128 129 130 | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | + + | (if write-access (begin (sqlite3:set-busy-handler! db handler) (sqlite3:execute db "PRAGMA synchronous = 0;"))) (if (not dbexists)(db:initialize-run-id-db db run-id)) (dbr:dbstruct-set-runvec! dbstruct run-id 'rundb db) (dbr:dbstruct-set-runvec! dbstruct run-id 'inmem inmem) (dbr:dbstruct-set-runvec! dbstruct run-id 'inuse #t) (db:sync-tables db:sync-tests-only db inmem) inmem)))) ;; This routine creates the db. It is only called if the db is not already opened ;; (define (db:open-main dbstruct) ;; (conc *toppath* "/megatest.db") (car *configinfo*))) (let ((mdb (dbr:dbstruct-get-main dbstruct))) (if mdb |
︙ | |||
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | 140 141 142 143 144 145 146 147 148 149 150 151 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 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | (sqlite3:set-busy-handler! db handler) (sqlite3:execute db "PRAGMA synchronous = 0;"))) (if (not dbexists) (db:initialize-megatest-db db)) (dbr:dbstruct-set-main! dbstruct db) db)))) ;; sync all touched runs to disk (define (db:sync-touched dbstruct) (for-each (lambda (runvec) (let ((mtime (vector-ref runvec (dbr:dbstruct-field-name->num 'mtime))) (stime (vector-ref runvec (dbr:dbstruct-field-name->num 'stime))) (rundb (vector-ref runvec (dbr:dbstruct-field-name->num 'rundb))) (inmem (vector-ref runvec (dbr:dbstruct-field-name->num 'inmem)))) (if (> mtime stime) (begin (db:sync-tables db:sync-tests-only inmem rundb) (vector-set! runvec (dbr:dbstruct-field-name->run 'stime (current-milliseconds))))))) (hash-table-values (vector-ref dbstruct 1)))) ;; close all opened run-id dbs (define (db:close-all-db) (for-each (lambda (db) (finalize! db)) (hash-table-values (vector-ref *open-dbs* 1))) (finalize! (vector-ref *open-dbs* 0))) (define (open-inmem-db) (let* ((db (sqlite3:open-database ":memory:")) (handler (make-busy-timeout 3600))) (db:initialize db) (sqlite3:set-busy-handler! db handler) (set! sdb:qry (make-sdb:qry)) ;; we open the normalization helpers here (set! *fdb* (filedb:open-db (conc *toppath* "/db/paths.db"))) db)) ;; just tests, test_steps and test_data tables |
︙ | |||
335 336 337 338 339 340 341 | 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | - + | ;; (define open-run-close (define open-run-close (if (debug:debug-mode 2) open-run-close-no-exception-handling open-run-close-exception-handling)) (define (db:initialize-megatest-db db) (let* ((configdat (car *configinfo*)) ;; tut tut, global warning... |
︙ | |||
427 428 429 430 431 432 433 | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | - - - - - - - - - + + + + + + + + + | stepname TEXT, state TEXT DEFAULT 'NOT_STARTED', status TEXT DEFAULT 'n/a', event_time TIMESTAMP, comment TEXT DEFAULT '', logfile TEXT DEFAULT '', CONSTRAINT test_steps_constraint UNIQUE (test_id,stepname,state));") |
︙ |
Modified db_records.scm from [8100f13571] to [76bc6ba447].
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + - + + - - + + + + | ;;====================================================================== ;; dbstruct ;;====================================================================== ;; ;; -path-|-megatest.db ;; |-db-|-main.db ;; |-monitor.db ;; |-sdb.db ;; |-fdb.db ;; |-1.db ;; |-<N>.db (define (make-dbr:dbstruct #!key (path #f)) |
︙ |
Modified http-transport.scm from [27209e5df0] to [eef5519839].
︙ | |||
427 428 429 430 431 432 433 | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | - + | (* 3 24 60 60))))) (debug:print-info 2 "server-timeout: " server-timeout ", server pid: " spid " on " iface ":" port) (let loop ((count 0)) ;; Use this opportunity to sync the inmemdb to db (let ((start-time (current-milliseconds)) (sync-time #f) (rem-time #f)) |
︙ | |||
472 473 474 475 476 477 478 | 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 | - + | (begin (debug:print-info 0 "Server continuing, seconds since last db access: " (- (current-seconds) last-access)) (loop 0)) (begin (debug:print-info 0 "Starting to shutdown the server.") ;; need to delete only *my* server entry (future use) (set! *time-to-exit* #t) |
︙ | |||
515 516 517 518 519 520 521 | 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | - - + - - + - - - - - - - - - - - - - - - - - - - - - - | (if *toppath* (let* ((th2 (make-thread (lambda () (http-transport:run (if (args:get-arg "-server") (args:get-arg "-server") "-"))) "Server run")) (th3 (make-thread http-transport:keep-running "Keep running"))) |
︙ |
Modified server.scm from [00385235c5] to [ddc244d255].
︙ | |||
49 50 51 52 53 54 55 | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | - - - + + + | (if (not (setup-for-run)) (begin (debug:print 0 "ERROR: cannot find megatest.config, exiting") (exit)))) (debug:print-info 2 "Starting server using " transport " transport") (set! *transport-type* transport) (case transport |
︙ |