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
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
8da1816d
Commit
8da1816d
authored
Mar 02, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
cbd8f5fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
13 deletions
+33
-13
t/neo/storage/fs1/filestorage.go
t/neo/storage/fs1/filestorage.go
+3
-3
t/neo/storage/fs1/filestorage_test.go
t/neo/storage/fs1/filestorage_test.go
+30
-10
No files found.
t/neo/storage/fs1/filestorage.go
View file @
8da1816d
...
@@ -865,7 +865,7 @@ func (fsi *Iterator) NextTxn() (*zodb.TxnInfo, zodb.IStorageRecordIterator, erro
...
@@ -865,7 +865,7 @@ func (fsi *Iterator) NextTxn() (*zodb.TxnInfo, zodb.IStorageRecordIterator, erro
}
}
func
(
fs
*
FileStorage
)
Iterate
(
tidMin
,
tidMax
zodb
.
Tid
)
zodb
.
IStorageIterator
{
func
(
fs
*
FileStorage
)
Iterate
(
tidMin
,
tidMax
zodb
.
Tid
)
zodb
.
IStorageIterator
{
fmt
.
Printf
(
"iterate %v..%v
\n
"
,
tidMin
,
tidMax
)
//
fmt.Printf("iterate %v..%v\n", tidMin, tidMax)
// FIXME case when only 0 or 1 txn present
// FIXME case when only 0 or 1 txn present
if
tidMin
<
fs
.
txnhMin
.
Tid
{
if
tidMin
<
fs
.
txnhMin
.
Tid
{
tidMin
=
fs
.
txnhMin
.
Tid
tidMin
=
fs
.
txnhMin
.
Tid
...
@@ -890,12 +890,12 @@ func (fs *FileStorage) Iterate(tidMin, tidMax zodb.Tid) zodb.IStorageIterator {
...
@@ -890,12 +890,12 @@ func (fs *FileStorage) Iterate(tidMin, tidMax zodb.Tid) zodb.IStorageIterator {
iter
:=
&
Iter
.
txnIter
iter
:=
&
Iter
.
txnIter
if
(
tidMin
-
fs
.
txnhMin
.
Tid
)
<
(
fs
.
txnhMax
.
Tid
-
tidMin
)
{
if
(
tidMin
-
fs
.
txnhMin
.
Tid
)
<
(
fs
.
txnhMax
.
Tid
-
tidMin
)
{
println
(
"forward"
)
//fmt.Printf("forward %.1f%%\n", 100 * float64(tidMin - fs.txnhMin.Tid) / float64(fs.txnhMax.Tid - fs.txnhMin.Tid)
)
iter
.
Flags
=
1
*
iterDir
|
iterPreloaded
iter
.
Flags
=
1
*
iterDir
|
iterPreloaded
iter
.
Txnh
.
CloneFrom
(
&
fs
.
txnhMin
)
iter
.
Txnh
.
CloneFrom
(
&
fs
.
txnhMin
)
iter
.
TidStop
=
tidMin
-
1
// XXX overflow
iter
.
TidStop
=
tidMin
-
1
// XXX overflow
}
else
{
}
else
{
println
(
"backward"
)
//fmt.Printf("backward %.1f%%\n", 100 * float64(tidMin - fs.txnhMin.Tid) / float64(fs.txnhMax.Tid - fs.txnhMin.Tid)
)
iter
.
Flags
=
0
*
iterDir
|
iterPreloaded
iter
.
Flags
=
0
*
iterDir
|
iterPreloaded
iter
.
Txnh
.
CloneFrom
(
&
fs
.
txnhMax
)
iter
.
Txnh
.
CloneFrom
(
&
fs
.
txnhMax
)
iter
.
TidStop
=
tidMin
iter
.
TidStop
=
tidMin
...
...
t/neo/storage/fs1/filestorage_test.go
View file @
8da1816d
...
@@ -124,6 +124,7 @@ func TestLoad(t *testing.T) {
...
@@ -124,6 +124,7 @@ func TestLoad(t *testing.T) {
for
ii
,
tmin
:=
range
minv
{
for
ii
,
tmin
:=
range
minv
{
for
jj
,
tmax
:=
range
maxv
{
for
jj
,
tmax
:=
range
maxv
{
// XXX -> ntxn ?
// expected number of iteration steps
// expected number of iteration steps
nsteps
:=
j
-
i
+
1
nsteps
:=
j
-
i
+
1
nsteps
-=
ii
/
2
// one less point for tidMin+1
nsteps
-=
ii
/
2
// one less point for tidMin+1
...
@@ -132,9 +133,7 @@ func TestLoad(t *testing.T) {
...
@@ -132,9 +133,7 @@ func TestLoad(t *testing.T) {
nsteps
=
0
// j < i and j == i and ii/jj
nsteps
=
0
// j < i and j == i and ii/jj
}
}
println
()
//fmt.Printf("%d%+d .. %d%+d\t -> %d steps\n", i, ii-1, j, jj-1, nsteps)
println
(
len
(
tidv
))
fmt
.
Printf
(
"%d%+d .. %d%+d
\t
-> %d steps
\n
"
,
i
,
ii
-
1
,
j
,
jj
-
1
,
nsteps
)
iter
:=
fs
.
Iterate
(
tmin
,
tmax
)
iter
:=
fs
.
Iterate
(
tmin
,
tmax
)
...
@@ -157,23 +156,44 @@ func TestLoad(t *testing.T) {
...
@@ -157,23 +156,44 @@ func TestLoad(t *testing.T) {
dbe
:=
_1fs_dbEntryv
[
i
+
ii
/
2
+
k
]
dbe
:=
_1fs_dbEntryv
[
i
+
ii
/
2
+
k
]
// TODO also check .Pos, .LenPrev, .Len
// TODO also check .Pos, .LenPrev, .Len
in iter.txnIter.*
if
!
reflect
.
DeepEqual
(
*
txni
,
dbe
.
Header
.
TxnInfo
)
{
if
!
reflect
.
DeepEqual
(
*
txni
,
dbe
.
Header
.
TxnInfo
)
{
t
.
Fatalf
(
"%v: unexpected txn entry:
\n
have: %q
\n
want: %q"
,
subj
,
*
txni
,
dbe
.
Header
.
TxnInfo
)
t
.
Fatalf
(
"%v: unexpected txn entry:
\n
have: %q
\n
want: %q"
,
subj
,
*
txni
,
dbe
.
Header
.
TxnInfo
)
}
}
for
{
ndata
:=
len
(
dbe
.
Entryv
)
for
kdata
:=
0
;
;
kdata
++
{
dsubj
:=
fmt
.
Sprintf
(
"%v: dstep %v/%v"
,
subj
,
kdata
,
ndata
)
datai
,
err
:=
dataIter
.
NextData
()
datai
,
err
:=
dataIter
.
NextData
()
if
err
!=
nil
{
if
err
!=
nil
{
err
=
okEOF
(
err
)
if
err
==
io
.
EOF
{
break
if
kdata
!=
ndata
{
t
.
Fatalf
(
"%v: data steps underrun"
,
dsubj
)
}
break
}
t
.
Fatalf
(
"%v: %v"
,
dsubj
,
err
)
}
}
_
=
datai
if
kdata
>
ndata
{
}
t
.
Fatalf
(
"%v: dsteps overrun"
,
dsubj
)
}
// TODO check err
txe
:=
dbe
.
Entryv
[
kdata
]
// XXX -> func
if
datai
.
Oid
!=
txe
.
Header
.
Oid
{
t
.
Fatalf
(
"%v: oid mismatch ..."
,
dsubj
)
// XXX
}
if
datai
.
Tid
!=
txe
.
Header
.
Tid
{
t
.
Fatalf
(
"%v: tid mismatch ..."
,
dsubj
)
// XXX
}
if
!
bytes
.
Equal
(
datai
.
Data
,
txe
.
Data
())
{
t
.
Fatalf
(
"%v: data mismatch ..."
,
dsubj
)
// XXX
}
// TODO .DataTid
}
}
}
}
}
...
...
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