Commit fe8d33cd authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 375efa1e
......@@ -146,6 +146,7 @@ func (fs *FileStorage) Load(_ context.Context, xid zodb.Xid) (buf *zodb.Buf, tid
}
// FIXME zodb.TidMax is only 7fff... tid from outside can be ffff...
// XXX go compiler cannot deduce dh should be on stack here
//dh := DataHeader{Oid: xid.Oid, Tid: zodb.TidMax, PrevRevPos: dataPos}
dh := DataHeaderAlloc()
......@@ -264,7 +265,7 @@ func (zi *zIter) NextTxn(_ context.Context) (*zodb.TxnInfo, zodb.IDataIterator,
func (zi *zIter) NextData(_ context.Context) (*zodb.DataInfo, error) {
err := zi.iter.NextData()
if err != nil {
return nil, err // XXX recheck
return nil, err
}
zi.datai.Oid = zi.iter.Datah.Oid
......@@ -279,7 +280,7 @@ func (zi *zIter) NextData(_ context.Context) (*zodb.DataInfo, error) {
}
zi.dataBuf, err = zi.dhLoading.LoadData(zi.iter.R)
if err != nil {
return nil, err // XXX recheck
return nil, err
}
zi.datai.Data = zi.dataBuf.Data
......@@ -318,7 +319,7 @@ func (fs *FileStorage) findTxnRecord(r io.ReaderAt, tid zodb.Tid) (TxnHeader, er
tmin.CloneFrom(&fs.txnhMin)
tmax.CloneFrom(&fs.txnhMax)
if tmax.Pos == 0 { // XXX -> tmax.Valid() )?
if tmax.Pos == 0 { // XXX -> tmax.Valid() ?
// empty database - no such record
return TxnHeader{}, nil
}
......@@ -568,40 +569,6 @@ func (fs *FileStorage) saveIndex() (err error) {
return nil
}
// indexCorruptError is the error returned when index verification fails.
//
// XXX but io errors during verification return not this
type indexCorruptError struct {
index *Index
indexOk *Index
}
func (e *indexCorruptError) Error() string {
// TODO show delta ?
return "index corrupt"
}
// VerifyIndex verifies that index is correct
//
// XXX -> not exported @ fs1
func (fs *FileStorage) verifyIndex(ctx context.Context) error {
// XXX lock appends?
// XXX if .index is not yet loaded - load it
indexOk, err := fs.computeIndex(ctx)
if err != nil {
return err // XXX err ctx
}
if !indexOk.Equal(fs.index) {
err = &indexCorruptError{index: fs.index, indexOk: indexOk}
}
return err
}
// Reindex rebuilds the index
//
// XXX -> not exported @ fs1
......
......@@ -375,7 +375,7 @@ func (d *DumperFsTail) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
// https://github.com/zopefoundation/ZODB/blob/5.2.0-5-g6047e2fae/src/ZODB/scripts/fstail.py#L39
buf .S("\nuser=") .Qpyb(txnh.User) .S(" description=") .Qpyb(txnh.Description)
// XXX in zodb/py .length is len - 8, in zodb/go - whole txn record length -> FIXME better .Len be what is on disk
// NOTE at runtime: in zodb/py .length is len - 8, in zodb/go - whole txn record length
buf .S(" length=") .D64(txnh.Len - 8)
buf .S(" offset=") .D64(txnh.Pos) .S(" (+") .D64(txnh.HeaderLen()) .S(")\n\n")
......
......@@ -78,6 +78,7 @@ type DataInfo struct {
// original tid data was committed at (e.g. in case of undo)
//
// FIXME we don't really need this and this unnecessarily constraints interfaces.
// originates from: https://github.com/zopefoundation/ZODB/commit/2b0c9aa4
DataTid Tid
}
......
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