Overview
Comment: | Made the /tmp db location consistent with previous versions, made -kill-servers remove no-sync.db, adjusted debug messages |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.80 |
Files: | files | file ages | folders |
SHA1: |
ccef2ac967bf23f26ca35052e2acf68b |
User & Date: | mmgraham on 2023-10-17 19:50:57 |
Other Links: | branch diff | manifest | tags |
Context
2023-10-19
| ||
14:58 | consolidated tmp dir name functions to common:make-tmpdir-name. Adjusted server start delays and debug messages check-in: 900e9ce98b user: mmgraham tags: v1.80 | |
2023-10-17
| ||
19:50 | Made the /tmp db location consistent with previous versions, made -kill-servers remove no-sync.db, adjusted debug messages check-in: ccef2ac967 user: mmgraham tags: v1.80 | |
2023-10-09
| ||
19:51 | Merged v1.80 in check-in: 38506ffe03 user: matt tags: v1.80 | |
Changes
Modified archive.scm from [e07377cf5e] to [e156e4a1c8].
︙ | |||
357 358 359 360 361 362 363 | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | - + | (print-prefix "Running: ") (archive-info (archive:allocate-new-archive-block blockid-cache *toppath* tsname min-space target-patt run-patt "megatest-db")) (archive-dir (if archive-info (cdr archive-info) #f)) (archive-id (if archive-info (car archive-info) -1)) (home-host (server:choose-server *toppath* 'homehost)) (archive-time (seconds->std-time-str (current-seconds))) (archive-staging-db (conc *toppath* "/.db-snapshot/archive_" archive-time)) |
︙ |
Modified common.scm from [516effd7ae] to [b817fc7f9a].
︙ | |||
245 246 247 248 249 250 251 | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | - + | ;;====================================================================== (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) |
︙ | |||
2278 2279 2280 2281 2282 2283 2284 | 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 | - + | ;; returns: ok/not dbspace required-space ;; (define (common:check-db-dir-space) (let* ((required (string->number ;; default is 1GB (or actually a billion bytes) This is the number of 1 kB blocks. (or (configf:lookup *configdat* "setup" "dbdir-space-required") "1000000"))) |
︙ |
Modified dashboard.scm from [d064a48d13] to [b1dc6c475c].
︙ | |||
400 401 402 403 404 405 406 | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | - - + + | (define (dboard:tabdat-make-data) (let ((dat (make-dboard:tabdat))) (dboard:setup-tabdat dat) (dboard:setup-num-rows dat) dat)) (define (dboard:setup-tabdat tabdat) |
︙ |
Modified db.scm from [a33d322bf7] to [6d82fac5fa].
︙ | |||
131 132 133 134 135 136 137 | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | - + | (debug:print-error 0 *default-log-port* " query " stmt " failed, params: " params ", error: " ((condition-property-accessor 'exn 'message) exn) ", exn=" exn) (print-call-chain (current-error-port)) default))) (apply sqlite3:first-result db stmt params))) (define (db:setup do-sync) (assert *toppath* "FATAL: db:setup called before launch:setup has been run.") |
︙ | |||
265 266 267 268 269 270 271 | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | - - - - - - - | (debug:print-error 0 *default-log-port* " params: " params ", error: " ((condition-property-accessor 'exn 'message) exn) ", arguments: " ((condition-property-accessor 'exn 'arguments) exn) ", location: " ((condition-property-accessor 'exn 'location) exn) )) |
︙ | |||
465 466 467 468 469 470 471 | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | - + | (max (get-mtime fname) (get-mtime wal-file) (get-mtime shm-file)))) ;; (define (db:all-db-sync dbstruct) ;; (let* ((dbdat (db:open-db dbstruct #f db:initialize-main-db)) ;; (data-synced 0) ;; count of changed records |
︙ | |||
554 555 556 557 558 559 560 | 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 | - + | ;; 'closeall - close all opened dbs ;; 'schema - attempt to apply schema changes ;; run-ids: '(1 2 3 ...) or #f (for all) ;; (define (db:multi-db-sync dbstruct . options) (let* (;; (dbdat (db:open-db dbstruct #f dbfile:db-init-proc)) (data-synced 0) ;; count of changed records |
︙ | |||
1252 1253 1254 1255 1256 1257 1258 | 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 | - + | ;;====================================================================== ;; no-sync.db - small bits of data to be shared between servers ;;====================================================================== (define (db:get-dbsync-path) (case (rmt:transport-mode) |
︙ | |||
1578 1579 1580 1581 1582 1583 1584 | 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 | - + | res)) ;; TODO: Switch this to use max(update_time) from each run db? Then if using a server there is no disk traffic (using cachedb db) ??? ;; ;; NOTE: This DOESN'T (necessarily) get the real run ids, but the number of the <number>.db!! (define (db:get-changed-run-ids since-time) |
︙ | |||
4312 4313 4314 4315 4316 4317 4318 | 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 | - + | (debug:print 0 *default-log-port* "could not get lock for " from-db " from no-sync-db") #f )))) ;; sync for filesystem local db writes ;; (define (db:run-lock-and-sync no-sync-db) |
︙ | |||
4368 4369 4370 4371 4372 4373 4374 | 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 | - + | (thread-sleep! 0.05) ;; delay for startup (let ((legacy-sync (common:run-sync?)) (sync-stale-seconds (configf:lookup-number *configdat* "server" "sync-stale-seconds" default: 300)) (debug-mode (debug:debug-mode 1)) (last-time (current-seconds)) ;; last time through the sync loop (no-sync-db (db:open-no-sync-db)) (sync-duration 0) ;; run time of the sync in milliseconds |
︙ | |||
4476 4477 4478 4479 4480 4481 4482 | 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 | - + | ;; (for-each (lambda (subdb) (let* (;;(dbstruct (db:setup)) (mtdb (dbr:subdb-mtdb subdb)) (mtpath (db:dbdat-get-path mtdb)) |
︙ |
Modified dbfile.scm from [4b315f3788] to [b5eea0764a].
︙ | |||
240 241 242 243 244 245 246 | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | + - + | #t ) #f ) ) (define (dbfile:make-tmpdir-name areapath tmpadj) (let* ((area (pathname-file areapath)) |
︙ | |||
485 486 487 488 489 490 491 | 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | - + | ;; opens and returns handle and nothing else ;; ;; NOTE: this is already protected by mutex *no-sync-db-mutex* ;; (define (dbfile:raw-open-no-sync-db dbpath) (if (not (file-exists? dbpath)) (create-directory dbpath #t)) |
︙ | |||
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | + + + + - + + + | ;; transaction protected lock aquisition ;; either: ;; fails returns (#f lock-creation-time identifier) ;; succeeds (returns (#t lock-creation-time identifier) ;; use (db:no-sync-del! db keyname) to release the lock ;; (define (db:no-sync-get-lock-with-id db keyname identifier) (debug:print 2 *default-log-port* "db:no-sync-get-lock-with-id: db: " db " keyname: " keyname " identifier: " identifier) (sqlite3:with-transaction db (lambda () (condition-case (let* ((curr-val (db:no-sync-get/default db keyname #f))) (debug:print 2 *default-log-port* "db:no-sync-get-lock-with-id: curr-val: " curr-val) (if curr-val (match (db:extract-time-identifier curr-val) ;; result->timestamp, identifier ((timestamp . ident) (cons (equal? ident identifier) timestamp)) (else (debug:print 2 *default-log-port* "db:no-sync-get-lock-with-id: malformed lock") |
︙ |
Modified megatest.scm from [d24777178a] to [db5cb1955c].
︙ | |||
966 967 968 969 970 971 972 | 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 | - + | (let* (;; (run-id (args:get-arg "-run-id")) (dbfname (args:get-arg "-db")) (tl (launch:setup)) (keys (keys:config-get-fields *configdat*))) (case (rmt:transport-mode) ((tcp) (let* ((timeout (server:expiration-timeout))) |
︙ | |||
1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 | 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 | + + | ) sfiles ) ) ) dbfiles ) ;; remove this db, because otherwise metadata contains records for old servers, and this causes a problem with db:no-sync-get-lock-with-id. (delete-file (conc *toppath* "/.mtdb/no-sync.db")) (set! *didsomething* #t) (exit) ) ) ;;====================================================================== ;; Weird special calls that need to run *after* the server has started? |
︙ | |||
2130 2131 2132 2133 2134 2135 2136 | 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 | - + - + | (begin (debug:print-info 1 *default-log-port* "Missing required argument -source <archive path>") (exit 1))) (if (common:file-exists? (conc *toppath* "/megatest.db")) (begin (debug:print-info 1 *default-log-port* "File " (conc *toppath* "/megatest.db") " already exists. Please remove it before trying to replicate db") (exit 1))) |
︙ |
Modified tcp-transportmod.scm from [a1fcad65c5] to [1391b0d841].
︙ | |||
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | 130 131 132 133 134 135 136 137 138 139 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 | + - + - + - + + + + + | ;; (max-connections 4096) ;; do all the busy work of finding and setting up conn for ;; connecting to a server ;; (define (tt:client-connect-to-server ttdat dbfname run-id testsuite) (assert (tt:valid-run-id run-id dbfname) "FATAL: invalid run-id "run-id) (debug:print-info 2 *default-log-port* "tt:client-connect-to-server " dbfname " " run-id) (let* ((conn (hash-table-ref/default (tt-conns ttdat) dbfname #f)) (server-start-proc (lambda () (tt:server-process-run (tt-areapath ttdat) testsuite ;; (dbfile:testsuite-name) (common:find-local-megatest) run-id)))) (if conn (begin |
︙ | |||
221 222 223 224 225 226 227 228 229 230 231 232 233 234 | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | + | (try-again))))) ;; client side handler ;; ;;(tt:handler #<tt> get-keys #f () 2 #f "/home/matt/data/megatest/ext-tests" #f "main.db" "ext-tests" "/home/matt/data/megatest/bin/.22.04/../megatest") ;; (define (tt:handler ttdat cmd run-id params attemptnum area-dat areapath readonly-mode dbfname testsuite mtexe) (debug:print 2 *default-log-port* "tt:handler cmd: " cmd " run-id: " run-id " attemptnum: " attemptnum) ;; NOTE: areapath is passed in and in tt struct. We'll use passed in value for now. (let* ((conn (tt:client-connect-to-server ttdat dbfname run-id testsuite))) ;; (hash-table-ref/default (tt-conns ttdat) dbfname #f))) (if conn ;; have connection, call the server (let* ((res (tt:send-receive ttdat conn cmd run-id params))) ;; res is (status errmsg result meta) ; (debug:print 0 *default-log-port* "conn:" conn " res: " res) |
︙ | |||
462 463 464 465 466 467 468 469 470 471 472 473 474 475 | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | + | ;; This is the routine called in megatest.scm to start a server ;; ;; Server viability is checked in keep-running. Blindly start and run here. ;; (define (tt:start-server areapath run-id dbfname-in handler keys) (assert areapath "FATAL: areapath not provided for tt:start-server") ;; is there already a server for this dbfile? Then exit. (debug:print 2 *default-log-port* "tt:start-server: " dbfname-in) (let* ((ttdat (make-tt areapath: areapath)) (dbfname (or dbfname-in (dbmod:run-id->dbfname run-id))) (servers (tt:find-server areapath dbfname))) ;; should use tt:get-current-server-info instead (if (> (length servers) 4) (begin (debug:print 0 *default-log-port* "INFO: found server(s) already running for db "dbfname", "(string-intersperse servers ",")" Exiting.") (exit)) |
︙ |