Index: openacs-4/packages/xotcl-core/tcl/cr-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/cr-procs.tcl,v diff -u -r1.76.2.39 -r1.76.2.40 --- openacs-4/packages/xotcl-core/tcl/cr-procs.tcl 5 Feb 2021 14:19:52 -0000 1.76.2.39 +++ openacs-4/packages/xotcl-core/tcl/cr-procs.tcl 6 Feb 2021 20:43:14 -0000 1.76.2.40 @@ -1001,6 +1001,10 @@ } ::xo::dc transaction { + # + # Provide a row-lock to protect against deadlocks during + # concurrent updates on the same item in different threads. + # ::xo::dc row_lock -for "no key update" -prepare integer item_lock { select item_id from cr_items where item_id = :item_id } @@ -1751,7 +1755,7 @@ # cache queries (and cache locks), since these lookups are # performed often many times per request. # - if {[acs::per_request_cache get -key xotcl-core.lookup($parent_id-$name) value]} { + if {[acs::per_request_cache get -key xotcl-core.lookup-$parent_id-$name value]} { return $value } @@ -1763,7 +1767,7 @@ # Not found, perform per-thread caching. This has to be # invalidated like the xotcl_object_type_cache. # - acs::per_request_cache eval -key xotcl-core.lookup($parent_id-$name) {set key 0} + acs::per_request_cache eval -key xotcl-core.lookup-$parent_id-$name {set key 0} #ns_log notice ".... lookup $parent_id-$name => 0 -> break and don't cache" break } @@ -1857,7 +1861,7 @@ ::xo::xotcl_object_cache flush $revision_id } } - acs::per_request_cache flush -pattern xotcl-core.lookup(${:parent_id}-${:name}) + acs::per_request_cache flush -pattern xotcl-core.lookup-${:parent_id}-${:name} } CrCache::Item instproc update_attribute_from_slot args { set r [next] @@ -1875,7 +1879,11 @@ } CrCache::Item instproc save_new args { set item_id [next] - acs::per_request_cache flush -pattern xotcl-core.lookup(${:parent_id}-${:name}) + ns_log notice "===== save_new acs::per_request_cache flush -pattern xotcl-core.lookup-${:parent_id}-${:name}" + acs::per_request_cache flush -pattern xotcl-core.lookup-${:parent_id}-${:name} + + + return $item_id } CrCache::Item instproc delete args { @@ -1889,12 +1897,12 @@ ::xo::xotcl_object_cache flush [string trimleft [self] :] } xo::xotcl_object_type_cache flush -partition_key ${:parent_id} ${:parent_id}-${:name} - acs::per_request_cache flush -pattern xotcl-core.lookup(${:parent_id}-${:name}) + acs::per_request_cache flush -pattern xotcl-core.lookup-${:parent_id}-${:name} next } CrCache::Item instproc rename {-old_name:required -new_name:required} { ::xo::xotcl_object_type_cache flush -partition_key ${:parent_id} ${:parent_id}-$old_name - acs::per_request_cache flush -pattern xotcl-core.lookup(${:parent_id}-$old_name) + acs::per_request_cache flush -pattern xotcl-core.lookup-${:parent_id}-$old_name next }