Megatest

Check-in [1b4e76c0e0]
Login
Overview
Comment:Added some expiration handling for run servers
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | v2.0001-matt-test-edits
Files: files | file ages | folders
SHA1: 1b4e76c0e0d8dec3329c6432b966195b064e4f7b
User & Date: mrwellan on 2022-02-09 11:18:17
Other Links: branch diff | manifest | tags
Context
2022-02-09
11:18
Added some expiration handling for run servers Closed-Leaf check-in: 1b4e76c0e0 user: mrwellan tags: v2.0001-matt-test-edits
09:56
Added back use of mutex for transactions check-in: 297a374249 user: mrwellan tags: v2.0001-matt-test-edits
Changes

Modified ulex-simple/dbmgr.scm from [3233b20f1f] to [59496cc87c].

330
331
332
333
334
335
336






337
338
339

340






341
342
343
344
345
346
347
348
349
350
351
352
    (rmt:send-receive-real sinfo apath dbname cmd params)))

;; db is at apath/.db/dbname, rid is an intermediary solution and will be removed
;; sometime in the future
;;
(define (rmt:send-receive-real sinfo apath dbname cmd params)
  (let* ((cdat (rmt:get-conn sinfo apath dbname)))






    (assert cdat "FATAL: rmt:send-receive-real called without the needed channels opened")
    (let* ((uconn    (servdat-uconn sinfo)) ;; get the interface to ulex
           ;; then send-receive using the ulex layer to host-port stored in cdat

           (res      (send-receive uconn (conndat-hostport cdat) cmd params)))






      ;; since we accessed the server we can bump the expires time up
      (conndat-expires-set! cdat (+ (current-seconds)
                                    (server:expiration-timeout)
                                    -2)) ;; two second margin for network time misalignments etc.
      res)))

;
;; db is at apath/.db/dbname, rid is an intermediary solution and will be removed
;; sometime in the future.
;;
;; Purpose - call the main.db server and request a server be started
;; for the given area path and dbname







>
>
>
>
>
>
|
|
|
>
|
>
>
>
>
>
>
|
|
|
|
|







330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
    (rmt:send-receive-real sinfo apath dbname cmd params)))

;; db is at apath/.db/dbname, rid is an intermediary solution and will be removed
;; sometime in the future
;;
(define (rmt:send-receive-real sinfo apath dbname cmd params)
  (let* ((cdat (rmt:get-conn sinfo apath dbname)))
    (if (> (current-seconds)(conndat-expires cdat))
	(begin
	  (debug:print-info 0 *default-log-port* "Connection to "apath"/"dbname" expired, reconnecting.")
	  (rmt:drop-conn sinfo apath dbname)
	  (rmt:send-receive-real sinfo apath dbname cmd params))
	(begin
	  (assert cdat "FATAL: rmt:send-receive-real called without the needed channels opened")
	  (let* ((uconn    (servdat-uconn sinfo)) ;; get the interface to ulex
		 ;; then send-receive using the ulex layer to host-port stored in cdat
		 (res      (condition-case
			    (send-receive uconn (conndat-hostport cdat) cmd params)
			    ((exn i/o net timeout)
			     ;; here we need to close and reconnect
			     (rmt:drop-conn sinfo apath dbname)
			     (rmt:general-open-connection sinfo apath dbname)
			     (rmt:send-receive-real sinfo apath dbname cmd params)
			     ))))
	    ;; since we accessed the server we can bump the expires time up
	    (conndat-expires-set! cdat (+ (current-seconds)
					  (server:expiration-timeout)
					  -2)) ;; two second margin for network time misalignments etc.
	    res)))))

;
;; db is at apath/.db/dbname, rid is an intermediary solution and will be removed
;; sometime in the future.
;;
;; Purpose - call the main.db server and request a server be started
;; for the given area path and dbname