Commit 1540d347 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 77dfa988
...@@ -772,6 +772,7 @@ const ( ...@@ -772,6 +772,7 @@ const (
func (ti *txnIter) NextTxn(flags TxnLoadFlags) error { func (ti *txnIter) NextTxn(flags TxnLoadFlags) error {
switch { switch {
case ti.Flags & iterEOF != 0: case ti.Flags & iterEOF != 0:
println("already eof")
return io.EOF return io.EOF
case ti.Flags & iterPreloaded != 0: case ti.Flags & iterPreloaded != 0:
...@@ -798,6 +799,7 @@ func (ti *txnIter) NextTxn(flags TxnLoadFlags) error { ...@@ -798,6 +799,7 @@ func (ti *txnIter) NextTxn(flags TxnLoadFlags) error {
// XXX how to make sure last good txnh is preserved? // XXX how to make sure last good txnh is preserved?
if (ti.Flags&iterDir != 0 && ti.Txnh.Tid > ti.TidStop) || if (ti.Flags&iterDir != 0 && ti.Txnh.Tid > ti.TidStop) ||
(ti.Flags&iterDir == 0 && ti.Txnh.Tid < ti.TidStop) { (ti.Flags&iterDir == 0 && ti.Txnh.Tid < ti.TidStop) {
println("-> EOF")
ti.Flags |= iterEOF ti.Flags |= iterEOF
return io.EOF return io.EOF
} }
......
...@@ -134,18 +134,14 @@ func TestLoad(t *testing.T) { ...@@ -134,18 +134,14 @@ 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(i,j, ii, jj, nsteps) fmt.Printf("%d%+d .. %d%+d\t -> %d steps\n", i, ii-1, j, jj-1, nsteps)
for k := 0; ; k++ { for k := 0; ; k++ {
subj := fmt.Sprintf("iterating %v..%v: step %v/%v", tmin, tmax, k+1, nsteps) subj := fmt.Sprintf("iterating %v..%v: step %v/%v", tmin, tmax, k+1, nsteps)
if k >= nsteps {
t.Fatalf("%v: steps overrun", subj)
}
txni, dataIter, err := iter.NextTxn() txni, dataIter, err := iter.NextTxn()
if err != nil { if err != nil {
if err == io.EOF { if err == io.EOF {
if k != nsteps - 1 { if k != nsteps {
t.Fatalf("%v: steps underrun", subj) t.Fatalf("%v: steps underrun", subj)
} }
break break
...@@ -153,7 +149,11 @@ func TestLoad(t *testing.T) { ...@@ -153,7 +149,11 @@ func TestLoad(t *testing.T) {
t.Fatalf("%v: %v", subj, err) t.Fatalf("%v: %v", subj, err)
} }
dbe := _1fs_dbEntryv[i + k] if k >= nsteps {
t.Fatalf("%v: steps overrun", subj)
}
dbe := _1fs_dbEntryv[i + ii/2 + k]
// TODO also check .Pos, .LenPrev, .Len // TODO also check .Pos, .LenPrev, .Len
if !reflect.DeepEqual(*txni, dbe.Header.TxnInfo) { if !reflect.DeepEqual(*txni, dbe.Header.TxnInfo) {
......
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