Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
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 {
DumpTxn
(
buf
*
xfmt
.
Buffer
,
it
*
fs1
.
Iter
)
error
// 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.
...
...
@@ -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
}
...
...
@@ -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
...
...
@@ -290,7 +294,8 @@ func (d *DumperFsDumpVerbose) dumpData(buf *xfmt.Buffer, it *fs1.Iter) error {
return
nil
}
func
(
d
*
DumperFsDumpVerbose
)
DumpEndOK
(
buf
*
xfmt
.
Buffer
)
{
func
(
d
*
DumperFsDumpVerbose
)
DumpEndOK
(
buf
*
xfmt
.
Buffer
)
error
{
return
nil
}
const
dumpSummary
=
"dump database transactions"
...
...
@@ -395,7 +400,8 @@ func (d *DumperFsTail) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
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"
...
...
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) {
tick
:=
time
.
NewTicker
(
time
.
Second
/
4
)
defer
tick
.
Stop
()
v
.
progress
=
func
(
pos
int64
)
error
{
select
{
case
<-
tick
.
C
:
default
:
return
nil
xcr
:=
""
if
verbose
>
0
{
xcr
=
"
\n
"
}
v
.
progress
=
func
(
force
bool
)
error
{
if
!
force
{
select
{
case
<-
tick
.
C
:
default
:
return
nil
}
}
_
,
err
:=
fmt
.
Fprintf
(
w
,
"
\r
Verified data bytes: %.1f%% (%d/%d); #txn: %d"
,
100
*
float64
(
pos
)
/
float64
(
fsize
),
pos
,
fsize
,
v
.
ntxn
)
"
\r
Verified data bytes: %.1f%% (%d/%d); #txn: %d%s"
,
100
*
float64
(
v
.
donePos
)
/
float64
(
fsize
),
v
.
donePos
,
fsize
,
v
.
ntxn
,
xcr
)
return
err
}
}
...
...
@@ -84,7 +91,8 @@ type Verifier struct {
// for loading data
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
{
...
...
@@ -130,7 +138,8 @@ func (v *Verifier) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
v
.
ntxn
++
if
v
.
progress
!=
nil
{
err
:=
v
.
progress
(
txnh
.
Pos
)
v
.
donePos
=
txnh
.
Pos
+
txnh
.
Len
err
:=
v
.
progress
(
/*force=*/
false
)
if
err
!=
nil
{
return
err
}
...
...
@@ -139,10 +148,17 @@ func (v *Verifier) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
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
{
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