Overview
Comment: | fixed readonly detection |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.7001-multi-db-rb01 |
Files: | files | file ages | folders |
SHA1: |
51deb29dc4ee7a79cd6586e7e28e70cb |
User & Date: | mmgraham on 2022-04-06 18:21:54 |
Other Links: | branch diff | manifest | tags |
Context
2022-04-08
| ||
14:52 | implemented db:get-db with extra runid arg Closed-Leaf check-in: fe6e866e85 user: mmgraham tags: v1.7001-multi-db-get-db, v1.7001-multi-db-rb01 | |
2022-04-06
| ||
20:32 | Added simple copy-sync method (not yet working) check-in: b439dea6cd user: matt tags: v1.7001-multi-db-rb01 | |
18:21 | fixed readonly detection check-in: 51deb29dc4 user: mmgraham tags: v1.7001-multi-db-rb01 | |
07:24 | Fixed few issues in db.scm. NOTE: these might also be problems in v1.65 check-in: adfcb732f5 user: matt tags: v1.7001-multi-db-rb01 | |
Changes
Modified db.scm from [8fe4ef2c61] to [5b6dbaca58].
︙ | ︙ | |||
1505 1506 1507 1508 1509 1510 1511 | id INTEGER PRIMARY KEY, test_id INTEGER, state TEXT DEFAULT 'new', status TEXT DEFAULT 'n/a', archive_type TEXT DEFAULT 'bup', du INTEGER, archive_path TEXT);"))) | < | 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 | id INTEGER PRIMARY KEY, test_id INTEGER, state TEXT DEFAULT 'new', status TEXT DEFAULT 'n/a', archive_type TEXT DEFAULT 'bup', du INTEGER, archive_path TEXT);"))) (db:create-triggers db) db)) ;; ) ;;====================================================================== ;; A R C H I V E S ;;====================================================================== |
︙ | ︙ |
Modified dbfile.scm from [95ef66d677] to [4ab8a27c28].
︙ | ︙ | |||
460 461 462 463 464 465 466 | ;;====================================================================== ;; lazy-safe get file mod time. on any error (file not existing etc.) return 0 ;; (define (dbfile:lazy-modification-time fpath) (handle-exceptions exn (begin | | | 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 | ;;====================================================================== ;; lazy-safe get file mod time. on any error (file not existing etc.) return 0 ;; (define (dbfile:lazy-modification-time fpath) (handle-exceptions exn (begin (dbfile:print-err "Failed to get modification time for " fpath ", treating it as zero. exn=" exn) 0) (if (file-exists? fpath) (file-modification-time fpath) 0))) ;;====================================================================== ;; find timestamp of newest file associated with a sqlite db file |
︙ | ︙ |
Modified runs.scm from [37cd45feb4] to [a0376dc2f0].
︙ | ︙ | |||
524 525 526 527 528 529 530 | (config-reruns (let ((x (configf:lookup *configdat* "setup" "reruns"))) (if x (string->number x) #f))) (allowed-tests #f) (runconf #f)) ;; check if readonly (when readonly-mode | | | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | (config-reruns (let ((x (configf:lookup *configdat* "setup" "reruns"))) (if x (string->number x) #f))) (allowed-tests #f) (runconf #f)) ;; check if readonly (when readonly-mode (debug:print-error 0 *default-log-port* "Megatest database is readonly. Cannot proceed.") (exit 1)) ;; per user request. If less than 100Meg space on dbdir partition, bail out with error ;; this will reduce issues in database corruption (common:check-db-dir-and-exit-if-insufficient) ;; override the number of reruns from the configs |
︙ | ︙ | |||
2345 2346 2347 2348 2349 2350 2351 | (state-status (if (string? new-state-status) (string-split new-state-status ",") '(#f #f))) (rp-mutex (make-mutex)) (bup-mutex (make-mutex)) (keep-records (args:get-arg "-keep-records")) ;; used in conjunction with -remove-runs to keep the records, TODO: consolidate this with "mode". (test-records '())) ;; for tasks that we wish to operate on all tests in one fell swoop (let* ((write-access-actions '(remove-runs set-state-status archive run-wait kill-runs)) | | | | 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 | (state-status (if (string? new-state-status) (string-split new-state-status ",") '(#f #f))) (rp-mutex (make-mutex)) (bup-mutex (make-mutex)) (keep-records (args:get-arg "-keep-records")) ;; used in conjunction with -remove-runs to keep the records, TODO: consolidate this with "mode". (test-records '())) ;; for tasks that we wish to operate on all tests in one fell swoop (let* ((write-access-actions '(remove-runs set-state-status archive run-wait kill-runs)) (dbfile (conc *toppath* "/.db/main.db")) (readonly-mode (not (file-write-access? dbfile)))) (when (and readonly-mode (member action write-access-actions)) (debug:print-error 0 *default-log-port* dbfile " is readonly. Cannot proceed with action ["action"] in which write-access isrequired .") (exit 1))) (debug:print-info 4 *default-log-port* "runs:operate-on => Header: " header " action: " action " new-state-status: " new-state-status) (if (> 2 (length state-status)) (begin (debug:print-error 0 *default-log-port* "the parameter to -set-state-status is a comma delimited string. E.g. COMPLETED,FAIL") (exit))) |
︙ | ︙ |
Modified tests/simplerun/thebeginning.scm from [1e352e44dc] to [1a8187c724].
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ;; dbfile:add-dbdat ;; db:initialize-main-db ;; dbfile:set-subdb ;; db:with-db ;; dbfile:get-subdb ) (define tmpdir (common:get-db-tmp-area)) (test #f #t (dbr:dbstruct? (dbfile:setup #t *toppath* tmpdir))) (test #f #t (dbr:dbstruct? (db:setup #t))) (define dbstruct *dbstruct-dbs*) (test #f #t (dbr:dbdat? (dbfile:open-db *dbstruct-dbs* #f db:initialize-main-db))) (define maindbdat (dbfile:open-db *dbstruct-dbs* #f db:initialize-main-db)) (dbfile:add-dbdat dbstruct #f maindbdat) | > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ;; dbfile:add-dbdat ;; db:initialize-main-db ;; dbfile:set-subdb ;; db:with-db ;; dbfile:get-subdb ) ;; *************** dbfile.scm tests **************** (define tmpdir (common:get-db-tmp-area)) (test #f #t (dbr:dbstruct? (dbfile:setup #t *toppath* tmpdir))) (test #f #t (dbr:dbstruct? (db:setup #t))) (define dbstruct *dbstruct-dbs*) (test #f #t (dbr:dbdat? (dbfile:open-db *dbstruct-dbs* #f db:initialize-main-db))) (define maindbdat (dbfile:open-db *dbstruct-dbs* #f db:initialize-main-db)) (dbfile:add-dbdat dbstruct #f maindbdat) |
︙ | ︙ | |||
36 37 38 39 40 41 42 | (test #f #t (dbr:dbdat? (dbfile:get-dbdat dbstruct 1))) (test #f #t (db:close-all dbstruct)) (test #f #t (db:safely-close-sqlite3-db (dbr:dbdat-dbh rundbdat) (dbr:dbdat-stmt-cache rundbdat))) (test #f #t (db:safely-close-sqlite3-db (dbr:dbdat-dbh maindbdat) (dbr:dbdat-stmt-cache maindbdat))) | > > > > > > > > > > > > | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | (test #f #t (dbr:dbdat? (dbfile:get-dbdat dbstruct 1))) (test #f #t (db:close-all dbstruct)) (test #f #t (db:safely-close-sqlite3-db (dbr:dbdat-dbh rundbdat) (dbr:dbdat-stmt-cache rundbdat))) (test #f #t (db:safely-close-sqlite3-db (dbr:dbdat-dbh maindbdat) (dbr:dbdat-stmt-cache maindbdat))) (test #f #t (> (dbfile:lazy-sqlite-db-modification-time ".db/main.db") 0)) (test #f #t (common:simple-file-lock "./db.lock")) (test #f "./db.lock" (common:simple-file-release-lock "./db.lock")) ;; *************** db.scm tests **************** (define thisdbdat (db:open-db dbstruct #f)) (test #f #t (dbr:dbdat? thisdbdat)) |