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
e420f6f4
Commit
e420f6f4
authored
3 years ago
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
503c59b9
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
12 deletions
+11
-12
go/neo/client.go
go/neo/client.go
+9
-10
go/neo/proto/error.go
go/neo/proto/error.go
+1
-1
go/neo/proto/proto.go
go/neo/proto/proto.go
+1
-1
No files found.
go/neo/client.go
View file @
e420f6f4
...
...
@@ -205,7 +205,7 @@ func (c *Client) invalidateObjects(msg *proto.InvalidateObjects) error {
// syncMaster asks M for DB head right after identification.
func
(
c
*
Client
)
syncMaster
(
ctx
context
.
Context
,
mlink
*
_MasterLink
)
(
err
error
)
{
defer
task
.
Running
(
&
ctx
,
"sync0"
)(
&
err
)
//
XXX unify with Sync ?
defer
task
.
Running
(
&
ctx
,
"sync0"
)(
&
err
)
//
TODO try to unify with Sync
// query last_tid
lastTxn
:=
proto
.
AnswerLastTransaction
{}
...
...
@@ -262,7 +262,7 @@ func (c *Client) flushEventq0() {
// Sync implements zodb.IStorageDriver.
func
(
c
*
Client
)
Sync
(
ctx
context
.
Context
)
(
head
zodb
.
Tid
,
err
error
)
{
ctx
=
taskctx
.
Runningf
(
ctx
,
"%s: zsync"
,
c
.
node
.
MyInfo
.
NID
)
ctx
=
taskctx
.
Runningf
(
ctx
,
"%s: zsync"
,
c
.
node
.
MyInfo
.
NID
)
// XXX mynid locking
if
glog
.
V
(
2
)
{
task
.
TraceBegin
(
ctx
)
defer
func
()
{
task
.
TraceEnd
(
ctx
,
err
)
}()
...
...
@@ -277,10 +277,9 @@ func (c *Client) Sync(ctx context.Context) (head zodb.Tid, err error) {
// XXX mlink can become down while we are making the call.
// XXX do we want to return error or retry?
reply
:=
proto
.
AnswerLastTransaction
{}
err
=
mlink
.
Ask1
(
&
proto
.
LastTransaction
{},
&
reply
)
// XXX
Ask += ctx
err
=
mlink
.
Ask1
(
&
proto
.
LastTransaction
{},
&
reply
)
// XXX
ctx cancel
if
err
!=
nil
{
// XXX ZODBErrDecode?
return
err
return
err
// NOTE no need for ZODBErrDecode
}
head
=
reply
.
Tid
return
nil
...
...
@@ -290,7 +289,7 @@ func (c *Client) Sync(ctx context.Context) (head zodb.Tid, err error) {
// Load implements zodb.IStorageDriver.
func
(
c
*
Client
)
Load
(
ctx
context
.
Context
,
xid
zodb
.
Xid
)
(
buf
*
mem
.
Buf
,
serial
zodb
.
Tid
,
err
error
)
{
ctx
=
taskctx
.
Runningf
(
ctx
,
"%s: zload %s"
,
c
.
node
.
MyInfo
.
NID
,
xid
)
// XXX nid locking
ctx
=
taskctx
.
Runningf
(
ctx
,
"%s: zload %s"
,
c
.
node
.
MyInfo
.
NID
,
xid
)
// XXX
my
nid locking
if
glog
.
V
(
2
)
{
task
.
TraceBegin
(
ctx
)
defer
func
()
{
task
.
TraceEnd
(
ctx
,
err
)
}()
...
...
@@ -324,9 +323,9 @@ func (c *Client) Load(ctx context.Context, xid zodb.Xid) (buf *mem.Buf, serial z
return
nil
,
0
,
errors
.
Errorf
(
"internal inconsistency: cluster is operational, but no storages alive for oid %s"
,
xid
.
Oid
)
}
//
XXX vvv temp stub -> TODO pick up 3 random storages and send load
//
requests to them all, getting the first who is the fastest to reply;
//
retry from the beginning if all are found to fail?
//
TODO pick up 3 random storages and send load requests to them all,
//
getting the first who is the fastest to reply; retry from the
//
beginning if all are found to fail.
stor
:=
storv
[
rand
.
Intn
(
len
(
storv
))]
slink
,
err
:=
stor
.
Dial
(
ctx
)
...
...
@@ -335,7 +334,7 @@ func (c *Client) Load(ctx context.Context, xid zodb.Xid) (buf *mem.Buf, serial z
}
// close accept after dialed (not to deadlock if S decides to send us
// something).
slink
.
CloseAccept
()
//
XXX
need to close only after first real dial
slink
.
CloseAccept
()
//
NOTE
need to close only after first real dial
// on the wire it comes as "before", not "at"
req
:=
proto
.
GetObject
{
...
...
This diff is collapsed.
Click to expand it.
go/neo/proto/error.go
View file @
e420f6f4
...
...
@@ -35,7 +35,7 @@ import (
// receiver side they can be recreated with ErrDecode. If err is zodb.OpError,
// only its inner cause is encoded.
//
// If err is not ZODB error -> it is
i
ncoded as "503".
// If err is not ZODB error -> it is
e
ncoded as "503".
func
ZODBErrEncode
(
err
error
)
*
Error
{
e
,
ok
:=
err
.
(
*
zodb
.
OpError
)
if
ok
{
...
...
This diff is collapsed.
Click to expand it.
go/neo/proto/proto.go
View file @
e420f6f4
...
...
@@ -442,7 +442,7 @@ type Pong struct{}
type
CloseClient
struct
{
}
// Ask node identier of the current primary master.
// Ask node identi
fi
er of the current primary master.
//
//neo:nodes ctl -> A
type
PrimaryMaster
struct
{
...
...
This diff is collapsed.
Click to expand it.
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