Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
d437810c
Commit
d437810c
authored
Aug 23, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d94bff42
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
go/neo/client/cache.go
go/neo/client/cache.go
+16
-10
No files found.
go/neo/client/cache.go
View file @
d437810c
...
...
@@ -124,6 +124,10 @@ func (oce *oidCacheEntry) find(rce *revCacheEntry) int {
return
-
1
}
func
(
oce
*
oidCacheEntry
)
deli
(
i
int
)
{
oce
.
revv
=
append
(
oce
.
revv
[
:
i
],
oce
.
revv
[
i
+
1
:
])
}
// XXX doc; must be called with oce lock held
func
(
oce
*
oidCacheEntry
)
del
(
rce
*
revCacheEntry
)
{
i
:=
oce
.
find
(
rce
)
...
...
@@ -231,7 +235,7 @@ func (c *cache) Load(xid zodb.Xid) (data []byte, tid Tid, err error) {
if
serial
>=
rce
.
before
{
// XXX err != nil - also check vvv?
// XXX loadSerial?
xxx
.
Errorf
(
"E: cache: database inconsistency: oid: %v: load(<%v) -> %v"
,
xid
.
Oid
,
rce
.
before
,
serial
)
errDB
(
xid
.
Oid
,
"load(<%v) -> %v"
,
rce
.
before
,
serial
)
}
rce
.
serial
=
serial
rce
.
data
=
data
...
...
@@ -258,13 +262,11 @@ func (c *cache) Load(xid zodb.Xid) (data []byte, tid Tid, err error) {
// verify rce.serial == rceNext.serial
if
rce
.
serial
!=
rceNext
.
serial
{
// XXX -> where to put? rce.err?
xxx
.
Errorf
(
"E: cache: database inconsistency: oid: %v: load(<%v) -> %v; load(<%v) -> %v"
,
xid
.
Oid
,
rce
.
before
,
rce
.
serial
,
rceNext
.
before
,
rceNext
.
serial
)
errDB
(
xid
.
Oid
,
"load(<%v) -> %v; load(<%v) -> %v"
,
rce
.
before
,
rce
.
serial
,
rceNext
.
before
,
rceNext
.
serial
)
}
// drop rce
//oce.revv = append(oce.revv[:i], oce.revv[i+1:])
oce
.
del
(
i
)
oce
.
deli
(
i
)
δsize
-=
len
(
rce
.
data
)
rce
=
rceNext
}
...
...
@@ -276,14 +278,12 @@ func (c *cache) Load(xid zodb.Xid) (data []byte, tid Tid, err error) {
if
rce
.
serial
<
rcePrev
.
before
{
// verify rce.serial == rcePrev.serial (if that is ready)
if
rcePrev
.
loaded
()
&&
rcePrev
.
serial
!=
rce
.
serial
{
// XXX rcePrev.serial=0 ?
// XXX
dup wrt ^^^ -> func
xxx
.
Errorf
(
"E: cache: database inconsistency: oid: %v: load(<%v) -> %v; load(<%v) -> %v"
,
xid
.
Oid
,
rcePrev
.
before
,
rcePrev
,
serial
,
rce
.
before
,
rce
.
serial
)
// XXX
-> where to put? rce.err?
errDB
(
xid
.
Oid
,
"load(<%v) -> %v; load(<%v) -> %v"
,
rcePrev
.
before
,
rcePrev
.
serial
,
rce
.
before
,
rce
.
serial
)
}
// drop rcePrev
//oce.revv =
oce
.
del
(
i
-
1
)
oce
.
deli
(
i
-
1
)
δsize
-=
len
(
rcePrev
.
data
)
}
}
...
...
@@ -339,3 +339,9 @@ func (c *cache) cleaner() {
func
(
h
*
listHead
)
rceFromInLRU
()
(
rce
*
revCacheEntry
)
{
return
(
*
revCacheEntry
)(
unsafe
.
Pointer
(
h
)
-
unsafe
.
OffsetOf
(
rce
.
inLRU
))
}
// errDB returns error about database being inconsistent
func
errDB
(
oid
zodb
.
Oid
,
format
string
,
argv
...
interface
{})
error
{
// XXX -> separate type?
return
fmt
.
Errorf
(
"cache: database inconsistency: oid: %v: "
+
format
,
oid
,
...
argv
)
}
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