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
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
58d0b602
Commit
58d0b602
authored
Dec 23, 2016
by
Julien Muchembled
1
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
Show 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):
...
@@ -578,11 +578,8 @@ class MySQLDatabaseManager(DatabaseManager):
def
abortTransaction
(
self
,
ttid
):
def
abortTransaction
(
self
,
ttid
):
ttid
=
util
.
u64
(
ttid
)
ttid
=
util
.
u64
(
ttid
)
q
=
self
.
query
q
=
self
.
query
sql
=
" FROM tobj WHERE tid=%s"
%
ttid
q
(
"DELETE 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 ttrans WHERE ttid=%s"
%
ttid
)
q
(
"DELETE FROM ttrans WHERE ttid=%s"
%
ttid
)
self
.
releaseData
(
data_id_list
,
True
)
def
deleteTransaction
(
self
,
tid
):
def
deleteTransaction
(
self
,
tid
):
tid
=
util
.
u64
(
tid
)
tid
=
util
.
u64
(
tid
)
...
...
neo/storage/database/sqlite.py
View file @
58d0b602
...
@@ -439,11 +439,8 @@ class SQLiteDatabaseManager(DatabaseManager):
...
@@ -439,11 +439,8 @@ class SQLiteDatabaseManager(DatabaseManager):
def
abortTransaction
(
self
,
ttid
):
def
abortTransaction
(
self
,
ttid
):
args
=
util
.
u64
(
ttid
),
args
=
util
.
u64
(
ttid
),
q
=
self
.
query
q
=
self
.
query
sql
=
" FROM tobj WHERE tid=?"
q
(
"DELETE FROM tobj WHERE tid=?"
,
args
)
data_id_list
=
[
x
for
x
,
in
q
(
"SELECT data_id"
+
sql
,
args
)
if
x
]
q
(
"DELETE"
+
sql
,
args
)
q
(
"DELETE FROM ttrans WHERE ttid=?"
,
args
)
q
(
"DELETE FROM ttrans WHERE ttid=?"
,
args
)
self
.
releaseData
(
data_id_list
,
True
)
def
deleteTransaction
(
self
,
tid
):
def
deleteTransaction
(
self
,
tid
):
tid
=
util
.
u64
(
tid
)
tid
=
util
.
u64
(
tid
)
...
...
neo/storage/transactions.py
View file @
58d0b602
...
@@ -290,7 +290,10 @@ class TransactionManager(object):
...
@@ -290,7 +290,10 @@ class TransactionManager(object):
if
not
even_if_locked
:
if
not
even_if_locked
:
return
return
else
:
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
# unlock any object
for
oid
in
transaction
.
store_dict
,
transaction
.
checked_set
:
for
oid
in
transaction
.
store_dict
,
transaction
.
checked_set
:
for
oid
in
oid
:
for
oid
in
oid
:
...
...
neo/tests/threaded/test.py
View file @
58d0b602
...
@@ -211,15 +211,21 @@ class Test(NEOThreadedTest):
...
@@ -211,15 +211,21 @@ class Test(NEOThreadedTest):
data_info
[
key
]
=
0
data_info
[
key
]
=
0
storage
.
sync
()
storage
.
sync
()
txn
=
[
transaction
.
Transaction
()
for
x
in
xrange
(
3
)]
txn
=
[
transaction
.
Transaction
()
for
x
in
xrange
(
4
)]
for
t
in
txn
:
for
t
in
txn
:
storage
.
tpc_begin
(
t
)
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
,
data
,
''
,
t
)
tid
=
None
tid
=
None
data_info
[
key
]
=
4
storage
.
sync
()
self
.
assertEqual
(
data_info
,
cluster
.
storage
.
getDataLockInfo
())
storage
.
tpc_abort
(
txn
.
pop
())
for
t
in
txn
:
for
t
in
txn
:
storage
.
tpc_vote
(
t
)
storage
.
tpc_vote
(
t
)
data_info
[
key
]
=
3
storage
.
sync
()
data_info
[
key
]
-=
1
self
.
assertEqual
(
data_info
,
cluster
.
storage
.
getDataLockInfo
())
self
.
assertEqual
(
data_info
,
cluster
.
storage
.
getDataLockInfo
())
storage
.
tpc_abort
(
txn
[
1
])
storage
.
tpc_abort
(
txn
[
1
])
...
...
Julien Muchembled
@jm
mentioned in commit
3bf2a0c6
·
Mar 31, 2017
mentioned in commit
3bf2a0c6
mentioned in commit 3bf2a0c69d2bcf41c8c1cfb7762c64f96a53d559
Toggle commit list
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