419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
|
(define (db:sync-inmem->disk dbstruct apath dbfile #!key (force-sync #f))
(let* ((dbdat (db:get-dbdat dbstruct apath dbfile))
(db (dbr:dbdat-db dbdat))
(inmem (dbr:dbdat-inmem dbdat))
(start-t (current-seconds))
(last-update (dbr:dbdat-last-write dbdat))
(last-sync (dbr:dbdat-last-sync dbdat)))
(debug:print-info 4 *default-log-port* "Syncing for dbfile: " dbfile)
(mutex-lock! *db-multi-sync-mutex*)
(let* ((update_info (cons (if force-sync 0 last-update) "last_update"))
(need-sync (or force-sync (>= last-update last-sync))))
(if need-sync
(db:sync-tables (db:sync-all-tables-list) update_info inmem db)
(debug:print 0 *default-log-port* "Skipping sync as nothing touched.")))
(dbr:dbdat-last-sync-set! dbdat start-t)
|
|
|
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
|
(define (db:sync-inmem->disk dbstruct apath dbfile #!key (force-sync #f))
(let* ((dbdat (db:get-dbdat dbstruct apath dbfile))
(db (dbr:dbdat-db dbdat))
(inmem (dbr:dbdat-inmem dbdat))
(start-t (current-seconds))
(last-update (dbr:dbdat-last-write dbdat))
(last-sync (dbr:dbdat-last-sync dbdat)))
(debug:print-info 0 *default-log-port* "Syncing for dbfile: " dbfile)
(mutex-lock! *db-multi-sync-mutex*)
(let* ((update_info (cons (if force-sync 0 last-update) "last_update"))
(need-sync (or force-sync (>= last-update last-sync))))
(if need-sync
(db:sync-tables (db:sync-all-tables-list) update_info inmem db)
(debug:print 0 *default-log-port* "Skipping sync as nothing touched.")))
(dbr:dbdat-last-sync-set! dbdat start-t)
|