Overview
Comment: | wip |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.63-tdb-dotserver-refactor |
Files: | files | file ages | folders |
SHA1: |
e617679e45c50b3b93b265e9d675dcae |
User & Date: | bjbarcla on 2017-01-03 14:08:16 |
Other Links: | branch diff | manifest | tags |
Context
2017-01-03
| ||
16:07 | wip Closed-Leaf check-in: 5cb3a069f8 user: bjbarcla tags: v1.63-tdb-dotserver-refactor | |
14:08 | wip check-in: e617679e45 user: bjbarcla tags: v1.63-tdb-dotserver-refactor | |
2016-12-29
| ||
15:16 | fixed bug with kind-run call Closed-Leaf check-in: 2148615256 user: bjbarcla tags: v1.63-server-fix | |
Changes
Modified common.scm from [4b29489636] to [d04656dbed].
︙ | |||
134 135 136 137 138 139 140 | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | - + | (define *run-info-cache* (make-hash-table)) ;; run info is stable, no need to reget (define *launch-setup-mutex* (make-mutex)) ;; need to be able to call launch:setup often so mutex it and re-call the real deal only if *toppath* not set (define *homehost-mutex* (make-mutex)) (defstruct remote (hh-dat (common:get-homehost)) ;; homehost record ( addr . hhflag ) |
︙ |
Modified http-transport.scm from [85b3cef6fd] to [7e12c76127].
︙ | |||
397 398 399 400 401 402 403 | 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | - + | (tasks:server-set-state! (db:delay-if-busy tdbdat) server-id "dbprep") ;;(BB> "http-transport: ->dbprep") (thread-sleep! 0.5) ;; give some margin for queries to complete before switching from file based access to server based access (set! *dbstruct-db* (db:setup)) ;; run-id)) (set! server-going #t) (tasks:server-set-state! (db:delay-if-busy tdbdat) server-id "running") ;;(BB> "http-transport: ->running") |
︙ | |||
454 455 456 457 458 459 460 461 462 463 464 465 466 467 | 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | + + + + + + | (current-seconds))) (begin (if (common:low-noise-print 120 "server continuing") (debug:print-info 0 *default-log-port* "Server continuing, seconds since last db access: " (- (current-seconds) last-access))) ;; ;; Consider implementing some smarts here to re-insert the record or kill self is ;; the db indicates so ;; ;; BB - added this because servers are hanging about, alive and well ;; but in defunctdefault state in tdb and a .server file ;; preventing replacement servers from starting. (tasks:server-set-state! (db:delay-if-busy tdbdat) server-id "running") ;; ;; (if (tasks:server-am-i-the-server? tdb run-id) ;; (tasks:server-set-state! tdb server-id "running")) ;; (loop 0 server-state bad-sync-count (current-milliseconds))) (http-transport:server-shutdown server-id port)))))) |
︙ |
Modified rmt.scm from [c70f311cf0] to [193d5930f9].
︙ | |||
116 117 118 119 120 121 122 | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | - + | ;; (rmt:open-qry-close-locally cmd 0 params)) ;; no server contact made and this is a write, passively start a server ((and (not (remote-server-url *runremote*)) (not (member cmd api:read-only-queries))) (debug:print-info 12 *default-log-port* "rmt:send-receive, case 5") |
︙ |
Modified server.scm from [24b58ed32b] to [5f46daa549].
︙ | |||
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | 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 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - + + - + - + - + - + | (file-modification-time flagfile)) 15)) ;; exists and less than 15 seconds old (with-input-from-file flagfile (lambda () (read-line)))) ((file-exists? flagfile) ;; it is stale. (server:complete-attempt areapath) #f) (else #f))))) (define (server:read-dotserver areapath) (let ((dotfile (conc areapath "/.server"))) (handle-exceptions exn #f ;; if things go wrong pretend we can't see the file (if (and (file-exists? dotfile) (file-read-access? dotfile)) (with-input-from-file dotfile (lambda () (read-line))) #f)))) (define (server:read-dotserver->server-url areapath) (let* ((temp (server:read-dotserver areapath)) (tokens (if temp (string-split temp ":") '()))) (if (eq? 3 (length tokens)) (string-join (list-ref tokens 0) ":" (list-ref tokens 1)) #f))) (define (server:read-dotserver->pid areapath) (let* ((temp (server:read-dotserver areapath)) (tokens (if temp (string-split temp ":") '()))) (if (eq? 3 (length tokens)) (list-ref tokens 2) #f))) (define (server:running-or-starting? areapath) ;; Note: may be unreiable on non-homehost due to NFS lag (or (server:read-dotserver areapath) (server:start-attempted? areapath))) ;; write a .server file in *toppath* with hostport ;; return #t on success, #f otherwise ;; |
︙ |
Modified tasks.scm from [a0c6ff1ee2] to [7914349b64].
︙ | |||
354 355 356 357 358 359 360 | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | - - - - - - - - + - - - - - - - - | ;; strftime('%s','now')-heartbeat < 10 AND mt_version = ? "SELECT id,interface,port,pubport,transport,pid,hostname FROM servers WHERE run_id=? AND state='running' ORDER BY start_time DESC LIMIT 1;" run-id) ;; (common:version-signature) run-id) res))) (define (tasks:server-running-or-starting? mdb run-id) |
︙ |