Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -10,11 +10,11 @@ process.scm runs.scm tasks.scm tests.scm genexample.scm \ http-transport.scm filedb.scm \ client.scm synchash.scm daemon.scm mt.scm \ ezsteps.scm lock-queue.scm sdb.scm \ rmt.scm api.scm tdb.scm rpc-transport.scm \ - portlogger.scm archive.scm env.scm diff-report.scm + portlogger.scm archive.scm env.scm diff-report.scm pgdb.scm # Eggs to install (straightforward ones) EGGS=matchable readline apropos base64 regex-literals format regex-case test coops trace csv \ dot-locking posix-utils posix-extras directory-utils hostinfo tcp-server rpc csv-xml fmt \ json md5 awful http-client spiffy uri-common intarweb spiffy-request-vars \ Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -144,13 +144,13 @@ Misc -start-dir path : switch to this directory before running megatest -contour cname : add a level of hierarcy to the linktree and run paths -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 - -use-db-cache : use cached access to db to reduce load + -import-megatest.db : push data from megatest.db to cache db files in /tmp/$USER + -sync-to-megatest.db : pull data from cache files in /tmp/$USER to megatest.db + -sync-to-pg : sync to new postgresql central style database -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 @@ -343,11 +343,12 @@ "-convert-to-norm" "-convert-to-old" "-import-megatest.db" "-sync-to-megatest.db" - + "-sync-to-pg" + "-logging" "-v" ;; verbose 2, more than normal (normal is 1) "-q" ;; quiet 0, errors/warnings only "-diff-rep" Index: mt-pg.sql ================================================================== --- mt-pg.sql +++ mt-pg.sql @@ -22,16 +22,16 @@ DROP TABLE IF EXISTS test_rundat; DROP TABLE IF EXISTS archives; CREATE TABLE IF NOT EXISTS areas ( id INTEGER PRIMARY KEY, - areaname TEXT DEFAULT 'local', - areapath TEXT DEFAULT '.', + area_name TEXT DEFAULT 'local', + area_path TEXT DEFAULT '.', last_sync INTEGER DEFAULT 0, - CONSTRAINT areaconstraint UNIQUE (areaname)); + CONSTRAINT areaconstraint UNIQUE (area_name)); -INSERT INTO areas (id,areaname,areapath) VALUES (0,'local','.'); +INSERT INTO areas (id,area_name,area_path) VALUES (0,'local','.'); CREATE TABLE IF NOT EXISTS ttype ( id INTEGER PRIMARY KEY, target_spec TEXT DEFAULT ''); @@ -195,6 +195,8 @@ archive_type TEXT DEFAULT 'bup', du INTEGER, archive_path TEXT); -TRUNCATE archive_blocks, archive_allocations, extradat, metadat, access_log, tests, test_steps, test_data, test_rundat, archives, keys, runs, run_stats, test_meta, tasks_queue, archive_disks; +TRUNCATE archive_blocks, archive_allocations, extradat, metadat, +access_log, tests, test_steps, test_data, test_rundat, archives, runs, +run_stats, test_meta, tasks_queue, archive_disks; Index: rmt.scm ================================================================== --- rmt.scm +++ rmt.scm @@ -1,7 +1,7 @@ ;;====================================================================== -;; Copyright 2006-2013, Matthew Welland. +;; Copyright 2006-2017, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the Index: tasks.scm ================================================================== --- tasks.scm +++ tasks.scm @@ -14,10 +14,13 @@ (declare (unit tasks)) (declare (uses db)) (declare (uses rmt)) (declare (uses common)) +(declare (uses pgdb)) + +;; (import pgdb) ;; pgdb is a module (include "task_records.scm") ;;====================================================================== ;; Tasks db @@ -575,5 +578,16 @@ ;; keyvals ;; (tasks:task-get-name task) ;; (tasks:task-get-owner task)) ;; (tasks:set-state mdb (tasks:task-get-id task) "waiting"))) +;;====================================================================== +;; S Y N C T O P O S T G R E S Q L +;;====================================================================== + +;; In the spirit of "dump your junk in the tasks module" I'll put the +;; sync to postgres here for now. + +(define (tasks:sync-to-postgres) + (let* ((dbh (pgdb:open *configdat*)) + (area-info (pgdb:area-path->area-info dbh *toppath*))) + (print "area-info: " area-info)))