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
dae00a2b
Commit
dae00a2b
authored
Nov 28, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
63875e79
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
6 deletions
+61
-6
neo/lib/logger.py
neo/lib/logger.py
+4
-2
neo/lib/protocol.py
neo/lib/protocol.py
+1
-1
neo/lib/util.py
neo/lib/util.py
+1
-1
neo/scripts/simple.py
neo/scripts/simple.py
+2
-2
t/NOTES
t/NOTES
+50
-0
t/neo/storage.go
t/neo/storage.go
+3
-0
No files found.
neo/lib/logger.py
View file @
dae00a2b
...
...
@@ -224,9 +224,11 @@ class NEOLogger(Logger):
peer
=
'%s %s (%s:%u)'
%
(
'>'
if
r
.
outgoing
else
'<'
,
uuid_str
(
r
.
uuid
),
ip
,
port
)
msg
=
r
.
msg
"""
pktcls = protocol.StaticRegistry[r.code]
print 'PACKET %s %s
\
t
%s
\
t
%s
\
t
%s %s' % (r.created, r._name, r.msg_id,
pktcls.__name__, peer, r.pkt.decode())
"""
if
msg
is
not
None
:
msg
=
buffer
(
msg
)
self
.
_db
.
execute
(
"INSERT INTO packet VALUES (NULL,?,?,?,?,?,?)"
,
...
...
@@ -269,8 +271,8 @@ class NEOLogger(Logger):
self
.
parent
.
callHandlers
(
record
)
def
packet
(
self
,
connection
,
packet
,
outgoing
):
return
if
True
or
self
.
_db
is
not
None
:
#if True or self._db is not None:
if
self
.
_db
is
not
None
:
body
=
packet
.
_body
if
self
.
_max_packet
and
self
.
_max_packet
<
len
(
body
):
body
=
None
...
...
neo/lib/protocol.py
View file @
dae00a2b
...
...
@@ -750,7 +750,7 @@ class Recovery(Packet):
"""
_answer
=
PStruct
(
'answer_recovery'
,
PPTID
(
'ptid'
),
PTID
(
'backup_tid'
),
# NOTE
PTID
(
'backup_tid'
),
PTID
(
'truncate_tid'
),
)
...
...
neo/lib/util.py
View file @
dae00a2b
...
...
@@ -204,7 +204,7 @@ class ReadBuffer(object):
keep
,
let
=
last_chunk
[:
to_read
],
last_chunk
[
to_read
:]
self
.
content
.
appendleft
(
let
)
chunk_list
[
-
1
]
=
keep
# join all chunks (one copy)
# join all chunks (one copy)
// XXX only 1 chunk -> no copy at all
data
=
''
.
join
(
chunk_list
)
assert
len
(
data
)
==
size
return
data
...
...
neo/scripts/simple.py
View file @
dae00a2b
...
...
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
inspect
,
random
,
signal
,
sys
from
logging
import
getLogger
,
INFO
from
logging
import
getLogger
,
INFO
,
DEBUG
from
optparse
import
OptionParser
from
neo.lib
import
logging
from
neo.tests
import
functional
...
...
@@ -46,7 +46,7 @@ def main():
options
,
args
=
parser
.
parse_args
()
if
options
.
seed
:
functional
.
random
=
random
.
Random
(
options
.
seed
)
getLogger
().
setLevel
(
INFO
)
getLogger
().
setLevel
(
DEBUG
)
cluster
=
functional
.
NEOCluster
(
args
,
**
{
x
:
getattr
(
options
,
x
)
for
x
,
_
in
option_list
})
try
:
...
...
t/NOTES
View file @
dae00a2b
...
...
@@ -270,6 +270,56 @@ NodeInformation
TODO
Storage communications
----------------------
* bootstrap (connect to primary master):
>M RequestIdentification
<M AcceptIdentification (AnswerRequestIdentification)
* init (under master command go through recovery / verification)
(BaseMasterHandler)
<M AskRecovery
>M AnswerRecovery (ptid, backup_tid, truncate_tid)
<M AskPartitionTable
>M AnswerPartitionTable (ptid, []PtRow)
# neoctl start
<M NotifyNodeInformation (S1.state=RUNNING)
# S: "I was told I'm RUNNING"
<M NotifyClusterInformation (state=VERIFYING)
<M NotifyNodeInformation (S1.state=RUNNING) # again, why?
# S: "I was told I'm RUNNING"
<M NotifyPartitionTable (ptid=1, `node 0: S1, R`)
# S saves PT info locally
# M asks about unfinished transactions
<M AskLockedTransactions
>M AnswerLockedTransactions {} ttid -> tid # in example we have empty
<M AskLastIDs
>M AnswerLastIDs (last_oid, last_tid)
<M NotifyClusterInformation (state=RUNNING)
<M StartOperation
>M NotifyReady
--- also in base/init handlers:
<M StopOperation
<M AskFinalTID
# >M answerUnfinishedTransactions (only upon S request)
# <M ReelectPrimary ?
<M Truncate
<M Validatetransactions
* operation (serve clients):
Tables
...
...
t/neo/storage.go
View file @
dae00a2b
...
...
@@ -55,6 +55,9 @@ func (stor *StorageApplication) ServeConn(ctx context.Context, conn net.Conn) {
if
length
<
PktHeadLen
{
panic
(
"TODO pkt.length < PktHeadLen"
)
// XXX err (length is a whole packet len with header)
}
if
length
>
MAX_PACKET_SIZE
{
panic
(
"TODO message too big"
)
// XXX err
}
if
length
>
uint32
(
len
(
rxbuf
))
{
// grow rxbuf
...
...
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