Megatest

Check-in [9db808f9fe]
Login
Overview
Comment:Added dot-locking around access to the portlogger db. Sqlite3 locking seems to have trouble on fast local disk sometimes (worked when system was loaded, failed when system was lightly loaded).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.60
Files: files | file ages | folders
SHA1: 9db808f9fef882e0777cb17261f1cb8b74289380
User & Date: mrwellan on 2014-09-03 11:44:03
Other Links: branch diff | manifest | tags
Context
2014-09-03
13:41
Release the lock in cases where there is an sqlite3 error. check-in: 4174f38be9 user: mrwellan tags: v1.60
11:44
Added dot-locking around access to the portlogger db. Sqlite3 locking seems to have trouble on fast local disk sometimes (worked when system was loaded, failed when system was lightly loaded). check-in: 9db808f9fe user: mrwellan tags: v1.60
08:32
Tweaked settings in fdktest tests. Added verbose output on server start fail. check-in: 012982e117 user: mrwellan tags: v1.60
Changes

Modified portlogger.scm from [5bba6c3236] to [1c366728ef].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

;; Copyright 2006-2014, Matthew Welland.
;; 
;;  This program is made available under the GNU GPL version 2.0 or
;;  greater. See the accompanying file COPYING for details.
;; 
;;  This program is distributed WITHOUT ANY WARRANTY; without even the
;;  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;;  PURPOSE.

(require-extension (srfi 18) extras tcp s11n)

(use sqlite3 srfi-1 posix srfi-69 hostinfo)
(import (prefix sqlite3 sqlite3:))

(declare (unit portlogger))

;; lsof -i














|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

;; Copyright 2006-2014, Matthew Welland.
;; 
;;  This program is made available under the GNU GPL version 2.0 or
;;  greater. See the accompanying file COPYING for details.
;; 
;;  This program is distributed WITHOUT ANY WARRANTY; without even the
;;  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;;  PURPOSE.

(require-extension (srfi 18) extras tcp s11n)

(use sqlite3 srfi-1 posix srfi-69 hostinfo dot-locking)
(import (prefix sqlite3 sqlite3:))

(declare (unit portlogger))

;; lsof -i


39
40
41
42
43
44
45
46


47
48

49
50
51
52
53
54
55
  (handle-exceptions
   exn
   (begin
     (debug:print 0 "ERROR: portlogger:open-run-close failed. " proc " " params)
     (debug:print 0 " message: " ((condition-property-accessor 'exn 'message) exn))
     (debug:print 0 "exn=" (condition->list exn))
     (print-call-chain))
   (let* ((db  (portlogger:open-db (conc "/tmp/." (current-user-name) "-portlogger.db")))


	  (res (apply proc db params)))
     (sqlite3:finalize! db)

     res)))

;; (fold-row PROC INIT DATABASE SQL . PARAMETERS) 
(define (portlogger:take-port db portnum)
  (let* ((qry1 (sqlite3:prepare db "INSERT INTO ports (port,state) VALUES (?,?);"))
	 (qry2 (sqlite3:prepare db "UPDATE ports SET state=?,update_time=strftime('%s','now') WHERE port=?;"))
	 (qry3 (sqlite3:prepare db "SELECT state FROM ports WHERE port=?;"))







|
>
>
|

>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
  (handle-exceptions
   exn
   (begin
     (debug:print 0 "ERROR: portlogger:open-run-close failed. " proc " " params)
     (debug:print 0 " message: " ((condition-property-accessor 'exn 'message) exn))
     (debug:print 0 "exn=" (condition->list exn))
     (print-call-chain))
   (let* ((fname  (conc "/tmp/." (current-user-name) "-portlogger.db"))
	  (lock   (obtain-dot-lock fname 1 5 10))
	  (db     (portlogger:open-db fname))
	  (res    (apply proc db params)))
     (sqlite3:finalize! db)
     (release-dot-lock fname)
     res)))

;; (fold-row PROC INIT DATABASE SQL . PARAMETERS) 
(define (portlogger:take-port db portnum)
  (let* ((qry1 (sqlite3:prepare db "INSERT INTO ports (port,state) VALUES (?,?);"))
	 (qry2 (sqlite3:prepare db "UPDATE ports SET state=?,update_time=strftime('%s','now') WHERE port=?;"))
	 (qry3 (sqlite3:prepare db "SELECT state FROM ports WHERE port=?;"))

tests/installall/config/megatest.config.dat became a symlink with target [736a5da885].

tests/installall/config/runconfigs.config.dat became a symlink with target [3b8f260acb].