Megatest

Check-in [12c06b6095]
Login
Overview
Comment:Gate running the megatest syncer by existance of lock file.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.80
Files: files | file ages | folders
SHA1: 12c06b60959d75a01f0e428974b292aee2cc9b80
User & Date: matt on 2023-05-11 12:12:04
Other Links: branch diff | manifest | tags
Context
2023-05-13
00:00
Fixed server lock. Noticed sync running from dashboard only - seems wrong. check-in: ac41427eb2 user: matt tags: v1.80
2023-05-11
12:12
Gate running the megatest syncer by existance of lock file. check-in: 12c06b6095 user: matt tags: v1.80
09:14
Merged fork check-in: b21843154b user: mrwellan tags: v1.80
Changes

Modified dbmod.scm from [e109e9616a] to [9e57a3ede2].

206
207
208
209
210
211
212
213

214
215
216
217
218


219
220

221
222
223
224
225
226
227
228
229
230
231
232
    (dbr:dbstruct-dbfile-set!    dbstruct dbfullname)
    (dbr:dbstruct-dbtmpname-set! dbstruct tmpdb)
    (dbr:dbstruct-dbfname-set!   dbstruct dbfname)
    (dbr:dbstruct-sync-proc-set! dbstruct
				 (lambda (last-update)
				   (if *sync-in-progress*
				       (debug:print 3 *default-log-port* "WARNING: overlapping calls to sync to disk")
				       (let* ((sync-cmd (conc "megatest -db2db -from "tmpdb" -to "dbfullname"&")))

					 ;; (mutex-lock! *db-with-db-mutex*) ;; this mutex is used when overloaded or during a query that modifies the db
					 (set! *sync-in-progress* #t)
					 ;; (if (eq? (dbfile:cache-method) 'inmem)
					 ;;     (dbmod:sync-gasket tables last-update inmem db
					 ;; 			dbfullname syncdir keys)


					 (thread-start! (make-thread
							 (lambda ()

							   (debug:print-info "Running "sync-cmd)
							   (system sync-cmd)
							   ;; (mutex-unlock! *db-with-db-mutex*)
							   ;; (thread-sleep! 0.5) ;; ensure at least 1/2 second down time between sync calls
							   (set! *sync-in-progress* #f))))
					 ))))
    ;; (dbmod:sync-tables tables #f db inmem)
    ;; (if db
    (dbmod:sync-gasket tables #f inmem db dbfullname 'fromdest keys) ;; ) ;; load into inmem
    (dbr:dbstruct-last-update-set! dbstruct (current-seconds)) ;; should this be offset back in time by one second?
    dbstruct))








|
>

<



>
>
|
|
>
|
|
|
|
|







206
207
208
209
210
211
212
213
214
215

216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
    (dbr:dbstruct-dbfile-set!    dbstruct dbfullname)
    (dbr:dbstruct-dbtmpname-set! dbstruct tmpdb)
    (dbr:dbstruct-dbfname-set!   dbstruct dbfname)
    (dbr:dbstruct-sync-proc-set! dbstruct
				 (lambda (last-update)
				   (if *sync-in-progress*
				       (debug:print 3 *default-log-port* "WARNING: overlapping calls to sync to disk")
				       (let* ((sync-cmd (conc "megatest -db2db -from "tmpdb" -to "dbfullname"&"))
					      (synclock-file (conc dbfullname".sync-lock")))
					 ;; (mutex-lock! *db-with-db-mutex*) ;; this mutex is used when overloaded or during a query that modifies the db

					 ;; (if (eq? (dbfile:cache-method) 'inmem)
					 ;;     (dbmod:sync-gasket tables last-update inmem db
					 ;; 			dbfullname syncdir keys)
					 (if (file-exists? synclock-file)
					     (debug:print 0 *default-log-port* "Skipping sync, lockfile "synclock-file" found.")
					     (thread-start! (make-thread
							     (lambda ()
							       (set! *sync-in-progress* #t)
							       (debug:print-info "Running "sync-cmd)
							       (system sync-cmd)
							       ;; (mutex-unlock! *db-with-db-mutex*)
							       ;; (thread-sleep! 0.5) ;; ensure at least 1/2 second down time between sync calls
							       (set! *sync-in-progress* #f)))))
					 ))))
    ;; (dbmod:sync-tables tables #f db inmem)
    ;; (if db
    (dbmod:sync-gasket tables #f inmem db dbfullname 'fromdest keys) ;; ) ;; load into inmem
    (dbr:dbstruct-last-update-set! dbstruct (current-seconds)) ;; should this be offset back in time by one second?
    dbstruct))