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
0afec249
Commit
0afec249
authored
May 21, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1cc74a85
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
3 deletions
+61
-3
go/NOTES
go/NOTES
+1
-1
go/neo/master.go
go/neo/master.go
+50
-1
go/neo/nodetab.go
go/neo/nodetab.go
+5
-0
go/neo/parttab.go
go/neo/parttab.go
+3
-1
go/neo/server.go
go/neo/server.go
+2
-0
No files found.
go/NOTES
View file @
0afec249
...
@@ -146,7 +146,7 @@ HasLock C -> S
...
@@ -146,7 +146,7 @@ HasLock C -> S
AnswerHasLock S -> C
AnswerHasLock S -> C
oid OID
oid OID
lock_state LockState // not_locket, granted, granted_to_other
:w
lock_state LockState // not_locket, granted, granted_to_other
CheckCurrentSerial C -> S AnswerCheckCurrentSerial S -> C
CheckCurrentSerial C -> S AnswerCheckCurrentSerial S -> C
tid TID conflicting bool
tid TID conflicting bool
...
...
go/neo/master.go
View file @
0afec249
...
@@ -41,6 +41,7 @@ type Master struct {
...
@@ -41,6 +41,7 @@ type Master struct {
func
NewMaster
(
clusterName
string
)
*
Master
{
func
NewMaster
(
clusterName
string
)
*
Master
{
m
:=
&
Master
{
clusterName
:
clusterName
}
m
:=
&
Master
{
clusterName
:
clusterName
}
m
.
SetClusterState
(
RECOVERING
)
// XXX no elections - we are the only master
m
.
SetClusterState
(
RECOVERING
)
// XXX no elections - we are the only master
return
m
return
m
}
}
...
@@ -75,6 +76,7 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) {
...
@@ -75,6 +76,7 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) {
}()
}()
// identify
// identify
// XXX add logic to verify/assign nodeID and do other requested identification checks
nodeInfo
,
err
:=
IdentifyPeer
(
link
,
MASTER
)
nodeInfo
,
err
:=
IdentifyPeer
(
link
,
MASTER
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Printf
(
"master: %v
\n
"
,
err
)
fmt
.
Printf
(
"master: %v
\n
"
,
err
)
...
@@ -86,12 +88,59 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) {
...
@@ -86,12 +88,59 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) {
m
.
nodeTab
.
Add
(
&
Node
{
nodeInfo
,
link
})
m
.
nodeTab
.
Add
(
&
Node
{
nodeInfo
,
link
})
m
.
nodeTab
.
Unlock
()
m
.
nodeTab
.
Unlock
()
// TODO subscribe to nodeTab and broadcast updates
// TODO subscribe to nodeTab and broadcast updates:
//
// NotifyPartitionTable PM -> S, C
// PartitionChanges PM -> S, C // subset of NotifyPartitionTable (?)
// NotifyNodeIntormation PM -> *
// TODO notify about cluster state changes
// ClusterInformation (PM -> * ?)
// identification passed, now serve other requests
// identification passed, now serve other requests
// client: notify + serve requests
// client: notify + serve requests
// storage: notify + ?
// storage: notify + ?
//
// >Recovery
// <AnswerRecovery
//
// >PartitionTable
// <AnswerPartitionTable
//
// # neoctl start
// # (via changing nodeTab and relying on broadcast distribution ?)
// >NotifyNodeInformation (S1.state=RUNNING)
// # S: "I was told I'm RUNNING"
//
// # (via changing m.clusterState and relying on broadcast ?)
// >NotifyClusterInformation (cluster_state=VERIFYING)
//
// # (via changing partTab and relying on broadcast ?)
// >NotifyPartitionTable (ptid=1, `node 0: S1, R`)
// # S saves PT info locally
//
// # M asks about unfinished transactions
// >AskLockedTransactions
// <AnswerLockedTransactions {} ttid -> tid # in example we have empty
//
// >LastIDs
// <AnswerLastIDs (last_oid, last_tid)
//
// # (via changing m.clusterState and relying on broadcast ?)
// >NotifyClusterInformation (cluster_state=RUNNING)
//
// >StartOperation
// <NotifyReady
// XXX only here we can update nodeTab with S1.state=RUNNING
//
// ...
//
// StopOperation PM -> S
}
}
...
...
go/neo/nodetab.go
View file @
0afec249
...
@@ -27,6 +27,8 @@ import (
...
@@ -27,6 +27,8 @@ import (
// Usually Master maintains such table and provides it to other nodes to know
// Usually Master maintains such table and provides it to other nodes to know
// each other but in general use-cases can be different.
// each other but in general use-cases can be different.
//
//
// XXX vvv is about Master=main use-case:
//
// - Primary Master view of cluster
// - Primary Master view of cluster
// - M tracks changes to nodeTab as nodes appear (connected to M) and go (disconnected from M)
// - M tracks changes to nodeTab as nodes appear (connected to M) and go (disconnected from M)
// - M regularly broadcasts nodeTab content updates(?) to all nodes
// - M regularly broadcasts nodeTab content updates(?) to all nodes
...
@@ -59,6 +61,7 @@ import (
...
@@ -59,6 +61,7 @@ import (
// sure not to accept new connections -> XXX not needed - just stop listening
// sure not to accept new connections -> XXX not needed - just stop listening
// first.
// first.
//
//
// NodeTable zero value is valid empty node table.
type
NodeTable
struct
{
type
NodeTable
struct
{
// users have to care locking explicitly
// users have to care locking explicitly
sync
.
RWMutex
sync
.
RWMutex
...
@@ -88,6 +91,8 @@ func (nt *NodeTable) Add(node *Node) {
...
@@ -88,6 +91,8 @@ func (nt *NodeTable) Add(node *Node) {
// XXX check node is already there
// XXX check node is already there
// XXX pass/store node by pointer ?
// XXX pass/store node by pointer ?
nt
.
nodev
=
append
(
nt
.
nodev
,
*
node
)
nt
.
nodev
=
append
(
nt
.
nodev
,
*
node
)
// TODO notify all nodelink subscribers about new info
}
}
// TODO subscribe for changes on Add ? (notification via channel)
// TODO subscribe for changes on Add ? (notification via channel)
...
...
go/neo/parttab.go
View file @
0afec249
...
@@ -29,7 +29,7 @@ package neo
...
@@ -29,7 +29,7 @@ package neo
//
//
// Oid space is divided (partitioned) into Np parts via
// Oid space is divided (partitioned) into Np parts via
//
//
// ptid(oid) = oid % Np
// ptid(oid) = oid % Np
XXX ptid -> pid ?
//
//
// rule. The `oid % Np` is known as partition identifier of oid.
// rule. The `oid % Np` is known as partition identifier of oid.
//
//
...
@@ -102,6 +102,8 @@ package neo
...
@@ -102,6 +102,8 @@ package neo
// Usually Master maintains partition table, plans partition updates and tells
// Usually Master maintains partition table, plans partition updates and tells
// storages to executed them, and broadcasts partition table updates to all
// storages to executed them, and broadcasts partition table updates to all
// nodes in the cluster.
// nodes in the cluster.
//
// PartitionTable zero value is valid empty partition table.
type
PartitionTable
struct
{
type
PartitionTable
struct
{
// XXX do we need sync.Mutex here for updates ?
// XXX do we need sync.Mutex here for updates ?
...
...
go/neo/server.go
View file @
0afec249
...
@@ -135,6 +135,8 @@ func IdentifyPeer(link *NodeLink, myNodeType NodeType) (nodeInfo RequestIdentifi
...
@@ -135,6 +135,8 @@ func IdentifyPeer(link *NodeLink, myNodeType NodeType) (nodeInfo RequestIdentifi
case
*
RequestIdentification
:
case
*
RequestIdentification
:
// TODO (.NodeType, .UUID, .Address, .Name, .IdTimestamp) -> check + register to NM
// TODO (.NodeType, .UUID, .Address, .Name, .IdTimestamp) -> check + register to NM
// TODO hook here in logic to check identification request, assign nodeID etc
err
=
EncodeAndSend
(
conn
,
&
AcceptIdentification
{
err
=
EncodeAndSend
(
conn
,
&
AcceptIdentification
{
NodeType
:
myNodeType
,
NodeType
:
myNodeType
,
MyNodeID
:
0
,
// XXX
MyNodeID
:
0
,
// XXX
...
...
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