Overview
Comment: | Cherrypicked 5a53 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.7001-rebase-wip | v1.7001-multi-db-rb01 |
Files: | files | file ages | folders |
SHA1: |
23bde8f1b3b8c6d77de5549da683a565 |
User & Date: | matt on 2022-04-21 20:03:56 |
Other Links: | branch diff | manifest | tags |
Context
2022-04-21
| ||
20:06 | Cherrypicked 7f0a and 98e7 check-in: 6d400573c0 user: matt tags: v1.7001-rebase-wip, v1.7001-multi-db-rb01 | |
20:03 | Cherrypicked 5a53 check-in: 23bde8f1b3 user: matt tags: v1.7001-rebase-wip, v1.7001-multi-db-rb01 | |
19:36 | Cherrypicked bd65 and a82e check-in: 0b155d7512 user: matt tags: v1.7001-rebase-wip, v1.7001-multi-db-rb01 | |
Changes
Modified dbfile.scm from [8191885fae] to [1fd4f57fed].
︙ | ︙ | |||
270 271 272 273 274 275 276 | ;; ;; Open the classic megatest.db file (defaults to open in toppath) ;; ;; NOTE: returns a dbdat not a dbstruct! ;; (define (dbfile:open-sqlite3-db dbpath init-proc) | < < < < < < < < < < < < < < | < < < > | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | ;; ;; Open the classic megatest.db file (defaults to open in toppath) ;; ;; NOTE: returns a dbdat not a dbstruct! ;; (define (dbfile:open-sqlite3-db dbpath init-proc) (let* ((write-access (file-write-access? dbpath)) (db (dbfile:cautious-open-database dbpath init-proc))) (make-dbr:dbdat dbfile: dbpath dbh: db read-only: (not write-access)))) (define (dbfile:print-and-exit . params) (with-output-to-port (current-error-port) (lambda () (apply print params))) |
︙ | ︙ | |||
449 450 451 452 453 454 455 | tmpdb)) ;;====================================================================== ;; no-sync.db - small bits of data to be shared between servers ;;====================================================================== | | | > | > > > > | 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | tmpdb)) ;;====================================================================== ;; no-sync.db - small bits of data to be shared between servers ;;====================================================================== (define (dbfile:cautious-open-database fname init-proc #!optional (tries-left 10)) (let* ((retry (lambda () (thread-sleep! 0.5) (if (> tries-left 0) (dbfile:cautious-open-database fname init-proc (- tries-left 1)))))) (condition-case (let* ((db-exists (file-exists? fname)) (db (sqlite3:open-database fname))) (if (and init-proc (not db-exists)) (init-proc db)) (sqlite3:set-busy-handler! db (sqlite3:make-busy-timeout 136000)) db) (exn (io-error) (dbfile:print-err exn "ERROR: i/o error with " fname ". Check permissions, disk space etc. and try again.") (retry)) (exn (corrupt) (dbfile:print-err exn "ERROR: database " fname " is corrupt. Repair it to proceed.") (retry)) (exn (busy) |
︙ | ︙ | |||
478 479 480 481 482 483 484 | (retry))))) (define (dbfile:open-no-sync-db dbpath) (if (not (file-exists? dbpath)) (create-directory dbpath #t)) (let* ((dbname (conc dbpath "/no-sync.db")) (db-exists (file-exists? dbname)) | | | | | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | (retry))))) (define (dbfile:open-no-sync-db dbpath) (if (not (file-exists? dbpath)) (create-directory dbpath #t)) (let* ((dbname (conc dbpath "/no-sync.db")) (db-exists (file-exists? dbname)) (db (dbfile:cautious-open-database dbname))) (sqlite3:set-busy-handler! db (sqlite3:make-busy-timeout 136000)) (if (not db-exists) (begin (sqlite3:execute db "PRAGMA synchronous = 0;") (sqlite3:execute db "CREATE TABLE IF NOT EXISTS no_sync_metadat (var TEXT,val TEXT, CONSTRAINT no_sync_metadat_constraint UNIQUE (var));"))) ;; (sqlite3:execute db "PRAGMA journal_mode=WAL;"))) db)) (define (db:no-sync-set db var val) (sqlite3:execute db "INSERT OR REPLACE INTO no_sync_metadat (var,val) VALUES (?,?);" var val)) (define (db:no-sync-del! db var) (sqlite3:execute db "DELETE FROM no_sync_metadat WHERE var=?;" var)) |
︙ | ︙ |