> So, unfortunately, Leslie, I cannot re-apply our patch. If you have
> working code, please compute another patch directly against the CURRENT
> tip of the main development branch in the repository. I will then apply
> this and see if I can get to green.
Here's the updated and rebased version of the patch, as promised.
Hopefully everything is resolved now.
On a most likely unrelated thing: I have noticed that I get "controller lost"
errors as soon as I execute two consecutive runs of backend tests in the same
Lisp image while changing controllers in between. If I use a fresh image,
everything is fine...
Leslie
New patches:
[DB-POSTMODERN: remove DBPM-ERROR; don't attempt to remove an already prepared statement (pointless since the txn is aborted at the time); defer all errors to txn handler (but warn and print the offending statement)
[EMAIL PROTECTED] {
hunk ./src/db-postmodern/pm-sql.lisp 3
-(define-condition dbpm-error (error)
- ((errno :reader errno :initarg :errno))
- (:report (lambda (cond s)
- (format s "DB error ~S"
- (errno cond)))))
-
hunk ./src/db-postmodern/pm-sql.lisp 169
- (handler-case
- (cl-postgres:prepare-query (active-connection) name-string sql)
- (cl-postgres:database-error (e)
- (cond
- ((string= (cl-postgres:database-error-code e)
- "42P05")
- (warn "42P05: prepared statement already exists!")
- 'ignoring-this-error)
- ;; TODO note 20070810: Ugly but I sometimes get:
- ;;Database error 42P05: prepared statement "TREE140CURSOR-SET-HELPER" already exists
- ;; Despite the attempts above trying to check if it is already prepared.
- ;; This error in itself does not cause any problems, so we can ignore it.
- ;; But this should be investigated
- ;;
- ;; Update: Maybe it has to do with connection pooling within postmodern?
- (t (error e)))))
+ (cl-postgres:prepare-query (active-connection) name-string sql)
hunk ./src/db-postmodern/pm-sql.lisp 180
- (let ((savepoint (princ-to-string (gensym))))
- ;(set-savepoint (active-connection) savepoint)
- (handler-case
- (progn
- ;(format t "Executing prepared query ~A~%" name-string)
- (exec-prepared name-string))
- (cl-postgres:database-error (e)
- ;; Sometimes the prepared statement might hold references to old oids,
- ;; which might be have been dropped after a rollback. For safety, try
- ;; to remove the prepared statement and prepare it again
- (warn "Error while executing prepared statement ~S (params: ~A).~%"
- name-string params)
- (cond
- ((string= (cl-postgres:database-error-code e)
- "42P01")
- ;; It seems that this error automatically drops the transaction! Postgresql bug?
- (warn "42P01: Prepared statement already exists; trying to remove it.")
- ;(rollback-to-savepoint (active-connection) savepoint)
- (cl-postgres:exec-query (active-connection) (concatenate 'string "DEALLOCATE " name-string))
- (cl-postgres:prepare-query (active-connection) name-string sql)
- (exec-prepared name-string))
-
- ((string= (cl-postgres:database-error-code e)
- "40P01") ; deadlock, defer to txn handler
- (error 'dbpm-error :errno "40P01"))
-
- ((string= (cl-postgres:database-error-code e)
- "25P02")
- (warn "25P02: Transaction aborted; something wasn't handled correctly!")
- 'ignoring-this-error)
-
- (t (error e))))))))))
-
+ (let ((savepoint (princ-to-string (gensym))))
+ ;(set-savepoint (active-connection) savepoint)
+ (handler-case
+ (progn
+ ;(format t "Executing prepared query ~A~%" name-string)
+ (exec-prepared name-string))
+ (cl-postgres:database-error (e)
+ (warn "Error while executing prepared statement ~S (params: ~A).~%"
+ name-string params)
+ (error e))))))))
hunk ./src/db-postmodern/pm-transaction.lisp 64
- (dbpm-error (e)
- (warn "dbpm txn manager: caught error ~A~%" (errno e))
+ (cl-postgres:database-error (e)
+ (warn "dbpm txn manager: caught error ~A~%" (cl-postgres:database-error-code e))
hunk ./src/db-postmodern/pm-transaction.lisp 67
- ((string= (errno e) "40P01")
+ ((or (string= (cl-postgres:database-error-code e) "40P01") ; deadlock
+ (string= (cl-postgres:database-error-code e) "23505") ; duplicate primary key
+ (string= (cl-postgres:database-error-code e) "42P05")) ; prepared stmt exists
hunk ./src/db-postmodern/pm-transaction.lisp 73
- (go retry)))))))))))
+ (go retry))
+
+ ((string= (cl-postgres:database-error-code e)
+ "25P02")
+ (warn "25P02: Transaction aborted; something wasn't handled correctly!")
+ 'ignoring-this-error)
+
+ (t (error e)))))))))))
+
+#|
+
+Notes on error handling:
+
+ 40P01: the correct way to handle a detected deadlock is restarting aborted
+ transactions until the locks are resolved. (Leslie)
+
+ 23505: this occurs due to a race condition we can't really prevent since
+ it's caused by PL/PGSQL code. Rollback until all races are resolved.
+ A more elegant solution will involve savepoints. (Leslie)
+
+ 42P05: another race condition, this time for statements preparation.
+ Same solution. (Leslie)
+
+|#
}
Context:
[DB-POSTMODERN: support transaction retries; handle deadlock; add savepoint utility functions; add warnings to help debugging problematic conditions.
[EMAIL PROTECTED]
[added BORDEAUX-THREADS dependency and changed PM controller to use it instead of SB-THREAD stuff.
[EMAIL PROTECTED]
[added concurrency test cases.
[EMAIL PROTECTED]
[DB-POSTMODERN: reap old connections when a new one is requested.
[EMAIL PROTECTED]
[Check for unbound slot; potential fix for a compiler error
[EMAIL PROTECTED]
[Fix test dependence for ff-index-test
[EMAIL PROTECTED]
[Improve berkeley DB version agnostic code
[EMAIL PROTECTED]
Added an error message to configure my-config.sexp and made sure we load
it directly from my-config.sexp so that we get it right at load time.
Prior patch didn't override default until after load time.
]
[Support for multiple BDB versions
[EMAIL PROTECTED]
[db-bdb updated to BerkeleyDB 4.6
[EMAIL PROTECTED]
Changed only BDB constants as upgrade 4.5 -> 4.6 they were
changed.
A kind of hack perhaps. But it works. The testing was not excessive,
but it works well for my project.
]
[add test for STRING types (as opposed to SIMPLE-STRING types)
[EMAIL PROTECTED]
[Refactor UTF{16,32}LE serializers.
[EMAIL PROTECTED]
[Enable multiple process connections to a BDB data-store via DB_REGISTER option
[EMAIL PROTECTED]
[Enable multi-store indexed classes
[EMAIL PROTECTED]
[Change semantics of transaction :retry-count from tries to retries
[EMAIL PROTECTED]
[Minor edits, fixed a comment, fixed a db-lisp out of date error
[EMAIL PROTECTED]
[Alex's patch for 8.3
[EMAIL PROTECTED]
I entered here the patch from Alex of 2088/02/16
which apparently makes this compatible with Postgres 8.3.
It is green for me on all tests on Posgres 8.1, so
I am committing it.
]
[mtype change in dcm
[EMAIL PROTECTED]
[moved cache-instance into initial-persistent-setup
[EMAIL PROTECTED]
because it was bypassed by recreate-instance otherwise
]
[accessor name in tests change
[EMAIL PROTECTED]
[db-postmodern: pm-btree initialization fixed
[EMAIL PROTECTED]
[recreate-instance stuff improved
[EMAIL PROTECTED]
[db-postmodern: removed specialized map-index
[EMAIL PROTECTED]
because pure cursor version works fine and is more robust
]
[cursor-duplicate removed from db-postmodern
Henrik Hjelte<[EMAIL PROTECTED]>*-20071124163701]
[db-postmodern fix map-index optimization bug
Henrik Hjelte <[EMAIL PROTECTED]>**20080104151644]
[db-postmodern: cursors re-implemented
[EMAIL PROTECTED]
[controller-doc-improvement
[EMAIL PROTECTED]
[tutorial
[EMAIL PROTECTED]
[non-keyword-accessors
[EMAIL PROTECTED]
allows lispworks to run tests.
]
[function-call-key-form
[EMAIL PROTECTED]
[documentation type fix
[EMAIL PROTECTED]
[Fix the use of internal symbol of sb-kernel in memutils
Leonardo Varuzza <[EMAIL PROTECTED]>**20071230000120
memutil.lisp use the functions sb-kernel::copy-*-from-system-area, which
aren't exported in the latest version of sbcl.
Fix it adding the :: when appropriate
]
[db-bdb bugfix: when bdb key comparison compared only the first half of utf16 strings
[EMAIL PROTECTED]
[Fix instance deserialization to bypass initialization protocol
[EMAIL PROTECTED]
[db-postmodern: optimized map-index for -by-value case
[EMAIL PROTECTED]
[db-postmodern: optimized form-slot-key for persistent-slot-reader
[EMAIL PROTECTED]
it uses SBCL internal function now, for other implementation it's less optimized.
]
[db-postmodern: small example update
[EMAIL PROTECTED]
[added sh script for flushing logs sample
[EMAIL PROTECTED]
[db-postmodern removed possiblity of using NIL as a key in btrees
Henrik Hjelte<[EMAIL PROTECTED]>**20071124163828]
[cursor-duplicate removed from db-postmodern
Henrik Hjelte<[EMAIL PROTECTED]>**20071124163701]
[removed a little compiler warning (typo)
Henrik Hjelte<[EMAIL PROTECTED]>**20071122151929]
[remove kind-hints parameter from add-index
Henrik Hjelte<[EMAIL PROTECTED]>**20071122151046
Probably a coming feature from Ian, but
right now it breaks the generic function add-index
and thus postmodern, so I removed it for now.
]
[Ensure set-db-synch is defined before pset is loaded
[EMAIL PROTECTED]
[Fix instance deserialization to bypass initialization protocol
[EMAIL PROTECTED]
[Fix to from-end traversal of new map-index
[EMAIL PROTECTED]
[New map-index implementation
[EMAIL PROTECTED]
[Cheaper get-instance-by-value
[EMAIL PROTECTED]
[TAG ELEPHANT-0-9-1
[EMAIL PROTECTED]
Patch bundle hash:
5b41d9b0dd7a4f2a5600f0a45ff23bb2ea9a66e6
_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel