Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dgraph
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
dgraph
Commits
b2ee1f74
Unverified
Commit
b2ee1f74
authored
7 years ago
by
Pawan Rawal
Browse files
Options
Downloads
Patches
Plain Diff
Dont log.Fatal while joining peers. Retry indefinitely.
parent
2c63353d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
posting/lists.go
+4
-1
4 additions, 1 deletion
posting/lists.go
worker/draft.go
+13
-13
13 additions, 13 deletions
worker/draft.go
with
17 additions
and
14 deletions
posting/lists.go
+
4
−
1
View file @
b2ee1f74
...
...
@@ -251,6 +251,9 @@ func Get(key []byte) (rlist *List, err error) {
// Any initialization for l must be done before PutIfMissing. Once it's added
// to the map, any other goroutine can retrieve it.
l
,
err
:=
getNew
(
key
,
pstore
)
if
err
!=
nil
{
return
nil
,
err
}
// We are always going to return lp to caller, whether it is l or not
lp
=
lcache
.
PutIfMissing
(
string
(
key
),
l
)
if
lp
!=
l
{
...
...
@@ -258,7 +261,7 @@ func Get(key []byte) (rlist *List, err error) {
}
else
if
atomic
.
LoadInt32
(
&
l
.
onDisk
)
==
0
{
btree
.
Insert
(
l
.
key
)
}
return
lp
,
err
return
lp
,
nil
}
// GetLru checks the lru map and returns it if it exits
...
...
This diff is collapsed.
Click to expand it.
worker/draft.go
+
13
−
13
View file @
b2ee1f74
...
...
@@ -622,31 +622,25 @@ func (n *node) snapshot(skip uint64) {
x
.
Check
(
n
.
Wal
.
StoreSnapshot
(
n
.
gid
,
s
))
}
func
(
n
*
node
)
joinPeers
()
{
func
(
n
*
node
)
joinPeers
()
error
{
// Get leader information for MY group.
pl
:=
groups
()
.
Leader
(
n
.
gid
)
if
pl
==
nil
{
x
.
Fatal
f
(
"Unable to reach leader or any other server in group %d"
,
n
.
gid
)
return
x
.
Error
f
(
"Unable to reach leader or any other server in group %d"
,
n
.
gid
)
}
// Bring the instance up to speed first.
// Raft would decide whether snapshot needs to fetched or not
// so populateShard is not needed
// _, err := populateShard(n.ctx, pool, n.gid)
// x.Checkf(err, "Error while populating shard")
gconn
:=
pl
.
Get
()
c
:=
intern
.
NewRaftClient
(
gconn
)
x
.
Printf
(
"Calling JoinCluster"
)
ctx
,
cancel
:=
context
.
WithTimeout
(
n
.
ctx
,
time
.
Second
)
defer
cancel
()
// JoinCluster can block indefinitely, raft ignores conf change proposal
// if it has pending configuration.
_
,
err
:=
c
.
JoinCluster
(
ctx
,
n
.
RaftContext
)
// TODO: This should keep on indefinitely trying to join the cluster, instead of crashing.
x
.
Checkf
(
err
,
"Error while joining cluster"
)
if
_
,
err
:=
c
.
JoinCluster
(
ctx
,
n
.
RaftContext
)
;
err
!=
nil
{
return
x
.
Errorf
(
"Error while joining cluster: %+v
\n
"
,
err
)
}
x
.
Printf
(
"Done with JoinCluster call
\n
"
)
return
nil
}
// InitAndStartNode gets called after having at least one membership sync with the cluster.
...
...
@@ -680,7 +674,13 @@ func (n *node) InitAndStartNode(wal *raftwal.Wal) {
count
++
time
.
Sleep
(
time
.
Second
)
}
n
.
joinPeers
()
for
{
if
err
:=
n
.
joinPeers
();
err
==
nil
{
break
}
x
.
Printf
(
"Error while joining peers: %+v. Retrying...
\n
"
,
err
)
time
.
Sleep
(
time
.
Second
)
}
n
.
SetRaft
(
raft
.
StartNode
(
n
.
Cfg
,
nil
))
}
else
{
peers
:=
[]
raft
.
Peer
{{
ID
:
n
.
Id
}}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment