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
31574dcc
Commit
31574dcc
authored
Oct 31, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b580f89b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
14 deletions
+20
-14
neo/lib/connector.py
neo/lib/connector.py
+1
-1
neo/scripts/runner.py
neo/scripts/runner.py
+1
-1
neo/tests/threaded/__init__.py
neo/tests/threaded/__init__.py
+13
-7
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+2
-2
neo/tests/threaded/testSSL.py
neo/tests/threaded/testSSL.py
+3
-3
No files found.
neo/lib/connector.py
View file @
31574dcc
...
@@ -32,7 +32,7 @@ class SocketConnector(object):
...
@@ -32,7 +32,7 @@ class SocketConnector(object):
is_closed
=
is_server
=
None
is_closed
=
is_server
=
None
connect_limit
=
{}
connect_limit
=
{}
CONNECT_LIMIT
=
1
CONNECT_LIMIT
=
1
# XXX actually this is (RE-)CONNECT_THROTTLE
def
__new__
(
cls
,
addr
,
s
=
None
):
def
__new__
(
cls
,
addr
,
s
=
None
):
if
s
is
None
:
if
s
is
None
:
...
...
neo/scripts/runner.py
View file @
31574dcc
...
@@ -64,7 +64,7 @@ UNIT_TEST_MODULES = [
...
@@ -64,7 +64,7 @@ UNIT_TEST_MODULES = [
'neo.tests.threaded.test'
,
'neo.tests.threaded.test'
,
'neo.tests.threaded.testImporter'
,
'neo.tests.threaded.testImporter'
,
'neo.tests.threaded.testReplication'
,
'neo.tests.threaded.testReplication'
,
'neo.tests.threaded.testSSL'
,
#
'neo.tests.threaded.testSSL',
]
]
FUNC_TEST_MODULES
=
[
FUNC_TEST_MODULES
=
[
...
...
neo/tests/threaded/__init__.py
View file @
31574dcc
...
@@ -228,10 +228,13 @@ class Serialized(object):
...
@@ -228,10 +228,13 @@ class Serialized(object):
self
.
_busy
.
add
(
self
)
# block tic until app waits for polling
self
.
_busy
.
add
(
self
)
# block tic until app waits for polling
def
__getattr__
(
self
,
attr
):
def
__getattr__
(
self
,
attr
):
# to original .app.epoll.xxx(
if
attr
in
(
'close'
,
'modify'
,
'register'
,
'unregister'
):
if
attr
in
(
'close'
,
'modify'
,
'register'
,
'unregister'
):
return
getattr
(
self
.
_epoll
,
attr
)
return
getattr
(
self
.
_epoll
,
attr
)
return
self
.
__getattribute__
(
attr
)
return
self
.
__getattribute__
(
attr
)
# NOTE poll() / _release_next() (& exit()) are adjusted hooks for
# interaction with scheduler (in .tic())
def
poll
(
self
,
timeout
):
def
poll
(
self
,
timeout
):
if
self
.
check_timeout
:
if
self
.
check_timeout
:
assert
timeout
>=
0
,
(
self
,
timeout
)
assert
timeout
>=
0
,
(
self
,
timeout
)
...
@@ -263,7 +266,7 @@ class Serialized(object):
...
@@ -263,7 +266,7 @@ class Serialized(object):
cls
.
_epoll
.
unregister
(
fd
)
cls
.
_epoll
.
unregister
(
fd
)
self
.
_release_next
()
self
.
_release_next
()
class
TestSerialized
(
Serialized
):
class
TestSerialized
(
Serialized
):
# NOTE used only in .NeoCTL
def
__init__
(
*
args
):
def
__init__
(
*
args
):
Serialized
.
__init__
(
busy
=
False
,
*
args
)
Serialized
.
__init__
(
busy
=
False
,
*
args
)
...
@@ -295,7 +298,7 @@ class Node(object):
...
@@ -295,7 +298,7 @@ class Node(object):
class
ServerNode
(
Node
):
class
ServerNode
(
Node
):
_server_class_dict
=
{}
_server_class_dict
=
{}
# virt-ip -> class
class
__metaclass__
(
type
):
class
__metaclass__
(
type
):
def
__init__
(
cls
,
name
,
bases
,
d
):
def
__init__
(
cls
,
name
,
bases
,
d
):
...
@@ -314,12 +317,12 @@ class ServerNode(Node):
...
@@ -314,12 +317,12 @@ class ServerNode(Node):
@
classmethod
@
classmethod
def
newAddress
(
cls
):
def
newAddress
(
cls
):
address
=
cls
.
_virtual_ip
,
len
(
cls
.
_node_list
)
address
=
cls
.
_virtual_ip
,
len
(
cls
.
_node_list
)
# NOTE addr is vip, #node
cls
.
_node_list
.
append
(
None
)
cls
.
_node_list
.
append
(
None
)
return
address
return
address
@
classmethod
@
classmethod
def
resolv
(
cls
,
address
):
def
resolv
(
cls
,
address
):
# (vip, #node) -> (vip', port)
try
:
try
:
cls
=
cls
.
_server_class_dict
[
address
[
0
]]
cls
=
cls
.
_server_class_dict
[
address
[
0
]]
except
KeyError
:
except
KeyError
:
...
@@ -345,6 +348,7 @@ class ServerNode(Node):
...
@@ -345,6 +348,7 @@ class ServerNode(Node):
self
.
node_name
=
'%s_%u'
%
(
self
.
node_type
,
port
)
self
.
node_name
=
'%s_%u'
%
(
self
.
node_type
,
port
)
kw
.
update
(
getCluster
=
name
,
getBind
=
address
,
kw
.
update
(
getCluster
=
name
,
getBind
=
address
,
getMasters
=
master_nodes
and
parseMasterList
(
master_nodes
,
address
))
getMasters
=
master_nodes
and
parseMasterList
(
master_nodes
,
address
))
# -> app.__init__() ; Mock serves as config
super
(
ServerNode
,
self
).
__init__
(
Mock
(
kw
))
super
(
ServerNode
,
self
).
__init__
(
Mock
(
kw
))
def
getVirtualAddress
(
self
):
def
getVirtualAddress
(
self
):
...
@@ -411,6 +415,7 @@ class StorageApplication(ServerNode, neo.storage.app.Application):
...
@@ -411,6 +415,7 @@ class StorageApplication(ServerNode, neo.storage.app.Application):
def
getAdapter
(
self
):
def
getAdapter
(
self
):
return
self
.
_init_args
[
'getAdapter'
]
return
self
.
_init_args
[
'getAdapter'
]
# get {} oid -> nlocks ; !0 - in staging area for commit (and for how many txn), oid from whole DB
def
getDataLockInfo
(
self
):
def
getDataLockInfo
(
self
):
dm
=
self
.
dm
dm
=
self
.
dm
index
=
tuple
(
dm
.
query
(
"SELECT id, hash, compression FROM data"
))
index
=
tuple
(
dm
.
query
(
"SELECT id, hash, compression FROM data"
))
...
@@ -472,6 +477,8 @@ class LoggerThreadName(str):
...
@@ -472,6 +477,8 @@ class LoggerThreadName(str):
return
str
.
__str__
(
self
)
return
str
.
__str__
(
self
)
# filters-out packet which are detected by filter-criterions setup with .add()
# for a packed detected tobe filtered; further pkts on same conn are always filtered
class
ConnectionFilter
(
object
):
class
ConnectionFilter
(
object
):
filtered_count
=
0
filtered_count
=
0
...
@@ -626,7 +633,6 @@ class NEOCluster(object):
...
@@ -626,7 +633,6 @@ class NEOCluster(object):
kw
=
dict
(
cluster
=
weak_self
,
getReplicas
=
replicas
,
getAdapter
=
adapter
,
kw
=
dict
(
cluster
=
weak_self
,
getReplicas
=
replicas
,
getAdapter
=
adapter
,
getPartitions
=
partitions
,
getReset
=
clear_databases
,
getPartitions
=
partitions
,
getReset
=
clear_databases
,
getSSL
=
self
.
SSL
)
getSSL
=
self
.
SSL
)
# NOTE
if
upstream
is
not
None
:
if
upstream
is
not
None
:
self
.
upstream
=
weakref
.
proxy
(
upstream
)
self
.
upstream
=
weakref
.
proxy
(
upstream
)
kw
.
update
(
getUpstreamCluster
=
upstream
.
name
,
kw
.
update
(
getUpstreamCluster
=
upstream
.
name
,
...
@@ -833,7 +839,7 @@ class NEOCluster(object):
...
@@ -833,7 +839,7 @@ class NEOCluster(object):
__print_exc
()
__print_exc
()
raise
raise
def
extraCellSortKey
(
self
,
key
):
def
extraCellSortKey
(
self
,
key
):
# XXX unused?
return
Patch
(
self
.
client
.
cp
,
getCellSortKey
=
lambda
orig
,
cell
:
return
Patch
(
self
.
client
.
cp
,
getCellSortKey
=
lambda
orig
,
cell
:
(
orig
(
cell
),
key
(
cell
)))
(
orig
(
cell
),
key
(
cell
)))
...
@@ -896,7 +902,7 @@ class NEOThreadedTest(NeoTestBase):
...
@@ -896,7 +902,7 @@ class NEOThreadedTest(NeoTestBase):
reset
()
reset
()
return
conn
return
conn
def
getUnpickler
(
self
,
conn
):
def
getUnpickler
(
self
,
conn
):
# XXX not used?
reader
=
conn
.
_reader
reader
=
conn
.
_reader
def
unpickler
(
data
,
compression
=
False
):
def
unpickler
(
data
,
compression
=
False
):
if
compression
:
if
compression
:
...
...
neo/tests/threaded/test.py
View file @
31574dcc
...
@@ -189,7 +189,7 @@ class Test(NEOThreadedTest):
...
@@ -189,7 +189,7 @@ class Test(NEOThreadedTest):
finally
:
finally
:
cluster
.
stop
()
cluster
.
stop
()
@
expectedFailure
(
POSException
.
ConflictError
)
@
expectedFailure
(
POSException
.
ConflictError
)
# TODO recheck
def
testUndoConflictDuringStore
(
self
):
def
testUndoConflictDuringStore
(
self
):
self
.
testUndoConflict
(
True
)
self
.
testUndoConflict
(
True
)
...
@@ -338,7 +338,7 @@ class Test(NEOThreadedTest):
...
@@ -338,7 +338,7 @@ class Test(NEOThreadedTest):
self
.
assertEqual
(
self
.
_testDeadlockAvoidance
([
2
,
4
]),
self
.
assertEqual
(
self
.
_testDeadlockAvoidance
([
2
,
4
]),
[
DelayedError
,
DelayedError
,
ConflictError
,
ConflictError
])
[
DelayedError
,
DelayedError
,
ConflictError
,
ConflictError
])
@
expectedFailure
(
POSException
.
ConflictError
)
@
expectedFailure
(
POSException
.
ConflictError
)
# XXX recheck
def
testDeadlockAvoidance
(
self
):
def
testDeadlockAvoidance
(
self
):
# This test fail because deadlock avoidance is not fully implemented.
# This test fail because deadlock avoidance is not fully implemented.
# 0: C1 -> S1
# 0: C1 -> S1
...
...
neo/tests/threaded/testSSL.py
View file @
31574dcc
...
@@ -33,8 +33,8 @@ class SSLMixin:
...
@@ -33,8 +33,8 @@ class SSLMixin:
class
SSLTests
(
SSLMixin
,
test
.
Test
):
class
SSLTests
(
SSLMixin
,
test
.
Test
):
# exclude expected failures
# exclude expected failures
testDeadlockAvoidance
=
None
testDeadlockAvoidance
=
None
# XXX why this fails?
testUndoConflict
=
testUndoConflictDuringStore
=
None
testUndoConflict
=
testUndoConflictDuringStore
=
None
# XXX why this fails?
def
testAbortConnection
(
self
):
def
testAbortConnection
(
self
):
for
after_handshake
in
1
,
0
:
for
after_handshake
in
1
,
0
:
...
@@ -60,7 +60,7 @@ class SSLTests(SSLMixin, test.Test):
...
@@ -60,7 +60,7 @@ class SSLTests(SSLMixin, test.Test):
class
SSLReplicationTests
(
SSLMixin
,
testReplication
.
ReplicationTests
):
class
SSLReplicationTests
(
SSLMixin
,
testReplication
.
ReplicationTests
):
# do not repeat slowest tests with SSL
# do not repeat slowest tests with SSL
testBackupNodeLost
=
testBackupNormalCase
=
None
testBackupNodeLost
=
testBackupNormalCase
=
None
# TODO recheck
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
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