Commit 99036f9c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 49434236
...@@ -382,14 +382,11 @@ func (db *DB) Open(ctx context.Context, opt *ConnOptions) (_ *Connection, err er ...@@ -382,14 +382,11 @@ func (db *DB) Open(ctx context.Context, opt *ConnOptions) (_ *Connection, err er
at = db.δtail.Head() at = db.δtail.Head()
db.mu.Unlock() db.mu.Unlock()
} else { } else {
// sync storage for lastTid // sync storage for head
var err error
err = db.stor.Sync(ctx) err = db.stor.Sync(ctx)
if err != nil { if err != nil {
return nil, err return nil, err
} }
at = db.stor.Head() at = db.stor.Head()
} }
} }
......
...@@ -462,7 +462,7 @@ func TestOpenRecovery(t *testing.T) { ...@@ -462,7 +462,7 @@ func TestOpenRecovery(t *testing.T) {
X := exc.Raiseif X := exc.Raiseif
main, err := ioutil.ReadFile("testdata/1.fs"); X(err) main, err := ioutil.ReadFile("testdata/1.fs"); X(err)
index, err := ioutil.ReadFile("testdata/1.fs.index"); X(err) index, err := ioutil.ReadFile("testdata/1.fs.index"); X(err)
lastTidOk := _1fs_dbEntryv[len(_1fs_dbEntryv)-1].Header.Tid headOk := _1fs_dbEntryv[len(_1fs_dbEntryv)-1].Header.Tid
topPos := int64(_1fs_indexTopPos) topPos := int64(_1fs_indexTopPos)
voteTail, err := ioutil.ReadFile("testdata/1voted.tail"); X(err) voteTail, err := ioutil.ReadFile("testdata/1voted.tail"); X(err)
...@@ -495,12 +495,12 @@ func TestOpenRecovery(t *testing.T) { ...@@ -495,12 +495,12 @@ func TestOpenRecovery(t *testing.T) {
defer func() { defer func() {
err = fs.Close(); X(err) err = fs.Close(); X(err)
}() }()
if at0 != lastTidOk { if at0 != headOk {
t.Fatalf("at0: %s ; expected: %s", at0, lastTidOk) t.Fatalf("at0: %s ; expected: %s", at0, headOk)
} }
head, err := fs.Sync(ctx); X(err) head, err := fs.Sync(ctx); X(err)
if head != lastTidOk { if head != headOk {
t.Fatalf("head: %s ; expected: %s", head, lastTidOk) t.Fatalf("head: %s ; expected: %s", head, headOk)
} }
}) })
} }
......
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