Overview
Comment: | CI/CD: Automated commit after successful test, build, and deploy for v1.81-multi-server |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.81 |
Files: | files | file ages | folders |
SHA1: |
5ac37f3fd429dfb6b15225b66126a565 |
User & Date: | ramartin on 2024-07-09 10:21:23 |
Other Links: | branch diff | manifest | tags |
Context
2024-07-11
| ||
13:34 | cherry pick e8d7732e preq-fail tests in messages Leaf check-in: 2b4f2ebcce user: mmgraham tags: v1.81-preq-fail-details | |
2024-07-10
| ||
23:42 | CI/CD: Automated commit after successful test, build, and deploy for v1.81-server-load-and-cores check-in: 600ba0778d user: fdiskadm tags: v1.81 | |
18:32 | Changed message on busy server candidate host to give actual load and number of cores Leaf check-in: dc040c6bd7 user: mmgraham tags: v1.81-server-load-and-cores | |
11:03 | Create new branch named "ricky_testing_to_delete" Closed-Leaf check-in: a59962edb1 user: ramartin tags: ricky_testing_to_delete | |
2024-07-09
| ||
19:26 | wip check-in: 040bf225dc user: mrwellan tags: v1.81-journal-based-throttling | |
10:21 | CI/CD: Automated commit after successful test, build, and deploy for v1.81-multi-server check-in: 5ac37f3fd4 user: ramartin tags: v1.81 | |
08:53 | Merged from v1.81 and fixed conflicts Leaf check-in: dbc22912d1 user: mrwellan tags: v1.81-multi-server | |
2024-07-08
| ||
12:55 | CI/CD: Automated commit after successful test, build, and deploy for v1.81-fix-api-changed check-in: 0249193b68 user: ramartin tags: v1.81 | |
Changes
Modified api.scm from [bf55d9f0a8] to [0ec121fad4].
︙ | |||
242 243 244 245 246 247 248 | 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 | + + + + + + + - + + + - + - - | (else (assert ok "FATAL: database file and run-id not aligned."))))) (ttdat *server-info*) (server-state (tt-state ttdat)) (maxthreads 20) ;; make this a parameter? (status (cond ((> numthreads maxthreads) (let* ((testsuite (common:get-testsuite-name)) (mtexe (common:find-local-megatest)) (proc (lambda () ;; we are overloaded, try to start another server (debug:print 0 *default-log-port* "Too many threads running, starting another server") (tt:server-process-run *toppath* testsuite mtexe run-id)))) (set! *server-start-requests* (cons proc *server-start-requests*))) |
︙ |
Modified common.scm from [436f5e3d6d] to [dd0c23fb98].
︙ | |||
399 400 401 402 403 404 405 | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | - + + + - - - + + - - - + + - - | (define (common:version-changed?) (not (equal? (common:get-last-run-version) (common:version-signature)))) ;; From 1.70 to 1.81, db's are compatible. |
︙ |
Modified rmtmod.scm from [bb5d679cbc] to [1cfe9c07c7].
︙ | |||
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 | 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 | + + + + + + + + + | ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;;====================================================================== (declare (unit rmtmod)) (declare (uses debugprint)) ;; (declare (uses debugprint.import)) (declare (uses commonmod)) ;; (declare (uses commonmod.import)) (declare (uses dbfile)) ;; needed for records (declare (uses dbmod)) ;; (declare (uses tcp-transportmod)) ;; (declare (uses tcp-transportmod.import)) ;; (declare (uses apimod)) ;; (declare (uses apimod.import)) ;; (declare (uses ulex)) ;; (include "ulex/ulex.scm") (module rmtmod * (import scheme chicken data-structures extras matchable srfi-69) (import (prefix sqlite3 sqlite3:) posix typed-records srfi-18) (import commonmod dbfile debugprint) ;; (prefix commonmod cmod:)) (import dbmod ;; tcp-transportmod ) ;; (import apimod) ;; (import (prefix ulex ulex:)) (include "db_records.scm") (defstruct alldat (areapath #f) |
︙ | |||
303 304 305 306 307 308 309 310 | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | + + + + + + + + + + + + + + + + + - + + | run-id test-id 'foo "COMPLETED" "DEAD" "Test stopped responding while in RUNNING or REMOTEHOSTSTART; presumed dead."))))))) ;; call end of eud of run detection for posthook - from merge, is it needed? ;; (launch:end-of-run-check run-id) all-ids) ))))) ;;====================================================================== ;; Misc ;;====================================================================== ;; (define (rmtmod:wait-on-server-load run-id ttdat) ;; (let* ((dbfname (dbmod:run-id->dbfname run-id)) ;; (get-lowest-thread-load ;; (lambda () ;; (let* ((sdats (tt:get-server-info-sorted ttdat dbfname))) ;; (car (map tt:get-server-threads sdats)))))) ;; (if ttdat ;; (let loop () ;; (if (> (get-lowest-thread-load) 5) ;; load is pretty high ;; (begin ;; (debug:print 0 *default-log-port* "Servers appear overloaded, waiting...") ;; (thread-sleep! 1) ;; (loop)))) ;; (debug:print 0 *default-log-port* "Can't wait on server load, *ttdat* not set")))) |
Modified runs.scm from [c4364e3870] to [0cd899f860].
︙ | |||
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 58 59 | 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 58 59 60 61 | + + | (declare (uses tests)) (declare (uses server)) (declare (uses mt)) (declare (uses archive)) (declare (uses mtargs)) (declare (uses rmtmod)) (declare (uses dbfile)) (declare (uses tcp-transportmod)) (use (prefix sqlite3 sqlite3:) srfi-1 posix regex regex-case srfi-69 (srfi 18) posix-extras directory-utils pathname-expand typed-records format sxml-serializer sxml-modifications matchable) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") (include "test_records.scm") ;; (include "debugger.scm") (import commonmod debugprint rmtmod dbfile tcp-transportmod (prefix mtargs args:)) ;; use this struct to facilitate refactoring ;; (defstruct runs:dat reglen regfull |
︙ | |||
1189 1190 1191 1192 1193 1194 1195 | 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 | - - - + + + + + + + | (if (and (not (common:on-homehost?)) maxload) ;; only gate if maxload is specified, NOTE: maxload is normalized, i.e. load=1 means all cpus fully utilized (common:wait-for-normalized-load maxload "Waiting for load to drop before starting more tests" #f)) ;; jobtools maxhomehostload is intended to prevent overloading on the homehost which can cause database corruption issues (if maxhomehostload (common:wait-for-homehost-load maxhomehostload |
︙ |
Modified tcp-transportmod.scm from [2d80f8e52f] to [f03b836e05].
︙ | |||
203 204 205 206 207 208 209 210 211 212 | 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 | + + + + - - - + + + + + + + + + + | run-id))))) (if conn (begin (debug:print-info 2 *default-log-port* "already connected to a server for " dbfname) conn) ;; we are already connected to the server ;; no conn ;; find server with lowest number of threads running (i.e. lowest load) ;; (let* ((sdats (tt:get-server-info-sorted ttdat dbfname)) (sdat (if (null? sdats) #f ;; choose server with lowest threads count |
︙ | |||
272 273 274 275 276 277 278 | 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 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + | (tt:client-connect-to-server ttdat dbfname run-id testsuite server-start-proc))))))) ;; returns ( result . ping_time ) (define (tt:timed-ping host port server-id) (let* ((start-time (current-milliseconds)) (result (tt:ping host port server-id))) (cons result (- (current-milliseconds) start-time)))) |
︙ | |||
330 331 332 333 334 335 336 337 338 339 340 341 342 343 | 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | + + + | (debug:print 0 *default-log-port* "WARNING: server for "dbfname" is busy, cmd is "cmd", will try again in "dly" seconds. This is attempt "(- attemptnum 1)) (debug:print 0 *default-log-port* errmsg) (thread-sleep! dly) (tt:handler ttdat cmd run-id params (+ attemptnum 1) readonly-mode dbfname testsuite mtexe server-start-proc))) ((loaded) (debug:print 0 *default-log-port* "WARNING: server for "dbfname" is loaded, slowing queries.") (tt:backoff-incr (tt-conn-host conn)(tt-conn-port conn)) ;; this would be a good place to force reconnection and connect to a different server result) ;; (tt:handler ttdat cmd run-id params (+ attemptnum 1) readonly-mode dbfname testsuite mtexe)) (else result))) (else ;; did not receive properly formated result (if (not res) ;; tt:send-receive telling us that communication failed (let* ((host (tt-conn-host conn)) (port (tt-conn-port conn)) |
︙ | |||
380 381 382 383 384 385 386 | 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | - + + + - + | ;; (tt:handler ttdat cmd run-id params (+ attemptnum 1) readonly-mode dbfname testsuite mtexe) ))))) (begin (thread-sleep! 1) ;; no conn yet set up, give it a rest and try again (tt:handler ttdat cmd run-id params attemptnum readonly-mode dbfname testsuite mtexe server-start-proc))))) ;; gets server info and appends path to server file |
︙ | |||
516 517 518 519 520 521 522 523 524 525 526 527 528 529 | 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | + + | ;;====================================================================== ;; server ;;====================================================================== (define (tt:sync-dbs ttdat) #f) (define *server-start-requests* '()) ;; start the listener and start responding to requests ;; ;; NOTE: organise by dbfname, not run-id so we don't need ;; to pull in more modules ;; ;; This is the routine called in megatest.scm to start a server. NOTE: sequence is different for main.db vs. X.db |
︙ | |||
571 572 573 574 575 576 577 | 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | - - - - - - - - + + + + + + + + + + + - + + - + | (same-host (or (not prime-host) ;; i.e. this is the first host (equal? prime-host host))) (keep-srv (and good-ping same-host))) (if keep-srv (loop (cdr servrs) host (cons servdat result)) |
︙ | |||
620 621 622 623 624 625 626 627 628 629 630 631 632 633 | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 | + + | (thread-sleep! 0.25) (loop (+ count 1))) (begin (debug:print 0 *default-log-port* "ERROR: (tt-port ttdat) no port set! Exiting.") (exit))))) ;; create a servinfo file start keep-running ;; On WSL there seems to be a race condition where the .servinfo file ;; is not created fast enough (debug:print 0 *default-log-port* "Creating servinfo file for " dbfname) (tt:create-server-registration-file ttdat dbfname) (procinf-status-set! *procinf* "running") (tt-state-set! ttdat 'running) (dbfile:with-no-sync-db nosyncdbpath (lambda (nsdb) |
︙ | |||
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | + + + + + - - + + | nosyncdbpath (lambda (nsdb) (dbfile:insert-or-update-process nsdb *procinf*))) (debug:print 0 *default-log-port* "Exiting now.") (exit)))))) (define (tt:keep-running ttdat dbfname dbstruct) (thread-sleep! 1) ;; at this point the server is running and responding to calls, we just monitor ;; for db calls and exit if there are none. ;; if I am not in the first 3 servers, exit (let* ((start-time (current-seconds))) (let loop () (let* ((servers (tt:get-server-info-sorted ttdat dbfname)) (home-host (if (null? servers) #f (caar servers))) (my-index (list-index (lambda (x) (equal? (list-ref x 6) (tt-servinf-file ttdat))) servers)) (ok (cond ((not my-index) (debug:print 0 *default-log-port* "WARNING: Apparently I don't exist.") #f) ;; keep trying or give up? ((not *server-run*) (debug:print 0 *default-log-port* "WARNING: received a stop server from client by remote request.") #f) ((null? servers) (debug:print 0 *default-log-port* "WARNING: no servinfo files found, this cannot be.") #f) ;; not ok |
︙ | |||
694 695 696 697 698 699 700 | 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 | + + + + + + - + + + | (let* ((sinfo-file (tt-servinf-file ttdat))) ;; (debug:print 0 *default-log-port* "INFO: touching "sinfo-file) (set! (file-modification-time sinfo-file) (current-seconds)) ((dbr:dbstruct-sync-proc dbstruct) last-update) (dbr:dbstruct-last-update-set! dbstruct curr-secs)))) (if (< (- (current-seconds) (tt-last-access ttdat)) (tt-server-timeout-param)) ;; process any requests to start a new server due to load on this one (let* ((requests *server-start-requests*)) (set! *server-start-requests* '()) (if (> (length requests) 0) (debug:print-info 0 *default-log-port* "Processing "(length requests)" server start requests")) (for-each (lambda (proc) |
︙ | |||
726 727 728 729 730 731 732 | 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | + + + + + + + + - + + + - + | (servinf (conc servdir"/"host":"port"-"(current-process-id)":"dbfname)) (serv-id (tt:mk-signature areapath))) (assert (and host port) "FATAL: tt:create-server-registration-file called with no conn, dbfname="dbfname) (tt-servinf-file-set! ttdat servinf) (with-output-to-file servinf (lambda () (print "SERVER STARTED: "host":"port" AT "(current-seconds)" server-id: "serv-id" pid: "(current-process-id)" dbfname: "dbfname))) (let loop ((count 0)) (if (not (file-exists? servinf)) (begin (debug:print 0 *default-log-port* "WARNING: file "servinf" was created but it doesn't show up on disk! We'll try again.") (thread-sleep! 1) (if (> count 10) (debug:print 0 *default-log-port* "WARNING: file "servinf" was not created.") (loop (+ count 1)))))) |
︙ | |||
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 | 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 | + + + - + + - - - + + + - + | (define *last-server-start* (make-hash-table)) (define (tt:too-recent-server-start dbfname) (let* ((last-run-time (hash-table-ref/default *last-server-start* dbfname #f))) (and last-run-time (< (- (current-seconds) last-run-time) 5)))) (define *last-server-start-request-time* 0) ;; Given an area path, start a server process ### NOTE ### > file 2>&1 ;; if the target-host is set ;; try running on that host ;; incidental: rotate logs in logs/ dir. ;; (define (tt:server-process-run areapath testsuite mtexe run-id #!key (profile-mode "")) ;; areapath is *toppath* for a given testsuite area (assert areapath "FATAL: tt:server-process-run called without areapath defined.") (assert testsuite "FATAL: tt:server-process-run called without testsuite defined.") (assert mtexe "FATAL: tt:server-process-run called without mtexe defined.") ;; mtest -server - -m testsuite:ext-tests -db 6.db (let* ((dbfname (dbmod:run-id->dbfname run-id))) (if (or (< (- (current-seconds) *last-server-start-request-time*) 5) ;; attempted start less than 5 sec ago |
︙ |