@@ -1549,62 +1549,62 @@ (hash-table-set! sync-durations (conc srcfile ".db") (- (current-milliseconds) start-time))) (debug:print-info 2 *default-log-port* "skipping delta sync. " srcfile " is up to date")))) dbfiles)) data-synced)) -;; Sync all changed db's -;; -(define (db:tmp->megatest.db-sync dbstruct run-id last-update) - (let* ((subdbs (hash-table-values (dbr:dbstruct-subdbs dbstruct))) - (res '())) - (for-each - (lambda (subdb) - (let* ((mtdb (dbr:subdb-mtdbdat subdb)) - (tmpdb (db:get-subdb dbstruct run-id)) - (refndb (dbr:subdb-refndb subdb)) - (newres (db:sync-tables (db:sync-all-tables-list (db:get-keys dbstruct)) last-update tmpdb refndb mtdb))) - ;; (stack-push! (dbr:subdb-dbstack subdb) tmpdb) - ;; BUG: verify this is really needed - (dbfile:add-dbdat dbstruct run-id tmpdb) - (set! res (cons newres res)))) - subdbs) - res)) +;; ;; Sync all changed db's +;; ;; +;; (define (db:tmp->megatest.db-sync dbstruct run-id last-update) +;; (let* ((subdbs (hash-table-values (dbr:dbstruct-subdbs dbstruct))) +;; (res '())) +;; (for-each +;; (lambda (subdb) +;; (let* ((mtdb (dbr:subdb-mtdbdat subdb)) +;; (tmpdb (db:get-subdb dbstruct run-id)) +;; (refndb (dbr:subdb-refndb subdb)) +;; (newres (db:sync-tables (db:sync-all-tables-list (db:get-keys dbstruct)) last-update tmpdb refndb mtdb))) +;; ;; (stack-push! (dbr:subdb-dbstack subdb) tmpdb) +;; ;; BUG: verify this is really needed +;; (dbfile:add-dbdat dbstruct run-id tmpdb) +;; (set! res (cons newres res)))) +;; subdbs) +;; res)) ;;;; run-ids ;; if #f use *db-local-sync* : or 'local-sync-flags ;; if #t use timestamps : or 'timestamps ;; ;; NB// no-sync-db is the db handle, not a flag! ;; -(define (db:sync-to-megatest.db dbstruct #!key (no-sync-db #f)) - (let* ((start-time (current-seconds)) - (last-full-update (if no-sync-db - (db:no-sync-get/default no-sync-db "LAST_FULL_UPDATE" 0) - 0)) - (full-sync-needed (> (- start-time last-full-update) 3600)) ;; every hour do a full sync - (last-update (if full-sync-needed - 0 - (if no-sync-db - (db:no-sync-get/default no-sync-db "LAST_UPDATE" 0) - 0))) ;; (or (db:get-var dbstruct "LAST_UPDATE") 0)) - (sync-needed (> (- start-time last-update) 6)) - (res (if (or sync-needed ;; don't sync if a sync already occurred in the past 6 seconds - full-sync-needed) - (begin - (if no-sync-db - (begin - (if full-sync-needed (db:no-sync-set no-sync-db "LAST_FULL_UPDATE" start-time)) - (db:no-sync-set no-sync-db "LAST_UPDATE" start-time))) - (db:tmp->megatest.db-sync dbstruct last-update)) - 0)) - (sync-time (- (current-seconds) start-time))) - (debug:print-info 3 *default-log-port* "Sync of newdb to olddb completed in " sync-time " seconds pid="(current-process-id)) - (if (common:low-noise-print 30 "sync new to old") - (if sync-needed - (debug:print-info 0 *default-log-port* "Sync of " res " records from newdb to olddb completed in " sync-time " seconds pid="(current-process-id)) - (debug:print-info 0 *default-log-port* "No sync needed, last updated " (- start-time last-update) " seconds ago"))) - res)) +;; (define (db:sync-to-megatest.db dbstruct #!key (no-sync-db #f)) +;; (let* ((start-time (current-seconds)) +;; (last-full-update (if no-sync-db +;; (db:no-sync-get/default no-sync-db "LAST_FULL_UPDATE" 0) +;; 0)) +;; (full-sync-needed (> (- start-time last-full-update) 3600)) ;; every hour do a full sync +;; (last-update (if full-sync-needed +;; 0 +;; (if no-sync-db +;; (db:no-sync-get/default no-sync-db "LAST_UPDATE" 0) +;; 0))) ;; (or (db:get-var dbstruct "LAST_UPDATE") 0)) +;; (sync-needed (> (- start-time last-update) 6)) +;; (res (if (or sync-needed ;; don't sync if a sync already occurred in the past 6 seconds +;; full-sync-needed) +;; (begin +;; (if no-sync-db +;; (begin +;; (if full-sync-needed (db:no-sync-set no-sync-db "LAST_FULL_UPDATE" start-time)) +;; (db:no-sync-set no-sync-db "LAST_UPDATE" start-time))) +;; (db:tmp->megatest.db-sync dbstruct run-id last-update)) +;; 0)) +;; (sync-time (- (current-seconds) start-time))) +;; (debug:print-info 3 *default-log-port* "Sync of newdb to olddb completed in " sync-time " seconds pid="(current-process-id)) +;; (if (common:low-noise-print 30 "sync new to old") +;; (if sync-needed +;; (debug:print-info 0 *default-log-port* "Sync of " res " records from newdb to olddb completed in " sync-time " seconds pid="(current-process-id)) +;; (debug:print-info 0 *default-log-port* "No sync needed, last updated " (- start-time last-update) " seconds ago"))) +;; res)) (define (db:initialize-main-db db #!key (launch-setup #f)) (when (not *configinfo*) (if launch-setup