Rev 2365: Disable read locks blocking on write locks. in http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/simple_locking

John Arbash Meinel john at arbash-meinel.com
Mon Mar 19 21:45:23 GMT 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/simple_locking

------------------------------------------------------------
revno: 2365
revision-id: john at arbash-meinel.com-20070319214503-1t048spp6n2tbro7
parent: john at arbash-meinel.com-20070319205618-21plqrdf0feihonk
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: simple_locking
timestamp: Mon 2007-03-19 16:45:03 -0500
message:
  Disable read locks blocking on write locks.
  This requires some small test updates to disable that sort of check.
  But it should allow the rest of the test suite to pass on non-win32
modified:
  bzrlib/lock.py                 lock.py-20050527050856-ec090bb51bc03349
  bzrlib/tests/per_lock/test_lock.py test_lock.py-20070313190612-mfpoa7t8kvrgrhj2-1
  bzrlib/tests/per_lock/test_temporary_write_lock.py test_temporary_write-20070314233412-xp3ocbyvw3woa03w-1
-------------- next part --------------
=== modified file 'bzrlib/lock.py'
--- a/bzrlib/lock.py	2007-03-19 20:56:18 +0000
+++ b/bzrlib/lock.py	2007-03-19 21:45:03 +0000
@@ -158,8 +158,8 @@
         def __init__(self, filename):
             super(_fcntl_ReadLock, self).__init__()
             self.filename = osutils.realpath(filename)
-            if self.filename in _fcntl_WriteLock._open_locks:
-                raise errors.LockContention(self.filename)
+            # if self.filename in _fcntl_WriteLock._open_locks:
+            #     raise errors.LockContention(self.filename)
             _fcntl_ReadLock._open_locks.setdefault(self.filename, 0)
             _fcntl_ReadLock._open_locks[self.filename] += 1
             self._open(filename, 'rb')

=== modified file 'bzrlib/tests/per_lock/test_lock.py'
--- a/bzrlib/tests/per_lock/test_lock.py	2007-03-15 23:24:59 +0000
+++ b/bzrlib/tests/per_lock/test_lock.py	2007-03-19 21:45:03 +0000
@@ -113,7 +113,10 @@
         a_lock = self.write_lock('a-file')
         a_lock.unlock()
 
-    def test_write_then_read_excludes(self):
+    # TODO: jam 20070319 fcntl read locks are not currently fully
+    #       mutually exclusive with write locks. This will be fixed
+    #       in the next release.
+    def _disabled_test_write_then_read_excludes(self):
         """If a file is write-locked, taking out a read lock should fail.
 
         The file is exclusively owned by the write lock, so we shouldn't be

=== modified file 'bzrlib/tests/per_lock/test_temporary_write_lock.py'
--- a/bzrlib/tests/per_lock/test_temporary_write_lock.py	2007-03-15 18:55:59 +0000
+++ b/bzrlib/tests/per_lock/test_temporary_write_lock.py	2007-03-19 21:45:03 +0000
@@ -58,8 +58,11 @@
             try:
                 self.assertRaises(errors.LockContention,
                                   self.write_lock, 'a-file')
-                self.assertRaises(errors.LockContention,
-                                  self.read_lock, 'a-file')
+                # TODO: jam 20070319 fcntl read locks are not currently fully
+                #       mutually exclusive with write locks. This will be fixed
+                #       in the next release.
+                # self.assertRaises(errors.LockContention,
+                #                   self.read_lock, 'a-file')
             finally:
                 a_lock = t_write_lock.restore_read_lock()
             # Now we only have a read lock, so we should be able to grab



More information about the bazaar-commits mailing list