Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
3805e300
Commit
3805e300
authored
Jan 23, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
16788ee3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
go/zodb/persistent.go
go/zodb/persistent.go
+2
-2
go/zodb/persistent_test.go
go/zodb/persistent_test.go
+4
-2
No files found.
go/zodb/persistent.go
View file @
3805e300
...
...
@@ -237,7 +237,7 @@ func (obj *Persistent) PDeactivate() {
obj
.
refcnt
--
if
obj
.
refcnt
<
0
{
panic
(
obj
.
badf
(
"deactivate: refcnt < 0
"
))
panic
(
obj
.
badf
(
"deactivate: refcnt < 0
(= %d)"
,
obj
.
refcnt
))
}
if
obj
.
refcnt
>
0
{
return
// users still left
...
...
@@ -291,7 +291,7 @@ func (obj *Persistent) istate() Ghostable {
// badf returns formatted error prefixed with obj's class and oid.
func
(
obj
*
Persistent
)
badf
(
format
string
,
argv
...
interface
{})
error
{
return
fmt
.
Errorf
(
"%s(%s): "
+
format
,
append
([]
interface
{}{
obj
.
zclass
.
class
,
obj
.
oid
},
argv
...
))
append
([]
interface
{}{
obj
.
zclass
.
class
,
obj
.
oid
},
argv
...
)
...
)
}
...
...
go/zodb/persistent_test.go
View file @
3805e300
...
...
@@ -165,6 +165,8 @@ func TestPersistentBasic(t *testing.T) {
// ClassOf(unregistered-obj)
obj2
:=
&
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
...
...
@@ -252,8 +254,8 @@ func TestPersistentDB(t *testing.T) {
checkObj
(
obj2
,
conn1
,
102
,
InvalidTid
,
GHOST
,
0
,
nil
)
// invalidate: obj1 state dropped
obj1
.
P
Deactiv
ate
()
obj2
.
P
Deactiv
ate
()
obj1
.
P
Invalid
ate
()
obj2
.
P
Invalid
ate
()
checkObj
(
obj1
,
conn1
,
101
,
InvalidTid
,
GHOST
,
0
,
nil
)
checkObj
(
obj2
,
conn1
,
102
,
InvalidTid
,
GHOST
,
0
,
nil
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment