Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
c864ec80
Commit
c864ec80
authored
May 24, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
24ab091c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
17 deletions
+39
-17
go/zodb/storage/fs1/fs1tools/dump.go
go/zodb/storage/fs1/fs1tools/dump.go
+11
-5
go/zodb/storage/fs1/fs1tools/verify.go
go/zodb/storage/fs1/fs1tools/verify.go
+28
-12
No files found.
go/zodb/storage/fs1/fs1tools/dump.go
View file @
c864ec80
...
@@ -53,7 +53,7 @@ type Dumper interface {
...
@@ -53,7 +53,7 @@ type Dumper interface {
DumpTxn
(
buf
*
xfmt
.
Buffer
,
it
*
fs1
.
Iter
)
error
DumpTxn
(
buf
*
xfmt
.
Buffer
,
it
*
fs1
.
Iter
)
error
// DumpEndOK is called at the end of successfull dump.
// DumpEndOK is called at the end of successfull dump.
DumpEndOK
(
buf
*
xfmt
.
Buffer
)
DumpEndOK
(
buf
*
xfmt
.
Buffer
)
error
}
}
// Dump dumps content of a FileStorage file @ path.
// Dump dumps content of a FileStorage file @ path.
...
@@ -123,7 +123,10 @@ func Dump(w io.Writer, path string, dir fs1.IterDir, d Dumper) (err error) {
...
@@ -123,7 +123,10 @@ func Dump(w io.Writer, path string, dir fs1.IterDir, d Dumper) (err error) {
}
}
}
}
d
.
DumpEndOK
(
buf
)
err
=
d
.
DumpEndOK
(
buf
)
if
err
!=
nil
{
return
err
}
return
nil
return
nil
}
}
...
@@ -204,7 +207,8 @@ func (d *DumperFsDump) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
...
@@ -204,7 +207,8 @@ func (d *DumperFsDump) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
}
}
}
}
func
(
d
*
DumperFsDump
)
DumpEndOK
(
buf
*
xfmt
.
Buffer
)
{
func
(
d
*
DumperFsDump
)
DumpEndOK
(
buf
*
xfmt
.
Buffer
)
error
{
return
nil
}
}
// DumperFsDumpVerbose implements a very verbose dumper with output identical
// DumperFsDumpVerbose implements a very verbose dumper with output identical
...
@@ -290,7 +294,8 @@ func (d *DumperFsDumpVerbose) dumpData(buf *xfmt.Buffer, it *fs1.Iter) error {
...
@@ -290,7 +294,8 @@ func (d *DumperFsDumpVerbose) dumpData(buf *xfmt.Buffer, it *fs1.Iter) error {
return
nil
return
nil
}
}
func
(
d
*
DumperFsDumpVerbose
)
DumpEndOK
(
buf
*
xfmt
.
Buffer
)
{
func
(
d
*
DumperFsDumpVerbose
)
DumpEndOK
(
buf
*
xfmt
.
Buffer
)
error
{
return
nil
}
}
const
dumpSummary
=
"dump database transactions"
const
dumpSummary
=
"dump database transactions"
...
@@ -395,7 +400,8 @@ func (d *DumperFsTail) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
...
@@ -395,7 +400,8 @@ func (d *DumperFsTail) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
return
nil
return
nil
}
}
func
(
d
*
DumperFsTail
)
DumpEndOK
(
buf
*
xfmt
.
Buffer
)
{
func
(
d
*
DumperFsTail
)
DumpEndOK
(
buf
*
xfmt
.
Buffer
)
error
{
return
nil
}
}
const
tailSummary
=
"dump last few transactions of a database"
const
tailSummary
=
"dump last few transactions of a database"
...
...
go/zodb/storage/fs1/fs1tools/verify.go
View file @
c864ec80
...
@@ -57,18 +57,25 @@ func Verify(w io.Writer, path string, verbose int, progress bool) (err error) {
...
@@ -57,18 +57,25 @@ func Verify(w io.Writer, path string, verbose int, progress bool) (err error) {
tick
:=
time
.
NewTicker
(
time
.
Second
/
4
)
tick
:=
time
.
NewTicker
(
time
.
Second
/
4
)
defer
tick
.
Stop
()
defer
tick
.
Stop
()
v
.
progress
=
func
(
pos
int64
)
error
{
xcr
:=
""
select
{
if
verbose
>
0
{
case
<-
tick
.
C
:
xcr
=
"
\n
"
default
:
}
return
nil
v
.
progress
=
func
(
force
bool
)
error
{
if
!
force
{
select
{
case
<-
tick
.
C
:
default
:
return
nil
}
}
}
_
,
err
:=
fmt
.
Fprintf
(
w
,
_
,
err
:=
fmt
.
Fprintf
(
w
,
"
\r
Verified data bytes: %.1f%% (%d/%d); #txn: %d"
,
"
\r
Verified data bytes: %.1f%% (%d/%d); #txn: %d%s"
,
100
*
float64
(
pos
)
/
float64
(
fsize
),
100
*
float64
(
v
.
donePos
)
/
float64
(
fsize
),
pos
,
fsize
,
v
.
donePos
,
fsize
,
v
.
ntxn
)
v
.
ntxn
,
xcr
)
return
err
return
err
}
}
}
}
...
@@ -84,7 +91,8 @@ type Verifier struct {
...
@@ -84,7 +91,8 @@ type Verifier struct {
// for loading data
// for loading data
dhLoading
fs1
.
DataHeader
dhLoading
fs1
.
DataHeader
progress
func
(
pos
int64
)
error
donePos
int64
// done verifying till this position
progress
func
(
force
bool
)
error
}
}
func
(
v
*
Verifier
)
DumperName
()
string
{
func
(
v
*
Verifier
)
DumperName
()
string
{
...
@@ -130,7 +138,8 @@ func (v *Verifier) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
...
@@ -130,7 +138,8 @@ func (v *Verifier) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
v
.
ntxn
++
v
.
ntxn
++
if
v
.
progress
!=
nil
{
if
v
.
progress
!=
nil
{
err
:=
v
.
progress
(
txnh
.
Pos
)
v
.
donePos
=
txnh
.
Pos
+
txnh
.
Len
err
:=
v
.
progress
(
/*force=*/
false
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -139,10 +148,17 @@ func (v *Verifier) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
...
@@ -139,10 +148,17 @@ func (v *Verifier) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
return
nil
return
nil
}
}
func
(
v
*
Verifier
)
DumpEndOK
(
buf
*
xfmt
.
Buffer
)
{
func
(
v
*
Verifier
)
DumpEndOK
(
buf
*
xfmt
.
Buffer
)
error
{
if
v
.
progress
!=
nil
{
err
:=
v
.
progress
(
/*force=*/
true
)
if
err
!=
nil
{
return
err
}
}
if
v
.
verbose
>=
1
{
if
v
.
verbose
>=
1
{
buf
.
S
(
"no errors detected
\n
"
)
buf
.
S
(
"no errors detected
\n
"
)
}
}
return
nil
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment