Overview
Comment: | coordinate multiple servers such that only one server will be syncing exclusively at any given momemt\ |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.65 |
Files: | files | file ages | folders |
SHA1: |
31c8ca7f7868fc612e50a40a8b336abf |
User & Date: | bjbarcla on 2019-02-07 17:16:48 |
Other Links: | branch diff | manifest | tags |
Context
2019-02-11
| ||
11:35 | merged brute force syncer check-in: 2aaccbd409 user: bjbarcla tags: v1.65, v1.6524 | |
2019-02-07
| ||
22:53 | Try Brandon's idea of using sqlite3 dump to sync to legacy megatest.db check-in: 542079c778 user: matt tags: v1.65-dump-for-sync | |
17:16 | coordinate multiple servers such that only one server will be syncing exclusively at any given momemt\ check-in: 31c8ca7f78 user: bjbarcla tags: v1.65 | |
17:13 | add todo check-in: 081ae45cc8 user: bjbarcla tags: v1.65 | |
Changes
Modified common.scm from [f3a824a935] to [c75d843fa5].
︙ | |||
2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 | 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 | + + + + | #t) #f)) ;; simple lock. improve and converge on this one. ;; (define (common:simple-lock keyname) (rmt:no-sync-get-lock keyname)) (define (common:simple-unlock keyname #!key (force #f)) (rmt:no-sync-del! keyname)) ;;====================================================================== ;; ;;====================================================================== (define (common:in-running-test?) (and (args:get-arg "-execute") (get-environment-variable "MT_CMDINFO"))) |
︙ |
Modified server.scm from [8c943654ab] to [e8ffc74269].
︙ | |||
479 480 481 482 483 484 485 486 487 488 489 490 491 492 | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | + + + + + + + + + + + + + + + + | (set! res adr))) ;; NOTE: This can fail when there is no mention of the host in /etc/hosts. FIXME (vector->list (hostinfo-addresses (hostname->hostinfo hostname)))) (string-intersperse (map number->string (u8vector->list (if res res (hostname->ip hostname)))) "."))) (define server:sync-lock-token "SERVER_SYNC_LOCK") (define (server:release-sync-lock) (db:no-sync-del! *no-sync-db* server:sync-lock-token)) (define (server:have-sync-lock?) (let* ((have-lock-pair (db:no-sync-get-lock *no-sync-db* server:sync-lock-token)) (have-lock? (car have-lock-pair)) (lock-time (cdr have-lock-pair)) (lock-age (- (current-seconds) lock-time))) (cond (have-lock? #t) ((>lock-age (* 3 (configf:lookup-number *configdat* "server" "minimum-intersync-delay" default: 180))) (server:release-sync-lock) (server:have-sync-lock?)) (else #f)))) ;; moving this here as it needs access to db and cannot be in common. ;; (define (server:writable-watchdog dbstruct) (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)) |
︙ | |||
508 509 510 511 512 513 514 | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | - + + - + + - + + + + + + + + | (end-file (conc tmp-area "/.end-sync"))) (debug:print-info 0 *default-log-port* "Server running, periodic sync started.") (let loop () ;; sync for filesystem local db writes ;; (mutex-lock! *db-multi-sync-mutex*) (let* ((need-sync (>= *db-last-access* *db-last-sync*)) ;; no sync since last write |
︙ | |||
589 590 591 592 593 594 595 | 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | - + | (begin (mutex-lock! *db-multi-sync-mutex*) (set! *db-sync-in-progress* #f) (set! *db-last-sync* start-time) (with-output-to-file end-file (lambda ()(print (current-process-id)))) ;; release lock here |
︙ |