Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
2241c3a1
Commit
2241c3a1
authored
Mar 02, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In logs, show tid in hex instead of decimal
parent
7e4e75e4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
21 deletions
+21
-21
neo/master/backup_app.py
neo/master/backup_app.py
+15
-15
neo/storage/handlers/storage.py
neo/storage/handlers/storage.py
+1
-1
neo/storage/replicator.py
neo/storage/replicator.py
+5
-5
No files found.
neo/master/backup_app.py
View file @
2241c3a1
...
@@ -35,7 +35,7 @@ from neo.lib.exception import PrimaryFailure
...
@@ -35,7 +35,7 @@ from neo.lib.exception import PrimaryFailure
from
neo.lib.node
import
NodeManager
from
neo.lib.node
import
NodeManager
from
neo.lib.protocol
import
CellStates
,
ClusterStates
,
NodeTypes
,
Packets
from
neo.lib.protocol
import
CellStates
,
ClusterStates
,
NodeTypes
,
Packets
from
neo.lib.protocol
import
INVALID_TID
,
ZERO_TID
from
neo.lib.protocol
import
INVALID_TID
,
ZERO_TID
from
neo.lib.util
import
add64
,
u64
,
dump
from
neo.lib.util
import
add64
,
dump
from
.app
import
StateChangedException
from
.app
import
StateChangedException
from
.pt
import
PartitionTable
from
.pt
import
PartitionTable
from
.handlers.backup
import
BackupHandler
from
.handlers.backup
import
BackupHandler
...
@@ -167,8 +167,8 @@ class BackupApplication(object):
...
@@ -167,8 +167,8 @@ class BackupApplication(object):
cell
.
replicating
=
tid
cell
.
replicating
=
tid
if
cell
.
backup_tid
<
tid
:
if
cell
.
backup_tid
<
tid
:
neo
.
lib
.
logging
.
debug
(
neo
.
lib
.
logging
.
debug
(
"ask %s to replicate partition %u up to %
u
from %r"
,
"ask %s to replicate partition %u up to %
s
from %r"
,
dump
(
cell
.
getUUID
()),
offset
,
u64
(
tid
),
dump
(
cell
.
getUUID
()),
offset
,
dump
(
tid
),
dump
(
primary_node
.
getUUID
()))
dump
(
primary_node
.
getUUID
()))
cell
.
getNode
().
getConnection
().
notify
(
p
)
cell
.
getNode
().
getConnection
().
notify
(
p
)
trigger_set
.
add
(
primary_node
)
trigger_set
.
add
(
primary_node
)
...
@@ -198,8 +198,8 @@ class BackupApplication(object):
...
@@ -198,8 +198,8 @@ class BackupApplication(object):
# This is the last time we can increase
# This is the last time we can increase
# 'backup_tid' without replication.
# 'backup_tid' without replication.
neo
.
lib
.
logging
.
debug
(
neo
.
lib
.
logging
.
debug
(
"partition %u: updating backup_tid of %r to %
u
"
,
"partition %u: updating backup_tid of %r to %
s
"
,
offset
,
cell
,
u64
(
prev_tid
))
offset
,
cell
,
dump
(
prev_tid
))
cell
.
backup_tid
=
prev_tid
cell
.
backup_tid
=
prev_tid
assert
node_list
assert
node_list
trigger_set
.
update
(
node_list
)
trigger_set
.
update
(
node_list
)
...
@@ -214,8 +214,8 @@ class BackupApplication(object):
...
@@ -214,8 +214,8 @@ class BackupApplication(object):
if
last_max_tid
<=
cell
.
backup_tid
:
if
last_max_tid
<=
cell
.
backup_tid
:
cell
.
backup_tid
=
tid
cell
.
backup_tid
=
tid
neo
.
lib
.
logging
.
debug
(
neo
.
lib
.
logging
.
debug
(
"partition %u: updating backup_tid of %r to %
u
"
,
"partition %u: updating backup_tid of %r to %
s
"
,
offset
,
cell
,
u64
(
tid
))
offset
,
cell
,
dump
(
tid
))
for
node
in
trigger_set
:
for
node
in
trigger_set
:
self
.
triggerBackup
(
node
)
self
.
triggerBackup
(
node
)
count
=
sum
(
map
(
len
,
self
.
tid_list
))
count
=
sum
(
map
(
len
,
self
.
tid_list
))
...
@@ -251,8 +251,8 @@ class BackupApplication(object):
...
@@ -251,8 +251,8 @@ class BackupApplication(object):
address_set
.
add
(
addr
)
address_set
.
add
(
addr
)
source_dict
[
offset
]
=
addr
source_dict
[
offset
]
=
addr
neo
.
lib
.
logging
.
debug
(
neo
.
lib
.
logging
.
debug
(
"ask %s to replicate partition %u up to %
u
from %r"
,
"ask %s to replicate partition %u up to %
s
from %r"
,
dump
(
node
.
getUUID
()),
offset
,
u64
(
tid
),
addr
)
dump
(
node
.
getUUID
()),
offset
,
dump
(
tid
),
addr
)
node
.
getConnection
().
notify
(
Packets
.
Replicate
(
node
.
getConnection
().
notify
(
Packets
.
Replicate
(
tid
,
self
.
name
,
source_dict
))
tid
,
self
.
name
,
source_dict
))
...
@@ -269,8 +269,8 @@ class BackupApplication(object):
...
@@ -269,8 +269,8 @@ class BackupApplication(object):
tid
=
add64
(
tid_list
[
bisect
(
tid_list
,
tid
)],
-
1
)
tid
=
add64
(
tid_list
[
bisect
(
tid_list
,
tid
)],
-
1
)
except
IndexError
:
except
IndexError
:
tid
=
app
.
getLastTransaction
()
tid
=
app
.
getLastTransaction
()
neo
.
lib
.
logging
.
debug
(
"partition %u: updating backup_tid of %r to %
u
"
,
neo
.
lib
.
logging
.
debug
(
"partition %u: updating backup_tid of %r to %
s
"
,
offset
,
cell
,
u64
(
tid
))
offset
,
cell
,
dump
(
tid
))
cell
.
backup_tid
=
tid
cell
.
backup_tid
=
tid
# Forget tids we won't need anymore.
# Forget tids we won't need anymore.
cell_list
=
app
.
pt
.
getCellList
(
offset
,
readable
=
True
)
cell_list
=
app
.
pt
.
getCellList
(
offset
,
readable
=
True
)
...
@@ -286,8 +286,8 @@ class BackupApplication(object):
...
@@ -286,8 +286,8 @@ class BackupApplication(object):
if
tid
<
max_tid
:
if
tid
<
max_tid
:
cell
.
replicating
=
max_tid
cell
.
replicating
=
max_tid
neo
.
lib
.
logging
.
debug
(
neo
.
lib
.
logging
.
debug
(
"ask %s to replicate partition %u up to %
u
from %r"
,
"ask %s to replicate partition %u up to %
s
from %r"
,
dump
(
node
.
getUUID
()),
offset
,
u64
(
max_tid
),
dump
(
node
.
getUUID
()),
offset
,
dump
(
max_tid
),
dump
(
primary_node
.
getUUID
()))
dump
(
primary_node
.
getUUID
()))
node
.
getConnection
().
notify
(
Packets
.
Replicate
(
max_tid
,
node
.
getConnection
().
notify
(
Packets
.
Replicate
(
max_tid
,
''
,
{
offset
:
primary_node
.
getAddress
()}))
''
,
{
offset
:
primary_node
.
getAddress
()}))
...
@@ -301,8 +301,8 @@ class BackupApplication(object):
...
@@ -301,8 +301,8 @@ class BackupApplication(object):
if
max
(
cell
.
backup_tid
,
cell
.
replicating
)
<
tid
:
if
max
(
cell
.
backup_tid
,
cell
.
replicating
)
<
tid
:
cell
.
replicating
=
tid
cell
.
replicating
=
tid
neo
.
lib
.
logging
.
debug
(
neo
.
lib
.
logging
.
debug
(
"ask %s to replicate partition %u up to %
u
from"
"ask %s to replicate partition %u up to %
s
from"
" %r"
,
dump
(
cell
.
getUUID
()),
offset
,
u64
(
tid
),
" %r"
,
dump
(
cell
.
getUUID
()),
offset
,
dump
(
tid
),
dump
(
node
.
getUUID
()))
dump
(
node
.
getUUID
()))
cell
.
getNode
().
getConnection
().
notify
(
p
)
cell
.
getNode
().
getConnection
().
notify
(
p
)
return
result
return
result
neo/storage/handlers/storage.py
View file @
2241c3a1
...
@@ -22,7 +22,7 @@ from neo.lib.connector import ConnectorConnectionClosedException
...
@@ -22,7 +22,7 @@ from neo.lib.connector import ConnectorConnectionClosedException
from
neo.lib.handler
import
EventHandler
from
neo.lib.handler
import
EventHandler
from
neo.lib.protocol
import
Errors
,
NodeStates
,
Packets
,
\
from
neo.lib.protocol
import
Errors
,
NodeStates
,
Packets
,
\
ZERO_HASH
,
ZERO_TID
,
ZERO_OID
ZERO_HASH
,
ZERO_TID
,
ZERO_OID
from
neo.lib.util
import
add64
,
u64
from
neo.lib.util
import
add64
def
checkConnectionIsReplicatorConnection
(
func
):
def
checkConnectionIsReplicatorConnection
(
func
):
def
decorator
(
self
,
conn
,
*
args
,
**
kw
):
def
decorator
(
self
,
conn
,
*
args
,
**
kw
):
...
...
neo/storage/replicator.py
View file @
2241c3a1
...
@@ -57,7 +57,7 @@ import neo.lib
...
@@ -57,7 +57,7 @@ import neo.lib
from
neo.lib.protocol
import
CellStates
,
NodeTypes
,
NodeStates
,
Packets
,
\
from
neo.lib.protocol
import
CellStates
,
NodeTypes
,
NodeStates
,
Packets
,
\
INVALID_TID
,
ZERO_TID
,
ZERO_OID
INVALID_TID
,
ZERO_TID
,
ZERO_OID
from
neo.lib.connection
import
ClientConnection
from
neo.lib.connection
import
ClientConnection
from
neo.lib.util
import
add64
,
u64
from
neo.lib.util
import
add64
,
dump
from
.handlers.storage
import
StorageOperationHandler
from
.handlers.storage
import
StorageOperationHandler
FETCH_COUNT
=
1000
FETCH_COUNT
=
1000
...
@@ -242,8 +242,8 @@ class Replicator(object):
...
@@ -242,8 +242,8 @@ class Replicator(object):
min_tid
=
p
.
next_trans
min_tid
=
p
.
next_trans
self
.
replicate_tid
=
self
.
replicate_dict
.
pop
(
offset
)
self
.
replicate_tid
=
self
.
replicate_dict
.
pop
(
offset
)
neo
.
lib
.
logging
.
debug
(
"starting replication of <partition=%u"
neo
.
lib
.
logging
.
debug
(
"starting replication of <partition=%u"
" min_tid=%
u max_tid=%u> from %r"
,
offset
,
u64
(
min_tid
),
" min_tid=%
s max_tid=%s> from %r"
,
offset
,
dump
(
min_tid
),
u64
(
self
.
replicate_tid
),
self
.
current_node
)
dump
(
self
.
replicate_tid
),
self
.
current_node
)
max_tid
=
self
.
replicate_tid
max_tid
=
self
.
replicate_tid
tid_list
=
self
.
app
.
dm
.
getReplicationTIDList
(
min_tid
,
max_tid
,
tid_list
=
self
.
app
.
dm
.
getReplicationTIDList
(
min_tid
,
max_tid
,
FETCH_COUNT
,
offset
)
FETCH_COUNT
,
offset
)
...
@@ -286,8 +286,8 @@ class Replicator(object):
...
@@ -286,8 +286,8 @@ class Replicator(object):
if
not
p
.
max_ttid
:
if
not
p
.
max_ttid
:
p
=
Packets
.
NotifyReplicationDone
(
offset
,
tid
)
p
=
Packets
.
NotifyReplicationDone
(
offset
,
tid
)
self
.
app
.
master_conn
.
notify
(
p
)
self
.
app
.
master_conn
.
notify
(
p
)
neo
.
lib
.
logging
.
debug
(
"partition %u replicated up to %
u
from %r"
,
neo
.
lib
.
logging
.
debug
(
"partition %u replicated up to %
s
from %r"
,
offset
,
u64
(
tid
),
self
.
current_node
)
offset
,
dump
(
tid
),
self
.
current_node
)
self
.
_nextPartition
()
self
.
_nextPartition
()
def
abort
(
self
,
message
=
''
):
def
abort
(
self
,
message
=
''
):
...
...
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