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
3b1f7c94
Commit
3b1f7c94
authored
Nov 02, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
50a09046
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
11 deletions
+18
-11
go/zodb/storage/fs1/filestorage.go
go/zodb/storage/fs1/filestorage.go
+14
-7
go/zodb/storage/fs1/fs1tools/dump.go
go/zodb/storage/fs1/fs1tools/dump.go
+1
-1
go/zodb/storage/fs1/fs1tools/index.go
go/zodb/storage/fs1/fs1tools/index.go
+2
-2
go/zodb/storage/fs1/index.go
go/zodb/storage/fs1/index.go
+1
-1
No files found.
go/zodb/storage/fs1/filestorage.go
View file @
3b1f7c94
...
@@ -67,6 +67,7 @@ import (
...
@@ -67,6 +67,7 @@ import (
"context"
"context"
"fmt"
"fmt"
"io"
"io"
"log"
"os"
"os"
"sync"
"sync"
...
@@ -172,19 +173,23 @@ func Open(ctx context.Context, path string) (*FileStorage, error) {
...
@@ -172,19 +173,23 @@ func Open(ctx context.Context, path string) (*FileStorage, error) {
return
nil
,
err
return
nil
,
err
}
}
// TODO recreate index if missing / not sane (cancel this job on ctx.Done)
err
=
fs
.
loadIndex
()
index
,
err
:=
LoadIndexFile
(
path
+
".index"
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
// XXX err
log
.
Print
(
err
)
log
.
Printf
(
"%s: index recompute..."
,
path
)
fs
.
index
,
err
=
fs
.
computeIndex
(
ctx
)
// XXX better .reindex() which saves it?
if
err
!=
nil
{
fs
.
file
.
Close
()
// XXX lclose
return
nil
,
err
}
}
}
// TODO verify index sane / topPos matches
// TODO verify index sane / topPos matches
if
index
.
TopPos
!=
fs
.
txnhMax
.
Pos
+
fs
.
txnhMax
.
Len
{
// XXX place
if
fs
.
index
.
TopPos
!=
fs
.
txnhMax
.
Pos
+
fs
.
txnhMax
.
Len
{
panic
(
"inconsistent index topPos"
)
// XXX
panic
(
"inconsistent index topPos"
)
// XXX
}
}
fs
.
index
=
index
return
fs
,
nil
return
fs
,
nil
}
}
...
@@ -519,14 +524,16 @@ func (fs *FileStorage) Iterate(tidMin, tidMax zodb.Tid) zodb.ITxnIterator {
...
@@ -519,14 +524,16 @@ func (fs *FileStorage) Iterate(tidMin, tidMax zodb.Tid) zodb.ITxnIterator {
// --- rebuilding index ---
// --- rebuilding index ---
func
(
fs
*
FileStorage
)
computeIndex
(
ctx
context
.
Context
)
(
index
*
Index
,
err
error
)
{
func
(
fs
*
FileStorage
)
computeIndex
(
ctx
context
.
Context
)
(
index
*
Index
,
err
error
)
{
// XXX lock?
fsSeq
:=
xbufio
.
NewSeqReaderAt
(
fs
.
file
)
fsSeq
:=
xbufio
.
NewSeqReaderAt
(
fs
.
file
)
return
BuildIndex
(
ctx
,
fsSeq
,
nil
/*XXX no progress*/
)
return
BuildIndex
(
ctx
,
fsSeq
,
nil
/*XXX no progress*/
)
}
}
// loadIndex loads on-disk index to RAM
// loadIndex loads on-disk index to RAM
func
(
fs
*
FileStorage
)
loadIndex
()
(
err
error
)
{
func
(
fs
*
FileStorage
)
loadIndex
()
(
err
error
)
{
// XXX LoadIndexFile already contains "%s: index load"
// XXX lock?
// XXX lock?
defer
xerr
.
Contextf
(
&
err
,
"%s
: index load
"
,
fs
.
file
.
Name
())
defer
xerr
.
Contextf
(
&
err
,
"%s"
,
fs
.
file
.
Name
())
index
,
err
:=
LoadIndexFile
(
fs
.
file
.
Name
()
+
".index"
)
index
,
err
:=
LoadIndexFile
(
fs
.
file
.
Name
()
+
".index"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
go/zodb/storage/fs1/fs1tools/dump.go
View file @
3b1f7c94
...
@@ -301,7 +301,7 @@ Dump transactions from a FileStorage
...
@@ -301,7 +301,7 @@ Dump transactions from a FileStorage
func
dumpMain
(
argv
[]
string
)
{
func
dumpMain
(
argv
[]
string
)
{
var
verbose
bool
var
verbose
bool
flags
:=
flag
.
FlagSet
{
Usage
:
func
()
{
tail
Usage
(
os
.
Stderr
)
}}
flags
:=
flag
.
FlagSet
{
Usage
:
func
()
{
dump
Usage
(
os
.
Stderr
)
}}
flags
.
Init
(
""
,
flag
.
ExitOnError
)
flags
.
Init
(
""
,
flag
.
ExitOnError
)
flags
.
BoolVar
(
&
verbose
,
"v"
,
verbose
,
"verbose mode"
)
flags
.
BoolVar
(
&
verbose
,
"v"
,
verbose
,
"verbose mode"
)
flags
.
Parse
(
argv
[
1
:
])
flags
.
Parse
(
argv
[
1
:
])
...
...
go/zodb/storage/fs1/fs1tools/index.go
View file @
3b1f7c94
...
@@ -117,7 +117,7 @@ func reindexMain(argv []string) {
...
@@ -117,7 +117,7 @@ func reindexMain(argv []string) {
err
=
Reindex
(
context
.
Background
(),
storPath
,
progress
)
err
=
Reindex
(
context
.
Background
(),
storPath
,
progress
)
if
!
quiet
{
if
!
quiet
&&
lastp
!=
nil
{
// (re-)display last update in case no progress was displayed so far
// (re-)display last update in case no progress was displayed so far
display
(
lastp
)
display
(
lastp
)
fmt
.
Println
()
fmt
.
Println
()
...
@@ -218,7 +218,7 @@ func verifyIdxMain(argv []string) {
...
@@ -218,7 +218,7 @@ func verifyIdxMain(argv []string) {
err
:=
VerifyIndexFor
(
context
.
Background
(),
storPath
,
ntxn
,
progress
)
err
:=
VerifyIndexFor
(
context
.
Background
(),
storPath
,
ntxn
,
progress
)
if
!
quiet
{
if
!
quiet
&&
lastp
!=
nil
{
// (re-)display last update in case no progress was displayed so far
// (re-)display last update in case no progress was displayed so far
display
(
lastp
)
display
(
lastp
)
fmt
.
Println
()
fmt
.
Println
()
...
...
go/zodb/storage/fs1/index.go
View file @
3b1f7c94
...
@@ -215,7 +215,7 @@ type IndexLoadError struct {
...
@@ -215,7 +215,7 @@ type IndexLoadError struct {
func
(
e
*
IndexLoadError
)
Error
()
string
{
func
(
e
*
IndexLoadError
)
Error
()
string
{
s
:=
"index load: "
s
:=
"index load: "
if
e
.
Filename
!=
""
{
if
e
.
Filename
!=
""
&&
e
.
Pos
!=
-
1
/* not yet got to decoding - .Err is ~ os.PathError */
{
s
+=
e
.
Filename
+
": "
s
+=
e
.
Filename
+
": "
}
}
if
e
.
Pos
!=
-
1
{
if
e
.
Pos
!=
-
1
{
...
...
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