Megatest

Check-in [7b9e186d63]
Login
Overview
Comment:Added double locking for opening db's
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.70-refactor-procedures
Files: files | file ages | folders
SHA1: 7b9e186d638d54abbd23f12f6eb5a9420a58897c
User & Date: matt on 2022-06-06 18:02:48
Other Links: branch diff | manifest | tags
Context
2022-06-06
20:25
Fixed (kind-of) not working no-sync db based lock check-in: 79a7f8d883 user: matt tags: v1.70-refactor-procedures
18:02
Added double locking for opening db's check-in: 7b9e186d63 user: matt tags: v1.70-refactor-procedures
12:29
quiet down the is-trigger-dropped messages check-in: 8a05ecdb52 user: matt tags: v1.70-refactor-procedures
Changes

Modified dbfile.scm from [d2586251fc] to [81910a6906].

493
494
495
496
497
498
499





500
501
502


503
504
505
506
507
508
509
	  (if (eq? tries-left 2)
	      (begin
		(dbfile:print-err "INFO: forcing journal rollup "busy-file)
		(dbfile:brute-force-salvage-db fname)))
	  (dbfile:cautious-open-database fname init-proc (- tries-left 1)))
	(let* ((db-exists (file-exists? fname))
	       (result (condition-case





			   (let* ((db (sqlite3:open-database fname)))
			     (if (and init-proc (not db-exists))
				 (init-proc db))


			     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))







>
>
>
>
>
|


>
>







493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
	  (if (eq? tries-left 2)
	      (begin
		(dbfile:print-err "INFO: forcing journal rollup "busy-file)
		(dbfile:brute-force-salvage-db fname)))
	  (dbfile:cautious-open-database fname init-proc (- tries-left 1)))
	(let* ((db-exists (file-exists? fname))
	       (result (condition-case
			   (let* ((nosyncdb *no-sync-db*)
				  (lockname (conc fname ".lock"))
				  (db (begin
					(dbfile:simple-file-lock-and-wait lockname expire-time: 5)
					(if nosyncdb (db:no-sync-get-lock nosyncdb fname))
					(sqlite3:open-database fname))))
			     (if (and init-proc (not db-exists))
				 (init-proc db))
			     (if nosyncdb (db:no-sync-del! nosyncdb fname))
			     (dbfile:simple-file-release-lock lockname)
			     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))