Commit fbb71b46 authored by Julien Muchembled's avatar Julien Muchembled

client: fix regression that broke Storage.deleteObject (ExternalGC)

This fixes commit d90c5b83
("Allow NEO to store empty values").
parent 5c8f9e14
...@@ -151,8 +151,7 @@ class Storage(BaseStorage.BaseStorage, ...@@ -151,8 +151,7 @@ class Storage(BaseStorage.BaseStorage,
@check_read_only @check_read_only
def deleteObject(self, oid, serial, transaction): def deleteObject(self, oid, serial, transaction):
self.app.store(oid=oid, serial=serial, data='', version=None, self.app.store(oid, serial, None, None, transaction)
transaction=transaction)
# mutliple revisions # mutliple revisions
def loadSerial(self, oid, serial): def loadSerial(self, oid, serial):
......
...@@ -21,6 +21,7 @@ import transaction ...@@ -21,6 +21,7 @@ import transaction
import unittest import unittest
from thread import get_ident from thread import get_ident
from persistent import Persistent from persistent import Persistent
from ZODB import POSException
from neo.storage.transactions import TransactionManager, \ from neo.storage.transactions import TransactionManager, \
DelayedError, ConflictError DelayedError, ConflictError
from neo.lib.connection import MTClientConnection from neo.lib.connection import MTClientConnection
...@@ -65,6 +66,31 @@ class Test(NEOThreadedTest): ...@@ -65,6 +66,31 @@ class Test(NEOThreadedTest):
finally: finally:
cluster.stop() cluster.stop()
def testDeleteObject(self):
cluster = NEOCluster()
try:
cluster.start()
storage = cluster.getZODBStorage()
for clear_cache in 0, 1:
for tst in 'a.', 'bcd.':
oid = storage.new_oid()
serial = None
for data in tst:
txn = transaction.Transaction()
storage.tpc_begin(txn)
if data == '.':
storage.deleteObject(oid, serial, txn)
else:
storage.store(oid, serial, data, '', txn)
storage.tpc_vote(txn)
serial = storage.tpc_finish(txn)
if clear_cache:
storage._cache.clear()
self.assertRaises(POSException.POSKeyError,
storage.load, oid, '')
finally:
cluster.stop()
def testStorageDataLock(self): def testStorageDataLock(self):
cluster = NEOCluster() cluster = NEOCluster()
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment