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

.

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