Overview
Comment: | Hacky solution for no-sync db |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.80-tcp-inmem |
Files: | files | file ages | folders |
SHA1: |
b8f25780465dffc1926711f64eedb983 |
User & Date: | matt on 2023-02-20 20:05:08 |
Other Links: | branch diff | manifest | tags |
Context
2023-02-21
| ||
11:39 | server start smooth, but initial data load to inmem broken. check-in: 677b6ef8e8 user: matt tags: v1.80-tcp-inmem | |
2023-02-20
| ||
20:05 | Hacky solution for no-sync db check-in: b8f2578046 user: matt tags: v1.80-tcp-inmem | |
14:17 | wip. better but now there are run-away issues in ext-tests: check-in: 94e5d1fb43 user: matt tags: v1.80-tcp-inmem | |
Changes
Modified Makefile from [c01f62811d] to [7b082d9b05].
︙ | |||
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 | - + + | tcp-transportmod.scm all : $(PREFIX)/bin/.$(ARCHSTR) mtest dboard mtut tcmt transport-mode.scm : transport-mode.scm.template cp transport-mode.scm.template transport-mode.scm |
︙ |
Modified api.scm from [351c29f44d] to [2d5deac3b3].
︙ | |||
153 154 155 156 157 158 159 | 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 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + + | ;; These are called by the server on recipt of /api calls ;; - keep it simple, only return the actual result of the call, i.e. no meta info here ;; ;; - returns #( flag result ) ;; (define (api:execute-requests dbstruct dat) (db:open-no-sync-db) ;; sets *no-sync-db* |
︙ |
Modified db.scm from [c29acb0315] to [8b2649f90e].
︙ | |||
1470 1471 1472 1473 1474 1475 1476 | 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 | + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + - + - + | (lambda (dbdat db) (sqlite3:execute (db:get-cache-stmth dbdat db "DELETE FROM metadat WHERE var=?;") var)))) ;;====================================================================== ;; no-sync.db - small bits of data to be shared between servers ;;====================================================================== (define (db:get-dbsync-path) (case (rmt:transport-mode) ((http)(common:get-db-tmp-area)) ((tcp) (conc *toppath*"/.megatest")) ((nfs) (conc *toppath*"/.megatest")) (else "/tmp/dunno-this-gonna-exist"))) |
︙ |
Modified dbfile.scm from [2bab3e7208] to [1ed5efa652].
︙ | |||
392 393 394 395 396 397 398 | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | - + + - - - + + + + + + | (let* ((backupfname (conc fname"-"(current-process-id)".bak")) (cmd (conc "cp "fname" "backupfname";mv "fname" "(conc fname ".delme;") "cp "backupfname" "fname))) (dbfile:print-err "WARNING: attempting recovery of file "fname" by running commands:\n" " "cmd) (system cmd))) |
︙ |
Modified rmt.scm from [2482b80340] to [73327553e5].
︙ | |||
102 103 104 105 106 107 108 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | + + - - + + + + + | ((> attemptnum 20) (thread-sleep! 1))) ;; I'm turning this off, it may make sense to move it ;; into http-transport-handler (if (and (> attemptnum 5) (= 0 (modulo attemptnum 15))) (begin (debug:print 0 *default-log-port* "ERROR: can't connect to server, trying to start a server.") (case (rmt:transport-mode) ((http) |
︙ |
Modified server.scm from [5eef4f0a57] to [8a167481c8].
︙ | |||
467 468 469 470 471 472 473 474 475 476 477 478 479 480 | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 | + | ;; find oldest alive ;; 1. sort by age ascending and ping until good ;; find alive rand from youngest ;; 1. sort by age descending ;; 2. take five ;; 3. check alive, discard if not and repeat ;; first we clean up old server files (assert (eq? (rmt:transport-mode) 'http) "FATAL: server:run called with rmt:transport-mode="(rmt:transport-mode)) (server:clean-up-old areapath) (let* ((since-last (- (current-seconds) server-last-start)) (server-start-delay 10)) (if ( < (- (current-seconds) server-last-start) 10 ) (begin (debug:print 2 *default-log-port* "server:choose-server: seconds since last server start: " (- (current-seconds) server-last-start)) (debug:print 2 *default-log-port* "server:choose-server: last server start less than " server-start-delay " seconds ago. Sleeping " server-start-delay " seconds") |
︙ | |||
566 567 568 569 570 571 572 | 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | + - + + | (debug:print 0 *default-log-port* "WARNING: failed to delete old server info file "sfile) (delete-file sfile)))))) sfiles))) ;; would like to eventually get rid of this ;; (define (common:on-homehost?) (if (eq? (rmt:transport-mode) 'http) |
︙ |
Modified tcp-transportmod.scm from [b2bb58190e] to [a92ff9f544].
︙ | |||
96 97 98 99 100 101 102 103 104 105 106 107 108 109 | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | + | (thread #f) (host-port #f) (cmd-thread #f) (ro-mode #f) (ro-mode-checked #f) (last-access (current-seconds)) (servinf-file #f) (last-serv-start 0) ) (define (tt:make-remote areapath) (make-tt areapath: areapath)) ;; do all the busy work of finding and setting up conn for ;; connecting to a server |
︙ | |||
132 133 134 135 136 137 138 | 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 | + + + - - - + + + - + + | server-id: server-id server-start: start-time pid: pid))) (hash-table-set! (tt-conns ttdat) dbfname conn) ;; verify we can talk to this server (if (tt:ping host port server-id) conn (let* ((curr-secs (current-seconds))) ;; rm the (last server) would go here (if (> (- curr-secs (tt-last-serv-start ttdat)) 30) |
︙ | |||
185 186 187 188 189 190 191 | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | - + | (debug:print 0 *default-log-port* "WARNING: server is loaded, will try again in a second.") (thread-sleep! 1) (tt:handler ttdat cmd run-id params attemptnum area-dat areapath readonly-mode dbfname testsuite mtexe)) (else result))) (else (if (not res) |
︙ |