Commit 50a09046 authored by Kirill Smelkov's avatar Kirill Smelkov

X regenerate with updated ZODB/zodbtools + sync zodbdump

ZODB: based on 5.3.0-5-gcb928231e + y/rawext patch
zodbtools: with not-yet-in-master format stabilization + rawext

The main reson why generated files change a lot is because of this ZODB
commit:

https://github.com/zopefoundation/ZODB/commit/be5a9d54

where pickle protocol used to save data under python2 changed from 1 to 2.
parent f2932247
...@@ -20,20 +20,33 @@ ...@@ -20,20 +20,33 @@
/* /*
Zodbdump - Tool to dump content of a ZODB database Zodbdump - Tool to dump content of a ZODB database
TODO sync text with zodbdump/py This program dumps content of a ZODB database.
It uses ZODB Storage iteration API to get list of transactions and for every
Format transaction prints transaction's header and information about changed objects.
------
The information dumped is complete raw information as stored in ZODB storage
txn <tid> (<status>) XXX escape status ? and should be suitable for restoring the database from the dump file bit-to-bit
user <user|quote> identical to its original. It is dumped in semi text-binary format where
description <description|quote> object data is output as raw binary and everything else is text.
extension <extension|quote>
obj <oid> (delete | from <tid> | sha1:<sha1> <size> (LF <content>)?) LF XXX do we really need back <tid> There is also shortened mode activated via -hashonly where only hash of object
---- // ---- data is printed without content.
LF
txn ... Dump format:
txn <tid> <status|quote>
user <user|quote>
description <description|quote>
extension <extension|quote>
obj <oid> (delete | from <tid> | <size> <hashfunc>:<hash> (-|LF <raw-content>)) LF
obj ...
...
obj ...
LF
txn ...
quote: quote string with " with non-printable and control characters \-escaped
hashfunc: one of sha1, sha256, sha512 ...
*/ */
package zodbtools package zodbtools
...@@ -83,31 +96,39 @@ func (d *dumper) DumpData(datai *zodb.DataInfo) error { ...@@ -83,31 +96,39 @@ func (d *dumper) DumpData(datai *zodb.DataInfo) error {
buf .S("from ") .V(&datai.DataTid) buf .S("from ") .V(&datai.DataTid)
default: default:
// XXX sha1 is hardcoded for now. Dump format allows other hashes.
dataSha1 := sha1.Sum(datai.Data) dataSha1 := sha1.Sum(datai.Data)
buf .D(len(datai.Data)) .S(" sha1:") .Xb(dataSha1[:]) buf .D(len(datai.Data)) .S(" sha1:") .Xb(dataSha1[:])
writeData = true writeData = true
} }
buf .Cb('\n') var data []byte
if writeData {
if d.HashOnly {
buf .S(" -")
} else {
buf .Cb('\n')
data = datai.Data
}
}
// TODO use writev(data, "\n") via net.Buffers (it is already available) // TODO use writev(buf, data, "\n") via net.Buffers (it is already available)
_, err := d.W.Write(buf.Bytes()) _, err := d.W.Write(buf.Bytes())
if err != nil { if err != nil {
goto out goto out
} }
if writeData && !d.HashOnly { if data != nil {
_, err = d.W.Write(datai.Data) _, err = d.W.Write(datai.Data)
if err != nil { if err != nil {
goto out goto out
} }
}
// XXX maybe better to merge with next record ? _, err = d.W.Write(_LF)
_, err = d.W.Write(_LF) if err != nil {
if err != nil { goto out
goto out
}
} }
out: out:
...@@ -131,8 +152,8 @@ func (d *dumper) DumpTxn(txni *zodb.TxnInfo, dataIter zodb.IDataIterator) error ...@@ -131,8 +152,8 @@ func (d *dumper) DumpTxn(txni *zodb.TxnInfo, dataIter zodb.IDataIterator) error
d.afterFirst = true d.afterFirst = true
} }
_, err := fmt.Fprintf(d.W, "%stxn %s (%c)\nuser %q\ndescription %q\nextension %q\n", _, err := fmt.Fprintf(d.W, "%stxn %s %q\nuser %q\ndescription %q\nextension %q\n",
vskip, txni.Tid, txni.Status, txni.User, txni.Description, txni.Extension) vskip, txni.Tid, string(txni.Status), txni.User, txni.Description, txni.Extension)
if err != nil { if err != nil {
goto out goto out
} }
......
...@@ -3,19 +3,19 @@ package zodb ...@@ -3,19 +3,19 @@ package zodb
var _PyData_ClassName_Testv = [...]_PyDataClassName_TestEntry{ var _PyData_ClassName_Testv = [...]_PyDataClassName_TestEntry{
{ {
"((U\x18ZODB.tests.testSerializeq\x01U\x13ClassWithoutNewargsq\x02tNtq\x03.", "\x80\x02U\x18ZODB.tests.testSerializeq\x01U\x13ClassWithoutNewargsq\x02\x86N\x86q\x03.",
"ZODB.tests.testSerialize.ClassWithoutNewargs", "ZODB.tests.testSerialize.ClassWithoutNewargs",
}, },
{ {
"((U\x18ZODB.tests.testSerializeq\x01U\x10ClassWithNewargsq\x02t(K\x01tq\x03tq\x04.", "\x80\x02U\x18ZODB.tests.testSerializeq\x01U\x10ClassWithNewargsq\x02\x86K\x01\x85q\x03\x86q\x04.",
"ZODB.tests.testSerialize.ClassWithNewargs", "ZODB.tests.testSerialize.ClassWithNewargs",
}, },
{ {
"cZODB.tests.testSerialize\nClassWithoutNewargs\nq\x01.", "\x80\x02cZODB.tests.testSerialize\nClassWithoutNewargs\nq\x01.",
"ZODB.tests.testSerialize.ClassWithoutNewargs", "ZODB.tests.testSerialize.ClassWithoutNewargs",
}, },
{ {
"(cZODB.tests.testSerialize\nClassWithNewargs\nq\x01(K\x01tq\x02tq\x03.", "\x80\x02cZODB.tests.testSerialize\nClassWithNewargs\nq\x01K\x01\x85q\x02\x86q\x03.",
"ZODB.tests.testSerialize.ClassWithNewargs", "ZODB.tests.testSerialize.ClassWithNewargs",
}, },
{"aaa", "?.?"}, {"aaa", "?.?"},
......
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