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
98fa98ce
Commit
98fa98ce
authored
Nov 09, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X fs1: Fix empty file iteration
parent
cd186bf8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
go/zodb/storage/fs1/filestorage.go
go/zodb/storage/fs1/filestorage.go
+11
-10
No files found.
go/zodb/storage/fs1/filestorage.go
View file @
98fa98ce
...
...
@@ -215,7 +215,7 @@ func (fs *FileStorage) _Load(dh *DataHeader, xid zodb.Xid) (*zodb.Buf, zodb.Tid,
type
zIter
struct
{
iter
Iter
T
idStop
zodb
.
Tid
// iterate up to tid <= tidStop | tid >= tidStop depending on iter.dir
t
idStop
zodb
.
Tid
// iterate up to tid <= tidStop | tid >= tidStop depending on iter.dir
zFlags
zIterFlags
...
...
@@ -258,8 +258,8 @@ func (zi *zIter) NextTxn(_ context.Context) (*zodb.TxnInfo, zodb.IDataIterator,
}
// XXX how to make sure last good txnh is preserved?
if
(
zi
.
iter
.
Dir
==
IterForward
&&
zi
.
iter
.
Txnh
.
Tid
>
zi
.
T
idStop
)
||
(
zi
.
iter
.
Dir
==
IterBackward
&&
zi
.
iter
.
Txnh
.
Tid
<
zi
.
T
idStop
)
{
if
(
zi
.
iter
.
Dir
==
IterForward
&&
zi
.
iter
.
Txnh
.
Tid
>
zi
.
t
idStop
)
||
(
zi
.
iter
.
Dir
==
IterBackward
&&
zi
.
iter
.
Txnh
.
Tid
<
zi
.
t
idStop
)
{
//println("-> EOF")
zi
.
zFlags
|=
zIterEOF
return
nil
,
nil
,
io
.
EOF
...
...
@@ -321,16 +321,17 @@ func (fs *FileStorage) findTxnRecord(r io.ReaderAt, tid zodb.Tid) (TxnHeader, er
//fmt.Printf("findTxn %v\n", tid)
// XXX read snapshot under lock
// NOTE cloning to unalias strings memory
var
tmin
,
tmax
TxnHeader
tmin
.
CloneFrom
(
&
fs
.
txnhMin
)
tmax
.
CloneFrom
(
&
fs
.
txnhMax
)
if
tmax
.
Pos
==
0
{
// XXX -> tmax.Valid() ?
if
fs
.
txnhMin
.
Len
==
0
{
// empty database - no such record
return
TxnHeader
{},
nil
}
// NOTE cloning to unalias strings memory
var
tmin
,
tmax
TxnHeader
tmin
.
CloneFrom
(
&
fs
.
txnhMin
)
tmax
.
CloneFrom
(
&
fs
.
txnhMax
)
// now we know the database is not empty and thus tmin & tmax are valid
if
tmax
.
Tid
<
tid
{
...
...
@@ -417,10 +418,10 @@ func (fs *FileStorage) Iterate(tidMin, tidMax zodb.Tid) zodb.ITxnIterator {
iter
.
Datah
.
Pos
=
txnh
.
DataPos
()
// XXX dup wrt Iter.NextTxn
iter
.
Datah
.
DataLen
=
-
DataHeaderSize
// first iteration will go to first data record
iter
.
Dir
=
IterForward
//
XXX
allow both ways iteration at ZODB level
iter
.
Dir
=
IterForward
//
TODO
allow both ways iteration at ZODB level
ziter
.
zFlags
|=
zIterPreloaded
ziter
.
T
idStop
=
tidMax
ziter
.
t
idStop
=
tidMax
return
ziter
}
...
...
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