Commit 3d3017c5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 1cb9bf49
......@@ -599,6 +599,7 @@ func (dh *DataHeader) loadPrevRev(r io.ReaderAt) error {
// LoadBackRef reads data for the data record and decodes it as backpointer reference.
// prerequisite: dh loaded and .LenData == 0 (data record with back-pointer)
// XXX return backPos=-1 if err?
// XXX unused?
func (dh *DataHeader) LoadBackRef(r io.ReaderAt) (backPos int64, err error) {
if dh.DataLen != 0 {
bug(dh, "LoadBack() on non-backpointer data header")
......
......@@ -129,6 +129,10 @@ func Dump(w io.Writer, path string, dir fs1.IterDir, d Dumper) (err error) {
// https://github.com/zopefoundation/ZODB/commit/ddcb46a2
type DumperFsDump struct {
ntxn int // current transaction record #
// for loading data
dhLoading fs1.DataHeader
data []byte
}
func (d *DumperFsDump) DumperName() string {
......@@ -164,19 +168,21 @@ func (d *DumperFsDump) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
buf .S(fmt.Sprintf("%05d", j)) // XXX -> .D_f("05", j)
buf .S(" oid=") .V(dh.Oid)
if dh.DataLen == 0 {
buf .S(" class=undo or abort of object creation")
backPos, err := dh.LoadBackRef(it.R)
if err != nil {
// XXX
}
// load actual data
d.dhLoading = *dh
data := d.data
err = d.dhLoading.LoadData(it.R, &data)
if err != nil {
return err
}
// if memory was reallocated - use it next time
if cap(data) > cap(d.data) {
d.data = data
}
if backPos != 0 {
buf .S(" bp=") .X016(uint64(backPos))
}
if data == nil {
buf .S(" class=undo or abort of object creation")
} else {
// XXX Datah.LoadData()
//modname, classname = zodb.GetPickleMetadata(...) // XXX
//fullclass = "%s.%s" % (modname, classname)
fullclass := "AAA.BBB" // FIXME stub
......@@ -185,6 +191,11 @@ func (d *DumperFsDump) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
buf .S(" class=") .S(fullclass)
}
if dh.DataLen == 0 && data != nil {
// it was backpointer - print tid of transaction it points to
buf .S(" bp=") .V(d.dhLoading.Tid)
}
buf .S("\n")
}
......
......@@ -60,7 +60,7 @@ func VerifyIndexFor(path string) error {
// ----------------------------------------
const reindexSummary = "dump last few transactions of a database"
const reindexSummary = "XXX" // XXX
func reindexUsage(w io.Writer) {
fmt.Fprintf(w,
......
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