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
Xavier Thompson
neoppod
Commits
2dcc079b
Commit
2dcc079b
authored
Jan 04, 2014
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client: do never reconnect to master if already connected
parent
d85b471d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
11 deletions
+9
-11
neo/client/app.py
neo/client/app.py
+9
-10
neo/client/handlers/master.py
neo/client/handlers/master.py
+0
-1
No files found.
neo/client/app.py
View file @
2dcc079b
...
...
@@ -107,11 +107,9 @@ class Application(object):
# _cache_lock is used for the client cache
self
.
_cache_lock_acquire
=
lock
.
acquire
self
.
_cache_lock_release
=
lock
.
release
lock
=
Lock
()
# _connecting_to_master_node is used to prevent simultaneous master
# node connection attemps
self
.
_connecting_to_master_node_acquire
=
lock
.
acquire
self
.
_connecting_to_master_node_release
=
lock
.
release
self
.
_connecting_to_master_node
=
Lock
()
# _nm ensure exclusive access to the node manager
lock
=
Lock
()
self
.
_nm_acquire
=
lock
.
acquire
...
...
@@ -231,15 +229,16 @@ class Application(object):
def
_getMasterConnection
(
self
):
""" Connect to the primary master node on demand """
#
acquire the lock to allow only one thread to connect to the primary
#
For performance reasons, get 'master_conn' without locking.
result
=
self
.
master_conn
if
result
is
None
:
self
.
_connecting_to_master_node_acquire
()
try
:
self
.
new_oid_list
=
[]
result
=
self
.
_connectToPrimaryNode
()
finally
:
self
.
_connecting_to_master_node_release
()
# If not connected, 'master_conn' must be tested again while we have
# the lock, to avoid concurrent threads reconnecting.
with
self
.
_connecting_to_master_node
:
result
=
self
.
master_conn
if
result
is
None
:
self
.
new_oid_list
=
[]
result
=
self
.
master_conn
=
self
.
_connectToPrimaryNode
()
return
result
def
getPartitionTable
(
self
):
...
...
neo/client/handlers/master.py
View file @
2dcc079b
...
...
@@ -80,7 +80,6 @@ class PrimaryBootstrapHandler(AnswerBaseHandler):
# Always create partition table
app
.
pt
=
PartitionTable
(
num_partitions
,
num_replicas
)
app
.
master_conn
=
conn
def
answerPartitionTable
(
self
,
conn
,
ptid
,
row_list
):
assert
row_list
...
...
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