Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
nexedi
/
neoppod
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
2
Snippets
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 83fe64bf
authored
2015-11-02 23:10:59 +0100
by
Julien Muchembled
1
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
storage: fix pruning of data when deleting partial transactions during verification
1 parent
daa83cb4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
neo/storage/database/mysqldb.py
neo/storage/database/sqlite.py
neo/tests/threaded/test.py
neo/storage/database/mysqldb.py
View file @
83fe64b
...
...
@@ -562,14 +562,13 @@ class MySQLDatabaseManager(DatabaseManager):
getPartition
=
self
.
_getPartition
q
=
self
.
query
sql
=
" FROM tobj WHERE tid=
%
d"
%
tid
data_id_
list
=
[
x
for
x
,
in
q
(
"SELECT data_id"
+
sql
)
if
x
]
self
.
releaseData
(
data_id_
lis
t
)
data_id_
set
=
{
x
for
x
,
in
q
(
"SELECT data_id"
+
sql
)
if
x
}
self
.
releaseData
(
data_id_
se
t
)
q
(
"DELETE"
+
sql
)
q
(
"""DELETE FROM ttrans WHERE tid =
%
d"""
%
tid
)
q
(
"""DELETE FROM trans WHERE `partition` =
%
d AND tid =
%
d"""
%
(
getPartition
(
tid
),
tid
))
# delete from obj using indexes
data_id_set
=
set
()
for
oid
in
oid_list
:
oid
=
u64
(
oid
)
sql
=
" FROM obj WHERE `partition`=
%
d AND oid=
%
d AND tid=
%
d"
\
...
...
neo/storage/database/sqlite.py
View file @
83fe64b
...
...
@@ -424,14 +424,13 @@ class SQLiteDatabaseManager(DatabaseManager):
getPartition
=
self
.
_getPartition
q
=
self
.
query
sql
=
" FROM tobj WHERE tid=?"
data_id_
list
=
[
x
for
x
,
in
q
(
"SELECT data_id"
+
sql
,
(
tid
,))
if
x
]
self
.
releaseData
(
data_id_
lis
t
)
data_id_
set
=
{
x
for
x
,
in
q
(
"SELECT data_id"
+
sql
,
(
tid
,))
if
x
}
self
.
releaseData
(
data_id_
se
t
)
q
(
"DELETE"
+
sql
,
(
tid
,))
q
(
"DELETE FROM ttrans WHERE tid=?"
,
(
tid
,))
q
(
"DELETE FROM trans WHERE partition=? AND tid=?"
,
(
getPartition
(
tid
),
tid
))
# delete from obj using indexes
data_id_set
=
set
()
for
oid
in
oid_list
:
oid
=
u64
(
oid
)
sql
=
" FROM obj WHERE partition=? AND oid=? AND tid=?"
...
...
neo/tests/threaded/test.py
View file @
83fe64b
...
...
@@ -438,6 +438,14 @@ class Test(NEOThreadedTest):
finally
:
cluster
.
stop
()
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
:
cluster
.
start
()
t
,
c
=
cluster
.
getTransaction
()
...
...
@@ -445,6 +453,8 @@ class Test(NEOThreadedTest):
self
.
assertEqual
(
r
[
0
]
.
value
,
0
)
self
.
assertEqual
(
r
[
1
]
.
value
,
0
)
self
.
assertEqual
(
r
[
2
],
'ok'
)
self
.
assertEqual
(
di0
,
s0
.
getDataLockInfo
())
self
.
assertEqual
(
di1
,
s1
.
getDataLockInfo
())
finally
:
cluster
.
stop
()
...
...
@jm
Julien Muchembled
@jm
mentioned in commit
cff279af
2015-11-30 15:01:18 UTC
mentioned in commit
cff279af
Toggle commit list
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment