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
095f166c
Commit
095f166c
authored
Oct 19, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XY Allow read-only access in BACKINGUP state (for now master-only & draft)
parent
67041723
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
6 deletions
+27
-6
neo/master/app.py
neo/master/app.py
+6
-3
neo/master/handlers/client.py
neo/master/handlers/client.py
+16
-1
neo/master/handlers/identification.py
neo/master/handlers/identification.py
+5
-2
No files found.
neo/master/app.py
View file @
095f166c
...
...
@@ -103,6 +103,7 @@ class Application(BaseApplication):
self
)
self
.
secondary_master_handler
=
secondary
.
SecondaryMasterHandler
(
self
)
self
.
client_service_handler
=
client
.
ClientServiceHandler
(
self
)
self
.
client_ro_service_handler
=
client
.
ClientROServiceHandler
(
self
)
self
.
storage_service_handler
=
storage
.
StorageServiceHandler
(
self
)
registerLiveDebugger
(
on_log
=
self
.
log
)
...
...
@@ -418,7 +419,6 @@ class Application(BaseApplication):
return
# select the storage handler
client_handler
=
self
.
client_service_handler
if
state
in
(
ClusterStates
.
RUNNING
,
ClusterStates
.
STARTING_BACKUP
,
ClusterStates
.
BACKINGUP
,
ClusterStates
.
STOPPING_BACKUP
):
storage_handler
=
self
.
storage_service_handler
...
...
@@ -435,10 +435,13 @@ class Application(BaseApplication):
conn
=
node
.
getConnection
()
conn
.
notify
(
notification_packet
)
if
node
.
isClient
():
if
state
!=
ClusterStates
.
RUNNING
:
if
state
==
ClusterStates
.
RUNNING
:
handler
=
self
.
client_service_handler
elif
state
==
ClusterStates
.
BACKINGUP
:
handler
=
self
.
client_ro_service_handler
else
:
conn
.
abort
()
continue
handler
=
client_handler
elif
node
.
isStorage
()
and
storage_handler
:
handler
=
storage_handler
else
:
...
...
neo/master/handlers/client.py
View file @
095f166c
...
...
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
neo.lib.protocol
import
NodeStates
,
Packets
,
ProtocolError
,
MAX_TID
from
neo.lib.protocol
import
NodeStates
,
Packets
,
ProtocolError
,
MAX_TID
,
NotReadyError
from
.
import
MasterHandler
class
ClientServiceHandler
(
MasterHandler
):
...
...
@@ -118,3 +118,18 @@ class ClientServiceHandler(MasterHandler):
# BUG: The replicator may wait this transaction to be finished.
self
.
app
.
tm
.
abort
(
tid
,
conn
.
getUUID
())
# like ClientServiceHandler but read-only
class
ClientROServiceHandler
(
ClientServiceHandler
):
def
_readOnly
(
self
,
*
args
,
**
kw
):
raise
NotReadyError
(
'read-only access'
)
askBeginTransaction
=
_readOnly
askNewOIDs
=
_readOnly
askFinishTransaction
=
_readOnly
askFinalTID
=
_readOnly
askPack
=
_readOnly
abortTransaction
=
_readOnly
# XXX also override askLastIDs to return backup_tid as last_tid ?
# XXX ----//---- askLastTransaction ?
neo/master/handlers/identification.py
View file @
095f166c
...
...
@@ -41,9 +41,12 @@ class IdentificationHandler(MasterHandler):
state
=
NodeStates
.
RUNNING
if
node_type
==
NodeTypes
.
CLIENT
:
if
app
.
cluster_state
!=
ClusterStates
.
RUNNING
:
if
app
.
cluster_state
==
ClusterStates
.
RUNNING
:
handler
=
app
.
client_service_handler
elif
app
.
cluster_state
==
ClusterStates
.
BACKINGUP
:
handler
=
app
.
client_ro_service_handler
else
:
raise
NotReadyError
handler
=
app
.
client_service_handler
human_readable_node_type
=
' client '
elif
node_type
==
NodeTypes
.
STORAGE
:
if
app
.
cluster_state
==
ClusterStates
.
STOPPING_BACKUP
:
...
...
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