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
719d8005
Commit
719d8005
authored
Jul 31, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
bae83b63
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
4 deletions
+31
-4
go/zodb/storage/fs1/fs1tools/index.go
go/zodb/storage/fs1/fs1tools/index.go
+31
-4
No files found.
go/zodb/storage/fs1/fs1tools/index.go
View file @
719d8005
...
...
@@ -25,6 +25,7 @@ import (
"fmt"
"io"
"os"
"time"
"lab.nexedi.com/kirr/neo/go/zodb/storage/fs1"
zt
"lab.nexedi.com/kirr/neo/go/zodb/zodbtools"
...
...
@@ -82,23 +83,46 @@ func reindexMain(argv []string) {
}
// progress display
progress
:=
func
(
p
*
fs1
.
IndexUpdateProgress
)
{
display
:=
func
(
p
*
fs1
.
IndexUpdateProgress
)
{
topPos
:=
p
.
TopPos
if
topPos
==
-
1
{
topPos
=
fi
.
Size
()
}
fmt
.
Printf
(
"
Indexed data bytes: %.1f%% (%d/%d); #txn: %d, #oid: %d
\n
"
,
fmt
.
Printf
(
"
\r
Indexed data bytes: %.1f%% (%d/%d); #txn: %d, #oid: %d
"
,
100
*
float64
(
p
.
Index
.
TopPos
)
/
float64
(
topPos
),
p
.
Index
.
TopPos
,
topPos
,
p
.
TxnIndexed
,
p
.
Index
.
Len
())
}
// display updates once per tick
tick
:=
time
.
NewTicker
(
time
.
Second
/
4
)
defer
tick
.
Stop
()
var
lastp
*
fs1
.
IndexUpdateProgress
progress
:=
func
(
p
*
fs1
.
IndexUpdateProgress
)
{
lastp
=
p
select
{
case
<-
tick
.
C
:
default
:
return
}
display
(
p
)
}
if
quiet
{
progress
=
nil
}
err
=
Reindex
(
context
.
Background
(),
storPath
,
progress
)
if
!
quiet
{
// (re-)display last update in case no progress was displayed so far
display
(
lastp
)
fmt
.
Println
()
}
if
err
!=
nil
{
zt
.
Fatal
(
err
)
}
...
...
@@ -161,12 +185,12 @@ func verifyIdxMain(argv []string) {
if
p
.
TxnTotal
==
-
1
{
bytesChecked
:=
p
.
Index
.
TopPos
-
p
.
Iter
.
Txnh
.
Pos
bytesAll
:=
p
.
Index
.
TopPos
fmt
.
Printf
(
"
Checked data bytes: %.1f%% (%d/%d); #txn: %d, #oid: %d
\n
"
,
fmt
.
Printf
(
"
\r
Checked data bytes: %.1f%% (%d/%d); #txn: %d, #oid: %d
"
,
100
*
float64
(
bytesChecked
)
/
float64
(
bytesAll
),
bytesChecked
,
bytesAll
,
p
.
TxnChecked
,
len
(
p
.
OidChecked
))
}
else
{
fmt
.
Printf
(
"
Checked data transactions: %.1f%% (%d/%d); #oid: %d
\n
"
,
fmt
.
Printf
(
"
\r
Checked data transactions: %.1f%% (%d/%d); #oid: %d
"
,
100
*
float64
(
p
.
TxnChecked
)
/
float64
(
p
.
TxnTotal
),
p
.
TxnChecked
,
p
.
TxnTotal
,
len
(
p
.
OidChecked
))
}
...
...
@@ -177,6 +201,9 @@ func verifyIdxMain(argv []string) {
}
err
:=
VerifyIndexFor
(
context
.
Background
(),
storPath
,
ntxn
,
progress
)
if
!
quiet
{
fmt
.
Println
()
}
if
err
!=
nil
{
zt
.
Fatal
(
err
)
}
...
...
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