Commit d731fd4e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f6560f86
......@@ -41,7 +41,7 @@ import (
// DemoData represents data for a demo: storage.
type DemoData struct {
base string // path for base.fs
base string // url for base.fs
δ string // ----/---- δ.fs
}
......@@ -56,7 +56,7 @@ type tOptions struct {
Preload string // preload database with data from this location
}
// withDemoData tests f with all kind of demo data splits.
// withDemoData tests f with all kinds of opt.Preload data split into base + δ.
func withDemoData(t *testing.T, f func(t *testing.T, ddat *DemoData), optv ...tOptions) {
t.Helper()
X := xtesting.FatalIf(t)
......@@ -89,18 +89,14 @@ func withDemoData(t *testing.T, f func(t *testing.T, ddat *DemoData), optv ...tO
pos int // where this transaction starts in the dump
}
var txnv []zdumpTxn
// fmt.Printf("%s\n\n\n", zdump)
for _, m := range txnRe.FindAllStringSubmatchIndex(zdump, -1) {
// fmt.Println(m)
// [m[0]:m[1]] refer to whole txn line
// [m[0]:m[1]] refers to whole txn line
__ := zdump[m[2]:m[3]]
tid, err := zodb.ParseTid(__); X(err)
txnv = append(txnv, zdumpTxn{tid, m[0]})
}
// fmt.Printf("\n\n\ntxnv: %v\n", txnv)
// verify on all combinations of preload being split into base+δ
// verify f on all combinations of preload being split into base+δ
work := xtempdir(t)
defer os.RemoveAll(work)
test1 := func(δstart zodb.Tid, zdumpBase, zdumpδ string) {
......@@ -115,8 +111,11 @@ func withDemoData(t *testing.T, f func(t *testing.T, ddat *DemoData), optv ...tO
δ := "file://"+work1+"/δ.fs"
ddat := &DemoData{base, δ}
_, err = xtesting.ZPyRestore(base, zdumpBase); X(err)
// XXX + explain why demo instead of δ (restoring copy without original present fails)
_, err = xtesting.ZPyRestore(base, zdumpBase); X(err)
// restore δ part via `demo:(base)/(δ)` - not `file:δ`.
// The reason we do this is because restoring δ via
// just its file will fail when restoring copy data
// record with copy_from transaction being in base.
_, err = xtesting.ZPyRestore(ddat.URL(), zdumpδ); X(err)
f(t, ddat)
......
// Copyright (C) 2017-2020 Nexedi SA and Contributors.
// Copyright (C) 2017-2021 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
......@@ -132,7 +132,7 @@ func (fs *FileStorage) LastOid(_ context.Context) (zodb.Oid, error) {
}
func (fs *FileStorage) URL() string {
return fs.file.Name()
return fs.file.Name() // XXX + file://
}
// freelist(DataHeader)
......
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