Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -52,10 +52,11 @@ ;; DATABASE (define *dbstruct-db* #f) (define *db-stats* (make-hash-table)) ;; hash of vectors < count duration-total > (define *db-stats-mutex* (make-mutex)) (define *db-sync-mutex* (make-mutex)) +(define *db-multi-sync-mutex* (make-mutex)) (define *db-local-sync* (make-hash-table)) ;; used to record last touch of db (define *megatest-db* #f) (define *last-db-access* (current-seconds)) ;; update when db is accessed via server (define *db-write-access* #t) (define *inmemdb* #f) Index: dashboard.scm ================================================================== --- dashboard.scm +++ dashboard.scm @@ -473,11 +473,11 @@ (itempath (db:test-get-item-path test)) (testfullname (test:test-get-fullname test)) (teststatus (db:test-get-status test)) (teststate (db:test-get-state test)) ;;(teststart (db:test-get-event_time test)) - (runtime (db:test-get-run_duration test)) + ;;(runtime (db:test-get-run_duration test)) (buttontxt (cond ((equal? teststate "COMPLETED") teststatus) ((and (equal? teststate "NOT_STARTED") (member teststatus '("ZERO_ITEMS" "BLOCKED" "PREQ_FAIL" "PREQ_DISCARDED" "TIMED_OUT" "KEEP_TRYING" "TEN_STRIKES"))) teststatus) Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -524,15 +524,17 @@ (db:replace-test-records dbstruct run-id testrecs) (sqlite3:finalize! (dbr:dbstruct-get-rundb dbstruct)))) run-ids))) ;; now ensure all newdb data are synced to megatest.db - (if (member 'old2new options) + (if (member 'new2old options) (for-each (lambda (run-id) (let ((fromdb (if toppath (make-dbr:dbstruct path: toppath local: #t) #f))) - (db:sync-tables db:sync-tests-only (db:get-db fromdb run-id) mtdb))) + (if (eq? run-id 0) + (db:sync-tables (db:sync-main-list dbstruct)(db:get-db fromdb run-id) mtdb) + (db:sync-tables db:sync-tests-only (db:get-db fromdb run-id) mtdb)))) run-ids)) (db:close-all dbstruct) (sqlite3:finalize! mdb))) Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -123,10 +123,11 @@ Misc -start-dir path : switch to this directory before running megatest -rebuild-db : bring the database schema up to date -cleanup-db : remove any orphan records, vacuum the db -import-megatest.db : migrate a database from v1.55 series to v1.60 series + -sync-to-megatest.db : migrate data back to megatest.db -update-meta : update the tests metadata for all tests -setvars VAR1=val1,VAR2=val2 : Add environment variables to a run NB// these are overwritten by values set in config files. -server -|hostname : start the server (reduces contention on megatest.db), use - to automatically figure out hostname @@ -269,10 +270,11 @@ "-mark-incompletes" "-convert-to-norm" "-convert-to-old" "-import-megatest.db" + "-sync-to-megatest.db" "-logging" "-v" ;; verbose 2, more than normal (normal is 1) "-q" ;; quiet 0, errors/warnings only ) @@ -1309,10 +1311,19 @@ 'adj-testids 'old2new 'new2old ) (set! *didsomething* #t))) + +(if (args:get-arg "-sync-to-megatest.db") + (begin + (db:multi-db-sync + #f ;; do all run-ids + 'new2old + ) + (set! *didsomething* #t))) + ;;====================================================================== ;; Exit and clean up ;;====================================================================== (if *runremote* (close-all-connections!)) Index: rmt.scm ================================================================== --- rmt.scm +++ rmt.scm @@ -150,18 +150,18 @@ (duration (- (current-milliseconds) start))) (rmt:update-db-stats cmd params duration) ;; mark this run as dirty if this was a write (if (not (member cmd api:read-only-queries)) (let ((start-time (current-seconds))) - (mutex-lock! *db-sync-mutex*) + (mutex-lock! *db-multi-sync-mutex*) (let ((last-sync (hash-table-ref/default *db-local-sync* run-id 0))) (if (> (- start-time last-sync) 5) ;; every five seconds (begin - (db:multi-db-sync run-id 'new2old) + (db:multi-db-sync (list run-id) 'new2old) (debug:print-info 0 "Sync of newdb to olddb for run-id " run-id " completed in " (- (current-seconds) start-time) " seconds") (hash-table-set! *db-local-sync* run-id start-time)))) - (mutex-unlock! *db-sync-mutex*))) + (mutex-unlock! *db-multi-sync-mutex*))) res))) (define (rmt:send-receive-no-auto-client-setup connection-info cmd run-id params) (let* ((run-id (if run-id run-id 0)) (jparams (db:obj->string params)) ;; (rmt:dat->json-str params))