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
Vincent Pelletier
neoppod
Commits
58d0b602
Commit
58d0b602
authored
Dec 23, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: fix abort before vote, to free the storage space used by the transaction
parent
d87df377
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
12 deletions
+15
-12
neo/storage/database/mysqldb.py
neo/storage/database/mysqldb.py
+1
-4
neo/storage/database/sqlite.py
neo/storage/database/sqlite.py
+1
-4
neo/storage/transactions.py
neo/storage/transactions.py
+4
-1
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+9
-3
No files found.
neo/storage/database/mysqldb.py
View file @
58d0b602
...
...
@@ -578,11 +578,8 @@ class MySQLDatabaseManager(DatabaseManager):
def
abortTransaction
(
self
,
ttid
):
ttid
=
util
.
u64
(
ttid
)
q
=
self
.
query
sql
=
" FROM tobj WHERE tid=%s"
%
ttid
data_id_list
=
[
x
for
x
,
in
q
(
"SELECT data_id"
+
sql
)
if
x
]
q
(
"DELETE"
+
sql
)
q
(
"DELETE FROM tobj WHERE tid=%s"
%
ttid
)
q
(
"DELETE FROM ttrans WHERE ttid=%s"
%
ttid
)
self
.
releaseData
(
data_id_list
,
True
)
def
deleteTransaction
(
self
,
tid
):
tid
=
util
.
u64
(
tid
)
...
...
neo/storage/database/sqlite.py
View file @
58d0b602
...
...
@@ -439,11 +439,8 @@ class SQLiteDatabaseManager(DatabaseManager):
def
abortTransaction
(
self
,
ttid
):
args
=
util
.
u64
(
ttid
),
q
=
self
.
query
sql
=
" FROM tobj WHERE tid=?"
data_id_list
=
[
x
for
x
,
in
q
(
"SELECT data_id"
+
sql
,
args
)
if
x
]
q
(
"DELETE"
+
sql
,
args
)
q
(
"DELETE FROM tobj WHERE tid=?"
,
args
)
q
(
"DELETE FROM ttrans WHERE ttid=?"
,
args
)
self
.
releaseData
(
data_id_list
,
True
)
def
deleteTransaction
(
self
,
tid
):
tid
=
util
.
u64
(
tid
)
...
...
neo/storage/transactions.py
View file @
58d0b602
...
...
@@ -290,7 +290,10 @@ class TransactionManager(object):
if
not
even_if_locked
:
return
else
:
self
.
_app
.
dm
.
abortTransaction
(
ttid
)
dm
=
self
.
_app
.
dm
dm
.
abortTransaction
(
ttid
)
dm
.
releaseData
([
x
[
1
]
for
x
in
transaction
.
store_dict
.
itervalues
()],
True
)
# unlock any object
for
oid
in
transaction
.
store_dict
,
transaction
.
checked_set
:
for
oid
in
oid
:
...
...
neo/tests/threaded/test.py
View file @
58d0b602
...
...
@@ -211,15 +211,21 @@ class Test(NEOThreadedTest):
data_info
[
key
]
=
0
storage
.
sync
()
txn
=
[
transaction
.
Transaction
()
for
x
in
xrange
(
3
)]
txn
=
[
transaction
.
Transaction
()
for
x
in
xrange
(
4
)]
for
t
in
txn
:
storage
.
tpc_begin
(
t
)
storage
.
store
(
tid
and
oid
or
storage
.
new_oid
(),
storage
.
store
(
oid
if
tid
else
storage
.
new_oid
(),
tid
,
data
,
''
,
t
)
tid
=
None
data_info
[
key
]
=
4
storage
.
sync
()
self
.
assertEqual
(
data_info
,
cluster
.
storage
.
getDataLockInfo
())
storage
.
tpc_abort
(
txn
.
pop
())
for
t
in
txn
:
storage
.
tpc_vote
(
t
)
data_info
[
key
]
=
3
storage
.
sync
()
data_info
[
key
]
-=
1
self
.
assertEqual
(
data_info
,
cluster
.
storage
.
getDataLockInfo
())
storage
.
tpc_abort
(
txn
[
1
])
...
...
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