[CalendarServer-changes] [5846] CalendarServer/branches/new-store/txdav

source_changes at macosforge.org source_changes at macosforge.org
Tue Jul 6 16:15:45 PDT 2010


Revision: 5846
          http://trac.macosforge.org/projects/calendarserver/changeset/5846
Author:   glyph at apple.com
Date:     2010-07-06 16:15:43 -0700 (Tue, 06 Jul 2010)
Log Message:
-----------
give transactions an optional name, to assist in garbage-collection debugging.

Modified Paths:
--------------
    CalendarServer/branches/new-store/txdav/common/datastore/file.py
    CalendarServer/branches/new-store/txdav/datastore/file.py

Modified: CalendarServer/branches/new-store/txdav/common/datastore/file.py
===================================================================
--- CalendarServer/branches/new-store/txdav/common/datastore/file.py	2010-07-06 19:59:58 UTC (rev 5845)
+++ CalendarServer/branches/new-store/txdav/common/datastore/file.py	2010-07-06 23:15:43 UTC (rev 5846)
@@ -76,13 +76,13 @@
         self.enableAddressBooks = enableAddressBooks
         self._transactionClass = CommonStoreTransaction
 
-    def newTransaction(self):
+    def newTransaction(self, name='no name'):
         """
         Create a new transaction.
 
         @see Transaction
         """
-        return self._transactionClass(self, self.enableCalendars, self.enableAddressBooks)
+        return self._transactionClass(self, name, self.enableCalendars, self.enableAddressBooks)
 
 class CommonStoreTransaction(DataStoreTransaction):
     """
@@ -94,7 +94,7 @@
 
     _homeClass = {}
 
-    def __init__(self, dataStore, enableCalendars, enableAddressBooks):
+    def __init__(self, dataStore, name, enableCalendars, enableAddressBooks):
         """
         Initialize a transaction; do not call this directly, instead call
         L{DataStore.newTransaction}.
@@ -108,7 +108,7 @@
         from txcaldav.calendarstore.file import CalendarHome
         from txcarddav.addressbookstore.file import AddressBookHome
 
-        super(CommonStoreTransaction, self).__init__(dataStore)
+        super(CommonStoreTransaction, self).__init__(dataStore, name)
         self._homes = {}
         self._homes[ECALENDARTYPE] = {}
         self._homes[EADDRESSBOOKTYPE] = {}

Modified: CalendarServer/branches/new-store/txdav/datastore/file.py
===================================================================
--- CalendarServer/branches/new-store/txdav/datastore/file.py	2010-07-06 19:59:58 UTC (rev 5845)
+++ CalendarServer/branches/new-store/txdav/datastore/file.py	2010-07-06 23:15:43 UTC (rev 5846)
@@ -96,7 +96,7 @@
     def __repr__(self):
         return "<%s: %s>" % (self.__class__.__name__, self._path.path)
 
-    def newTransaction(self):
+    def newTransaction(self, name='no name'):
         """
         Create a new transaction.
 
@@ -111,13 +111,16 @@
     Diagnostic tool to find transactions that were never committed.
     """
 
-    def __init__(self):
+    def __init__(self, name):
+        self.name = name
         self.done = False
         self.info = []
 
     def __del__(self):
         if not self.done and self.info:
-            print '**** UNCOMMITTED TRANSACTION BEING GARBAGE COLLECTED ****'
+            print '**** UNCOMMITTED TRANSACTION (%s) BEING GARBAGE COLLECTED ****' % (
+                self.name,
+            )
             for info in self.info:
                 print '   ', info
             print '---- END OF OPERATIONS'
@@ -129,7 +132,7 @@
     In-memory implementation of a data store transaction.
     """
 
-    def __init__(self, dataStore):
+    def __init__(self, dataStore, name):
         """
         Initialize a transaction; do not call this directly, instead call
         L{CalendarStore.newTransaction}.
@@ -141,7 +144,7 @@
         self._dataStore = dataStore
         self._termination = None
         self._operations = []
-        self._tracker = _CommitTracker()
+        self._tracker = _CommitTracker(name)
 
 
     def store(self):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100706/02f8af7a/attachment.html>


More information about the calendarserver-changes mailing list