Commit 3805e300 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 16788ee3
...@@ -237,7 +237,7 @@ func (obj *Persistent) PDeactivate() { ...@@ -237,7 +237,7 @@ func (obj *Persistent) PDeactivate() {
obj.refcnt-- obj.refcnt--
if obj.refcnt < 0 { if obj.refcnt < 0 {
panic(obj.badf("deactivate: refcnt < 0")) panic(obj.badf("deactivate: refcnt < 0 (= %d)", obj.refcnt))
} }
if obj.refcnt > 0 { if obj.refcnt > 0 {
return // users still left return // users still left
...@@ -291,7 +291,7 @@ func (obj *Persistent) istate() Ghostable { ...@@ -291,7 +291,7 @@ func (obj *Persistent) istate() Ghostable {
// badf returns formatted error prefixed with obj's class and oid. // badf returns formatted error prefixed with obj's class and oid.
func (obj *Persistent) badf(format string, argv ...interface{}) error { func (obj *Persistent) badf(format string, argv ...interface{}) error {
return fmt.Errorf("%s(%s): "+format, return fmt.Errorf("%s(%s): "+format,
append([]interface{}{obj.zclass.class, obj.oid}, argv...)) append([]interface{}{obj.zclass.class, obj.oid}, argv...)...)
} }
......
...@@ -165,6 +165,8 @@ func TestPersistentBasic(t *testing.T) { ...@@ -165,6 +165,8 @@ func TestPersistentBasic(t *testing.T) {
// ClassOf(unregistered-obj) // ClassOf(unregistered-obj)
obj2 := &Unregistered{} obj2 := &Unregistered{}
assert.Equal(ClassOf(obj2), `ZODB.Go("lab.nexedi.com/kirr/neo/go/zodb.Unregistered")`) assert.Equal(ClassOf(obj2), `ZODB.Go("lab.nexedi.com/kirr/neo/go/zodb.Unregistered")`)
// XXX deactivate refcnt < 0 - check error message (this verifies badf fix)
} }
// zcacheControl is simple live cache control that prevents specified objects // zcacheControl is simple live cache control that prevents specified objects
...@@ -252,8 +254,8 @@ func TestPersistentDB(t *testing.T) { ...@@ -252,8 +254,8 @@ func TestPersistentDB(t *testing.T) {
checkObj(obj2, conn1, 102, InvalidTid, GHOST, 0, nil) checkObj(obj2, conn1, 102, InvalidTid, GHOST, 0, nil)
// invalidate: obj1 state dropped // invalidate: obj1 state dropped
obj1.PDeactivate() obj1.PInvalidate()
obj2.PDeactivate() obj2.PInvalidate()
checkObj(obj1, conn1, 101, InvalidTid, GHOST, 0, nil) checkObj(obj1, conn1, 101, InvalidTid, GHOST, 0, nil)
checkObj(obj2, conn1, 102, InvalidTid, GHOST, 0, nil) checkObj(obj2, conn1, 102, InvalidTid, GHOST, 0, nil)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment