Commit a243d4e0 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 424718ea
...@@ -44,6 +44,34 @@ func withDemoStorage(t *testing.T, f func(t *testing.T, dsrv *Storage/*XXX -> Sr ...@@ -44,6 +44,34 @@ func withDemoStorage(t *testing.T, f func(t *testing.T, dsrv *Storage/*XXX -> Sr
opt = optv[0] opt = optv[0]
} }
// retrive zdump of Preload
zdump := ""
if opt.Preload != "" {
ctx := context.Background()
buf := bytes.Buffer{}
stor, _, err := fs1.Open(ctx, opt.Preload, &zodb.DriverOptions{ReadOnly: true}); X(err)
err = zodbtools.Dump(ctx, buf, stor, 0, zodb.TidMax, /*hashonly=*/false)
stor.Close()
X(err)
zdump = buf.String()
}
// split zdump into transactions
// TODO -> zodbtools.DumpReader
txnRe := regexp.MustCompile(`^txn (?P<tid>[0-9a-f]{16}) "(?P<status>.)"$`)
type zdumpTxn struct {
tid zodb.Tid
pos int // where this transaction starts in the dump
}
var txnv []zdumpTxn
for _, m := range txnRe.FindAllStringSubmatchIndex(zdump, -1) {
// [m[0]:m[1]] refer to whole txn line
__ := zdump[m[2]:m[3]]
tid, err := zodb.ParseTid(__); X(err)
txnv = append(txnv, zdumpTxn{tid, m[0])
}
// verify on all combinations of preload being split into base+δ // verify on all combinations of preload being split into base+δ
txnv, err := xtesting.LoadDBHistory(opt.Preload); X(err) txnv, err := xtesting.LoadDBHistory(opt.Preload); X(err)
......
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