Commit e61e6494 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 62af029d
...@@ -90,6 +90,7 @@ func (ovl *Storage) Load(ctx context.Context, xid zodb.Xid) (_ *mem.Buf, _ zodb. ...@@ -90,6 +90,7 @@ func (ovl *Storage) Load(ctx context.Context, xid zodb.Xid) (_ *mem.Buf, _ zodb.
} }
useBase := false useBase := false
inδ := false
var eNoData *zodb.NoDataError var eNoData *zodb.NoDataError
var eNoObject *zodb.NoObjectError var eNoObject *zodb.NoObjectError
switch { switch {
...@@ -98,8 +99,9 @@ func (ovl *Storage) Load(ctx context.Context, xid zodb.Xid) (_ *mem.Buf, _ zodb. ...@@ -98,8 +99,9 @@ func (ovl *Storage) Load(ctx context.Context, xid zodb.Xid) (_ *mem.Buf, _ zodb.
// object deleted in δ -> whiteout // object deleted in δ -> whiteout
return data, serial, eNoData return data, serial, eNoData
} else { } else {
// object not created in δ // object present in δ but not yet created as of xid.at
useBase = true useBase = true
inδ = true
} }
case errors.As(err, &eNoObject): case errors.As(err, &eNoObject):
...@@ -121,7 +123,12 @@ func (ovl *Storage) Load(ctx context.Context, xid zodb.Xid) (_ *mem.Buf, _ zodb. ...@@ -121,7 +123,12 @@ func (ovl *Storage) Load(ctx context.Context, xid zodb.Xid) (_ *mem.Buf, _ zodb.
case errors.As(err, &eNoData): case errors.As(err, &eNoData):
err = eNoData err = eNoData
case errors.As(err, &eNoObject): case errors.As(err, &eNoObject):
err = eNoObject if !inδ {
err = eNoObject
} else {
// object is present in δ
err = &zodb.NoDataError{Oid: xid.Oid, DeletedAt: 0}
}
} }
return data, serial, err return data, serial, err
......
...@@ -102,7 +102,7 @@ func withDemoData(t *testing.T, f func(t *testing.T, ddat *DemoData), optv ...tO ...@@ -102,7 +102,7 @@ func withDemoData(t *testing.T, f func(t *testing.T, ddat *DemoData), optv ...tO
// verify on all combinations of preload being split into base+δ // verify on all combinations of preload being split into base+δ
work := xtempdir(t) work := xtempdir(t)
//defer os.RemoveAll(work) defer os.RemoveAll(work)
test1 := func(δstart zodb.Tid, zdumpBase, zdumpδ string) { test1 := func(δstart zodb.Tid, zdumpBase, zdumpδ string) {
t.Helper() t.Helper()
t.Run(fmt.Sprintf("δstart=%s", δstart), func(t *testing.T) { t.Run(fmt.Sprintf("δstart=%s", δstart), func(t *testing.T) {
......
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