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
83fe64bf
Commit
83fe64bf
authored
Nov 02, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: fix pruning of data when deleting partial transactions during verification
parent
daa83cb4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
neo/storage/database/mysqldb.py
neo/storage/database/mysqldb.py
+2
-3
neo/storage/database/sqlite.py
neo/storage/database/sqlite.py
+2
-3
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+10
-0
No files found.
neo/storage/database/mysqldb.py
View file @
83fe64bf
...
@@ -562,14 +562,13 @@ class MySQLDatabaseManager(DatabaseManager):
...
@@ -562,14 +562,13 @@ class MySQLDatabaseManager(DatabaseManager):
getPartition
=
self
.
_getPartition
getPartition
=
self
.
_getPartition
q
=
self
.
query
q
=
self
.
query
sql
=
" FROM tobj WHERE tid=%d"
%
tid
sql
=
" FROM tobj WHERE tid=%d"
%
tid
data_id_
list
=
[
x
for
x
,
in
q
(
"SELECT data_id"
+
sql
)
if
x
]
data_id_
set
=
{
x
for
x
,
in
q
(
"SELECT data_id"
+
sql
)
if
x
}
self
.
releaseData
(
data_id_
lis
t
)
self
.
releaseData
(
data_id_
se
t
)
q
(
"DELETE"
+
sql
)
q
(
"DELETE"
+
sql
)
q
(
"""DELETE FROM ttrans WHERE tid = %d"""
%
tid
)
q
(
"""DELETE FROM ttrans WHERE tid = %d"""
%
tid
)
q
(
"""DELETE FROM trans WHERE `partition` = %d AND tid = %d"""
%
q
(
"""DELETE FROM trans WHERE `partition` = %d AND tid = %d"""
%
(
getPartition
(
tid
),
tid
))
(
getPartition
(
tid
),
tid
))
# delete from obj using indexes
# delete from obj using indexes
data_id_set
=
set
()
for
oid
in
oid_list
:
for
oid
in
oid_list
:
oid
=
u64
(
oid
)
oid
=
u64
(
oid
)
sql
=
" FROM obj WHERE `partition`=%d AND oid=%d AND tid=%d"
\
sql
=
" FROM obj WHERE `partition`=%d AND oid=%d AND tid=%d"
\
...
...
neo/storage/database/sqlite.py
View file @
83fe64bf
...
@@ -424,14 +424,13 @@ class SQLiteDatabaseManager(DatabaseManager):
...
@@ -424,14 +424,13 @@ class SQLiteDatabaseManager(DatabaseManager):
getPartition
=
self
.
_getPartition
getPartition
=
self
.
_getPartition
q
=
self
.
query
q
=
self
.
query
sql
=
" FROM tobj WHERE tid=?"
sql
=
" FROM tobj WHERE tid=?"
data_id_
list
=
[
x
for
x
,
in
q
(
"SELECT data_id"
+
sql
,
(
tid
,))
if
x
]
data_id_
set
=
{
x
for
x
,
in
q
(
"SELECT data_id"
+
sql
,
(
tid
,))
if
x
}
self
.
releaseData
(
data_id_
lis
t
)
self
.
releaseData
(
data_id_
se
t
)
q
(
"DELETE"
+
sql
,
(
tid
,))
q
(
"DELETE"
+
sql
,
(
tid
,))
q
(
"DELETE FROM ttrans WHERE tid=?"
,
(
tid
,))
q
(
"DELETE FROM ttrans WHERE tid=?"
,
(
tid
,))
q
(
"DELETE FROM trans WHERE partition=? AND tid=?"
,
q
(
"DELETE FROM trans WHERE partition=? AND tid=?"
,
(
getPartition
(
tid
),
tid
))
(
getPartition
(
tid
),
tid
))
# delete from obj using indexes
# delete from obj using indexes
data_id_set
=
set
()
for
oid
in
oid_list
:
for
oid
in
oid_list
:
oid
=
u64
(
oid
)
oid
=
u64
(
oid
)
sql
=
" FROM obj WHERE partition=? AND oid=? AND tid=?"
sql
=
" FROM obj WHERE partition=? AND oid=? AND tid=?"
...
...
neo/tests/threaded/test.py
View file @
83fe64bf
...
@@ -438,6 +438,14 @@ class Test(NEOThreadedTest):
...
@@ -438,6 +438,14 @@ class Test(NEOThreadedTest):
finally
:
finally
:
cluster
.
stop
()
cluster
.
stop
()
cluster
.
reset
()
cluster
.
reset
()
di0
=
s0
.
getDataLockInfo
()
k
,
=
(
k
for
k
,
v
in
di0
.
iteritems
()
if
v
==
1
)
di0
[
k
]
=
0
# r[2] = 'ok'
self
.
assertEqual
(
di0
.
values
(),
[
0
,
0
,
0
,
0
,
0
])
di1
=
s1
.
getDataLockInfo
()
k
,
=
(
k
for
k
,
v
in
di1
.
iteritems
()
if
v
==
1
)
del
di1
[
k
]
# x.value = 1
self
.
assertEqual
(
di1
.
values
(),
[
0
])
try
:
try
:
cluster
.
start
()
cluster
.
start
()
t
,
c
=
cluster
.
getTransaction
()
t
,
c
=
cluster
.
getTransaction
()
...
@@ -445,6 +453,8 @@ class Test(NEOThreadedTest):
...
@@ -445,6 +453,8 @@ class Test(NEOThreadedTest):
self
.
assertEqual
(
r
[
0
].
value
,
0
)
self
.
assertEqual
(
r
[
0
].
value
,
0
)
self
.
assertEqual
(
r
[
1
].
value
,
0
)
self
.
assertEqual
(
r
[
1
].
value
,
0
)
self
.
assertEqual
(
r
[
2
],
'ok'
)
self
.
assertEqual
(
r
[
2
],
'ok'
)
self
.
assertEqual
(
di0
,
s0
.
getDataLockInfo
())
self
.
assertEqual
(
di1
,
s1
.
getDataLockInfo
())
finally
:
finally
:
cluster
.
stop
()
cluster
.
stop
()
...
...
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