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
b58a6bc1
Commit
b58a6bc1
authored
Sep 06, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ae6f3414
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
10 deletions
+50
-10
go/neo/client/client.go
go/neo/client/client.go
+1
-1
go/neo/neo.go
go/neo/neo.go
+1
-0
go/neo/t/t.sh
go/neo/t/t.sh
+1
-1
go/neo/t/zsha1.go
go/neo/t/zsha1.go
+27
-8
go/xcommon/log/log.go
go/xcommon/log/log.go
+15
-0
go/zodb/zodbtools/driver.go
go/zodb/zodbtools/driver.go
+5
-0
No files found.
go/neo/client/client.go
View file @
b58a6bc1
...
...
@@ -379,7 +379,7 @@ func (c *Client) Load(ctx context.Context, xid zodb.Xid) (data []byte, serial zo
c
.
node
.
StateMu
.
RUnlock
()
if
len
(
storv
)
==
0
{
// XXX recheck it adds traceback to log
// XXX recheck it adds traceback to log
-> XXX it does not -> add our Bugf which always forces +v on such error print
return
nil
,
0
,
errors
.
Errorf
(
"internal inconsistency: cluster is operational, but no storages alive for oid %v"
,
xid
.
Oid
)
}
...
...
go/neo/neo.go
View file @
b58a6bc1
...
...
@@ -347,6 +347,7 @@ func (app *NodeApp) UpdateNodeTab(ctx context.Context, msg *NotifyNodeInformatio
// FIXME hack - better it be separate command and handled cleanly
if
nodeInfo
.
State
==
DOWN
{
log
.
Info
(
ctx
,
"master told us to shutdown"
)
log
.
Flush
()
os
.
Exit
(
1
)
}
}
...
...
go/neo/t/t.sh
View file @
b58a6bc1
...
...
@@ -241,7 +241,7 @@ bench1() {
echo
"(skipping zsha1.go on ZEO -- Cgo does not support zeo:// protocol)"
return
fi
go run zsha1.go
$url
go run zsha1.go
--log_dir
=
$log
$url
# TODO zsha1.go -prefetch=1
}
...
...
go/neo/t/zsha1.go
View file @
b58a6bc1
...
...
@@ -6,12 +6,15 @@ package main
import
(
"context"
"crypto/sha1"
"log"
"flag"
"fmt"
//"os"
"time"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/neo/go/xcommon/log"
"lab.nexedi.com/kirr/neo/go/xcommon/task"
"lab.nexedi.com/kirr/neo/go/zodb"
_
"lab.nexedi.com/kirr/neo/go/zodb/wks"
...
...
@@ -19,18 +22,32 @@ import (
)
func
main
()
{
defer
log
.
Flush
()
flag
.
Parse
()
url
:=
flag
.
Args
()[
0
]
// XXX dirty
bg
:=
context
.
Background
()
stor
,
err
:=
zodb
.
OpenStorageURL
(
bg
,
url
)
ctx
:=
context
.
Background
()
err
:=
zsha1
(
ctx
,
url
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
log
.
Fatal
(
ctx
,
err
)
}
}
lastTid
,
err
:=
stor
.
LastTid
(
bg
)
func
zsha1
(
ctx
context
.
Context
,
url
string
)
(
err
error
)
{
defer
task
.
Running
(
&
ctx
,
"zsha1"
)(
&
err
)
stor
,
err
:=
zodb
.
OpenStorageURL
(
ctx
,
url
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
return
err
}
defer
func
()
{
err2
:=
stor
.
Close
()
err
=
xerr
.
First
(
err
,
err2
)
}()
lastTid
,
err
:=
stor
.
LastTid
(
ctx
)
if
err
!=
nil
{
return
err
}
before
:=
lastTid
+
1
// XXX overflow ?
...
...
@@ -46,14 +63,14 @@ func main() {
loop
:
for
{
xid
:=
zodb
.
Xid
{
Oid
:
oid
,
XTid
:
zodb
.
XTid
{
Tid
:
before
,
TidBefore
:
true
}}
data
,
_
,
err
:=
stor
.
Load
(
bg
,
xid
)
data
,
_
,
err
:=
stor
.
Load
(
ctx
,
xid
)
switch
err
.
(
type
)
{
case
nil
:
// ok
case
*
zodb
.
ErrOidMissing
:
break
loop
default
:
log
.
Fatal
(
err
)
return
err
}
m
.
Write
(
data
)
...
...
@@ -70,4 +87,6 @@ loop:
fmt
.
Printf
(
"%x ; oid=0..%d nread=%d t=%s (%s / object) x=zsha1.go
\n
"
,
m
.
Sum
(
nil
),
oid
-
1
,
nread
,
δt
,
δt
/
time
.
Duration
(
oid
))
// XXX /oid cast ?
return
nil
}
go/xcommon/log/log.go
View file @
b58a6bc1
...
...
@@ -74,6 +74,7 @@ func (d Depth) Warning(ctx context.Context, argv ...interface{}) {
func
(
d
Depth
)
Warningf
(
ctx
context
.
Context
,
format
string
,
argv
...
interface
{})
{
glog
.
WarningDepth
(
int
(
d
+
1
),
withTask
(
ctx
,
fmt
.
Sprintf
(
format
,
argv
...
))
...
)
}
func
(
d
Depth
)
Error
(
ctx
context
.
Context
,
argv
...
interface
{})
{
glog
.
ErrorDepth
(
int
(
d
+
1
),
withTask
(
ctx
,
argv
...
)
...
)
}
...
...
@@ -82,11 +83,19 @@ func (d Depth) Errorf(ctx context.Context, format string, argv ...interface{}) {
glog
.
ErrorDepth
(
int
(
d
+
1
),
withTask
(
ctx
,
fmt
.
Sprintf
(
format
,
argv
...
))
...
)
}
func
(
d
Depth
)
Fatal
(
ctx
context
.
Context
,
argv
...
interface
{})
{
glog
.
FatalDepth
(
int
(
d
+
1
),
withTask
(
ctx
,
argv
...
)
...
)
}
func
(
d
Depth
)
Fatalf
(
ctx
context
.
Context
,
format
string
,
argv
...
interface
{})
{
glog
.
FatalDepth
(
int
(
d
+
1
),
withTask
(
ctx
,
fmt
.
Sprintf
(
format
,
argv
...
))
...
)
}
func
Info
(
ctx
context
.
Context
,
argv
...
interface
{})
{
Depth
(
1
)
.
Info
(
ctx
,
argv
...
)
}
func
Warning
(
ctx
context
.
Context
,
argv
...
interface
{})
{
Depth
(
1
)
.
Warning
(
ctx
,
argv
...
)
}
func
Error
(
ctx
context
.
Context
,
argv
...
interface
{})
{
Depth
(
1
)
.
Error
(
ctx
,
argv
...
)
}
func
Fatal
(
ctx
context
.
Context
,
argv
...
interface
{})
{
Depth
(
1
)
.
Fatal
(
ctx
,
argv
...
)
}
func
Infof
(
ctx
context
.
Context
,
format
string
,
argv
...
interface
{})
{
Depth
(
1
)
.
Infof
(
ctx
,
format
,
argv
...
)
...
...
@@ -99,3 +108,9 @@ func Warningf(ctx context.Context, format string, argv ...interface{}) {
func
Errorf
(
ctx
context
.
Context
,
format
string
,
argv
...
interface
{})
{
Depth
(
1
)
.
Errorf
(
ctx
,
format
,
argv
...
)
}
func
Fatalf
(
ctx
context
.
Context
,
format
string
,
argv
...
interface
{})
{
Depth
(
1
)
.
Fatalf
(
ctx
,
format
,
argv
...
)
}
func
Flush
()
{
glog
.
Flush
()
}
go/zodb/zodbtools/driver.go
View file @
b58a6bc1
...
...
@@ -28,6 +28,8 @@ import (
"os"
"runtime"
"runtime/pprof"
//"lab.nexedi.com/kirr/neo/go/xcommon/log"
)
// Command describes one zodb subcommand
...
...
@@ -109,6 +111,7 @@ func (prog *MainProg) Main() {
defer
func
()
{
r
:=
recover
()
if
e
,
_
:=
r
.
(
*
programExit
);
e
!=
nil
{
// TODO log.Flush()
os
.
Exit
(
e
.
code
)
}
if
r
!=
nil
{
...
...
@@ -275,4 +278,6 @@ const helpOptions =
-cpuprofile <file> write cpu profile to <file>
-memprofile <file> write memory profile to <file>
TODO also document glog options
`
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