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
e87de948
Commit
e87de948
authored
Aug 30, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0e6a7bb5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
14 deletions
+35
-14
go/neo/client/client.go
go/neo/client/client.go
+30
-11
go/neo/neo.go
go/neo/neo.go
+2
-2
go/neo/proto.go
go/neo/proto.go
+0
-1
go/neo/server/storage.go
go/neo/server/storage.go
+3
-0
No files found.
go/neo/client/client.go
View file @
e87de948
...
...
@@ -255,33 +255,51 @@ func (c *Client) recvMaster(ctx context.Context, mlink *neo.NodeLink) error {
return
err
}
c
.
opMu
.
Lock
()
switch
msg
:=
req
.
Msg
.
(
type
)
{
default
:
c
.
opMu
.
Unlock
()
return
fmt
.
Errorf
(
"unexpected message: %T"
,
msg
)
// M sends whole PT
case
*
neo
.
NotifyPartitionTable
:
// XXX lock
// XXX update operational
pt
:=
neo
.
PartTabFromDump
(
msg
.
PTid
,
msg
.
RowList
)
c
.
node
.
PartTab
=
pt
// M sends δPT
//case *neo.NotifyPartitionChanges:
// TODO
case
*
neo
.
NotifyNodeInformation
:
// XXX lock
// XXX update operational
// XXX msg.IdTimestamp ?
for
_
,
nodeInfo
:=
range
msg
.
NodeList
{
c
.
node
.
NodeTab
.
Update
(
nodeInfo
,
/*XXX conn should not be here*/
nil
)
}
case
*
neo
.
NotifyClusterState
:
// XXX lock
// XXX update operational
c
.
node
.
ClusterState
.
Set
(
msg
.
State
)
}
// update .operational + notify those who was waiting for it
operational
:=
c
.
node
.
ClusterState
==
neo
.
ClusterRunning
&&
c
.
node
.
PartTab
.
OperationalWith
(
c
.
node
.
NodeTab
)
var
opready
chan
struct
{}
if
operational
!=
c
.
operational
{
c
.
operational
=
operational
if
operational
{
opready
=
c
.
opReady
// don't close from under opMu
}
else
{
c
.
opReady
=
make
(
chan
struct
{})
}
}
c
.
opMu
.
Unlock
()
if
opready
!=
nil
{
close
(
opready
)
}
}
}
...
...
@@ -293,13 +311,13 @@ func (c *Client) initFromMaster(ctx context.Context, Mlink *neo.NodeLink) error
return
err
}
// XXX lock
pt
:=
neo
.
PartTabFromDump
(
rpt
.
PTid
,
rpt
.
RowList
)
// XXX pt -> c.node.PartTab ?
_
=
pt
c
.
opMu
.
Lock
()
c
.
node
.
PartTab
=
pt
c
.
opMu
.
Unlock
()
/*
XXX don't need in init?
XXX don't need
this
in init?
// ask M about last_tid
rlastTxn := neo.AnswerLastTransaction{}
...
...
@@ -323,6 +341,7 @@ func (c *Client) initFromMaster(ctx context.Context, Mlink *neo.NodeLink) error
func
(
c
*
Client
)
LastTid
(
ctx
context
.
Context
)
(
_
zodb
.
Tid
,
err
error
)
{
defer
xerr
.
Context
(
&
err
,
"client: lastTid"
)
// XXX or require full withOperational ?
mlink
,
err
:=
c
.
masterLink
(
ctx
)
if
err
!=
nil
{
return
0
,
err
...
...
go/neo/neo.go
View file @
e87de948
...
...
@@ -57,8 +57,8 @@ type NodeCommon struct {
Net
xnet
.
Networker
// network AP we are sending/receiving on
MasterAddr
string
// address of master XXX -> Address ?
NodeTab
NodeTable
// information about nodes in the cluster
PartTab
PartitionTable
// information about data distribution in the cluster
NodeTab
*
NodeTable
// information about nodes in the cluster
PartTab
*
PartitionTable
// information about data distribution in the cluster
ClusterState
ClusterState
// master idea about cluster state
}
...
...
go/neo/proto.go
View file @
e87de948
...
...
@@ -332,7 +332,6 @@ type AnswerPartitionTable struct {
RowList
[]
RowInfo
}
// Send whole partition table to update other nodes. PM -> S, C.
// XXX py: named also as SendPartitionTable
type
NotifyPartitionTable
struct
{
...
...
go/neo/server/storage.go
View file @
e87de948
...
...
@@ -73,6 +73,9 @@ func NewStorage(cluster, masterAddr, serveAddr string, net xnet.Networker, zstor
ClusterName
:
cluster
,
Net
:
net
,
MasterAddr
:
masterAddr
,
PartTab
:
&
neo
.
PartitionTable
{},
// empty - TODO read from disk
NodeTab
:
&
neo
.
NodeTable
{},
},
zstor
:
zstor
,
...
...
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