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
Show 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
...
@@ -379,7 +379,7 @@ func (c *Client) Load(ctx context.Context, xid zodb.Xid) (data []byte, serial zo
c
.
node
.
StateMu
.
RUnlock
()
c
.
node
.
StateMu
.
RUnlock
()
if
len
(
storv
)
==
0
{
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
)
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
...
@@ -347,6 +347,7 @@ func (app *NodeApp) UpdateNodeTab(ctx context.Context, msg *NotifyNodeInformatio
// FIXME hack - better it be separate command and handled cleanly
// FIXME hack - better it be separate command and handled cleanly
if
nodeInfo
.
State
==
DOWN
{
if
nodeInfo
.
State
==
DOWN
{
log
.
Info
(
ctx
,
"master told us to shutdown"
)
log
.
Info
(
ctx
,
"master told us to shutdown"
)
log
.
Flush
()
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
}
}
...
...
go/neo/t/t.sh
View file @
b58a6bc1
...
@@ -241,7 +241,7 @@ bench1() {
...
@@ -241,7 +241,7 @@ bench1() {
echo
"(skipping zsha1.go on ZEO -- Cgo does not support zeo:// protocol)"
echo
"(skipping zsha1.go on ZEO -- Cgo does not support zeo:// protocol)"
return
return
fi
fi
go run zsha1.go
$url
go run zsha1.go
--log_dir
=
$log
$url
# TODO zsha1.go -prefetch=1
# TODO zsha1.go -prefetch=1
}
}
...
...
go/neo/t/zsha1.go
View file @
b58a6bc1
...
@@ -6,12 +6,15 @@ package main
...
@@ -6,12 +6,15 @@ package main
import
(
import
(
"context"
"context"
"crypto/sha1"
"crypto/sha1"
"log"
"flag"
"flag"
"fmt"
"fmt"
//"os"
//"os"
"time"
"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"
_
"lab.nexedi.com/kirr/neo/go/zodb/wks"
_
"lab.nexedi.com/kirr/neo/go/zodb/wks"
...
@@ -19,18 +22,32 @@ import (
...
@@ -19,18 +22,32 @@ import (
)
)
func
main
()
{
func
main
()
{
defer
log
.
Flush
()
flag
.
Parse
()
flag
.
Parse
()
url
:=
flag
.
Args
()[
0
]
// XXX dirty
url
:=
flag
.
Args
()[
0
]
// XXX dirty
bg
:=
context
.
Background
()
ctx
:=
context
.
Background
()
stor
,
err
:=
zodb
.
OpenStorageURL
(
bg
,
url
)
err
:=
zsha1
(
ctx
,
url
)
if
err
!=
nil
{
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
{
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 ?
before
:=
lastTid
+
1
// XXX overflow ?
...
@@ -46,14 +63,14 @@ func main() {
...
@@ -46,14 +63,14 @@ func main() {
loop
:
loop
:
for
{
for
{
xid
:=
zodb
.
Xid
{
Oid
:
oid
,
XTid
:
zodb
.
XTid
{
Tid
:
before
,
TidBefore
:
true
}}
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
)
{
switch
err
.
(
type
)
{
case
nil
:
case
nil
:
// ok
// ok
case
*
zodb
.
ErrOidMissing
:
case
*
zodb
.
ErrOidMissing
:
break
loop
break
loop
default
:
default
:
log
.
Fatal
(
err
)
return
err
}
}
m
.
Write
(
data
)
m
.
Write
(
data
)
...
@@ -70,4 +87,6 @@ loop:
...
@@ -70,4 +87,6 @@ loop:
fmt
.
Printf
(
"%x ; oid=0..%d nread=%d t=%s (%s / object) x=zsha1.go
\n
"
,
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 ?
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{}) {
...
@@ -74,6 +74,7 @@ func (d Depth) Warning(ctx context.Context, argv ...interface{}) {
func
(
d
Depth
)
Warningf
(
ctx
context
.
Context
,
format
string
,
argv
...
interface
{})
{
func
(
d
Depth
)
Warningf
(
ctx
context
.
Context
,
format
string
,
argv
...
interface
{})
{
glog
.
WarningDepth
(
int
(
d
+
1
),
withTask
(
ctx
,
fmt
.
Sprintf
(
format
,
argv
...
))
...
)
glog
.
WarningDepth
(
int
(
d
+
1
),
withTask
(
ctx
,
fmt
.
Sprintf
(
format
,
argv
...
))
...
)
}
}
func
(
d
Depth
)
Error
(
ctx
context
.
Context
,
argv
...
interface
{})
{
func
(
d
Depth
)
Error
(
ctx
context
.
Context
,
argv
...
interface
{})
{
glog
.
ErrorDepth
(
int
(
d
+
1
),
withTask
(
ctx
,
argv
...
)
...
)
glog
.
ErrorDepth
(
int
(
d
+
1
),
withTask
(
ctx
,
argv
...
)
...
)
}
}
...
@@ -82,11 +83,19 @@ func (d Depth) Errorf(ctx context.Context, format string, argv ...interface{}) {
...
@@ -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
...
))
...
)
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
Info
(
ctx
context
.
Context
,
argv
...
interface
{})
{
Depth
(
1
)
.
Info
(
ctx
,
argv
...
)
}
func
Warning
(
ctx
context
.
Context
,
argv
...
interface
{})
{
Depth
(
1
)
.
Warning
(
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
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
{})
{
func
Infof
(
ctx
context
.
Context
,
format
string
,
argv
...
interface
{})
{
Depth
(
1
)
.
Infof
(
ctx
,
format
,
argv
...
)
Depth
(
1
)
.
Infof
(
ctx
,
format
,
argv
...
)
...
@@ -99,3 +108,9 @@ func Warningf(ctx context.Context, format string, argv ...interface{}) {
...
@@ -99,3 +108,9 @@ func Warningf(ctx context.Context, format string, argv ...interface{}) {
func
Errorf
(
ctx
context
.
Context
,
format
string
,
argv
...
interface
{})
{
func
Errorf
(
ctx
context
.
Context
,
format
string
,
argv
...
interface
{})
{
Depth
(
1
)
.
Errorf
(
ctx
,
format
,
argv
...
)
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 (
...
@@ -28,6 +28,8 @@ import (
"os"
"os"
"runtime"
"runtime"
"runtime/pprof"
"runtime/pprof"
//"lab.nexedi.com/kirr/neo/go/xcommon/log"
)
)
// Command describes one zodb subcommand
// Command describes one zodb subcommand
...
@@ -109,6 +111,7 @@ func (prog *MainProg) Main() {
...
@@ -109,6 +111,7 @@ func (prog *MainProg) Main() {
defer
func
()
{
defer
func
()
{
r
:=
recover
()
r
:=
recover
()
if
e
,
_
:=
r
.
(
*
programExit
);
e
!=
nil
{
if
e
,
_
:=
r
.
(
*
programExit
);
e
!=
nil
{
// TODO log.Flush()
os
.
Exit
(
e
.
code
)
os
.
Exit
(
e
.
code
)
}
}
if
r
!=
nil
{
if
r
!=
nil
{
...
@@ -275,4 +278,6 @@ const helpOptions =
...
@@ -275,4 +278,6 @@ const helpOptions =
-cpuprofile <file> write cpu profile to <file>
-cpuprofile <file> write cpu profile to <file>
-memprofile <file> write memory 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