Commit 7d86f309 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 56194ce0
...@@ -63,7 +63,7 @@ func checkLoad(t *testing.T, fs *FileStorage, xid zodb.Xid, expect oidLoadedOk) ...@@ -63,7 +63,7 @@ func checkLoad(t *testing.T, fs *FileStorage, xid zodb.Xid, expect oidLoadedOk)
} }
func TestLoad(t *testing.T) { func TestLoad(t *testing.T) {
fs, err := OpenFileStorage("testdata/1.fs") fs, err := Open("testdata/1.fs")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
...@@ -140,6 +140,7 @@ func TestLoad(t *testing.T) { ...@@ -140,6 +140,7 @@ func TestLoad(t *testing.T) {
// FIXME first tidMin and last tidMax // FIXME first tidMin and last tidMax
dbe := _1fs_dbEntryv[i + k] dbe := _1fs_dbEntryv[i + k]
// TODO also check .Pos, .LenPrev, .Len
if !reflect.DeepEqual(txni, dbe.Header.TxnInfo) { if !reflect.DeepEqual(txni, dbe.Header.TxnInfo) {
t.Errorf("iterating %v..%v: step %v: unexpected txn entry:\nhave: %q\nwant: %q", tidMin, tidMax, k, txni, dbe.Header.TxnInfo) t.Errorf("iterating %v..%v: step %v: unexpected txn entry:\nhave: %q\nwant: %q", tidMin, tidMax, k, txni, dbe.Header.TxnInfo)
} }
......
...@@ -117,6 +117,7 @@ def main(): ...@@ -117,6 +117,7 @@ def main():
stor = FileStorage(outfs, read_only=True) stor = FileStorage(outfs, read_only=True)
emit("\nvar _1fs_dbEntryv = [...]dbEntry{") emit("\nvar _1fs_dbEntryv = [...]dbEntry{")
txnLenPrev = -1
for txn in stor.iterator(): # txn is TransactionRecord for txn in stor.iterator(): # txn is TransactionRecord
# txn.extension is already depickled dict - we want to put raw data from file # txn.extension is already depickled dict - we want to put raw data from file
# also we need to access txn record legth which is not provided by higher-level iterator # also we need to access txn record legth which is not provided by higher-level iterator
...@@ -125,11 +126,15 @@ def main(): ...@@ -125,11 +126,15 @@ def main():
assert th.tid == txn.tid assert th.tid == txn.tid
assert th.tlen == txn._tend - txn._tpos assert th.tlen == txn._tend - txn._tpos
txnLen = th.tlen + 8
emit("\t{") emit("\t{")
# -> TxnHeader # -> TxnHeader
emit("\t\tTxnHeader{") emit("\t\tTxnHeader{")
emit("\t\t\tRecLenm8:\t%i," % th.tlen) emit("\t\t\tPos:\t %i," % txn._tpos)
emit("\t\t\tLenPrev: %i," % txnLenPrev)
emit("\t\t\tLen:\t %i," % txnLen)
emit("\t\t\tTxnInfo:\tzodb.TxnInfo{") emit("\t\t\tTxnInfo:\tzodb.TxnInfo{")
emit("\t\t\t\tTid:\t%s," % hex64(txn.tid)) emit("\t\t\t\tTid:\t%s," % hex64(txn.tid))
emit("\t\t\t\tStatus:\t'%s'," % txn.status) emit("\t\t\t\tStatus:\t'%s'," % txn.status)
...@@ -139,6 +144,8 @@ def main(): ...@@ -139,6 +144,8 @@ def main():
emit("\t\t\t},") emit("\t\t\t},")
emit("\t\t},") emit("\t\t},")
txnLenPrev = txnLen
# -> DataHeader + payload # -> DataHeader + payload
emit("\n\t\t[]txnEntry{") emit("\n\t\t[]txnEntry{")
...@@ -152,10 +159,11 @@ def main(): ...@@ -152,10 +159,11 @@ def main():
emit("\t\t\t{") emit("\t\t\t{")
emit("\t\t\t\tDataHeader{") emit("\t\t\t\tDataHeader{")
emit("\t\t\t\t\tPos:\t%i," % drec.pos)
emit("\t\t\t\t\tOid:\t%i," % unpack64(drec.oid)) emit("\t\t\t\t\tOid:\t%i," % unpack64(drec.oid))
emit("\t\t\t\t\tTid:\t%s," % hex64(drec.tid)) emit("\t\t\t\t\tTid:\t%s," % hex64(drec.tid))
emit("\t\t\t\t\tPrevDataRecPos:\t%i," % dh.prev) emit("\t\t\t\t\tPrevRevPos:\t%i," % dh.prev)
emit("\t\t\t\t\tTxnPos:\t%i," % txn._tpos) emit("\t\t\t\t\tTxnPos:\t%i," % txn._tpos)
assert drec.version == '' assert drec.version == ''
emit("\t\t\t\t\tDataLen:\t%i," % dh.plen) emit("\t\t\t\t\tDataLen:\t%i," % dh.plen)
......
This diff is collapsed.
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