[CalendarServer-changes] [13197] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue Apr 8 09:31:33 PDT 2014
Revision: 13197
http://trac.calendarserver.org//changeset/13197
Author: cdaboo at apple.com
Date: 2014-04-08 09:31:32 -0700 (Tue, 08 Apr 2014)
Log Message:
-----------
Make sure all transactions have meaningful labels set. Fix missing commit causing server hang when txn timeout logging is present.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/directory/augment.py
CalendarServer/trunk/twistedcaldav/upgrade.py
CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/mailgateway.py
CalendarServer/trunk/txdav/common/datastore/sql.py
CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrade.py
CalendarServer/trunk/txdav/common/datastore/work/inbox_cleanup.py
CalendarServer/trunk/txdav/common/datastore/work/revision_cleanup.py
CalendarServer/trunk/txdav/who/augment.py
CalendarServer/trunk/txdav/who/delegates.py
CalendarServer/trunk/txdav/who/groups.py
Modified: CalendarServer/trunk/twistedcaldav/directory/augment.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/augment.py 2014-04-08 16:28:26 UTC (rev 13196)
+++ CalendarServer/trunk/twistedcaldav/directory/augment.py 2014-04-08 16:31:32 UTC (rev 13197)
@@ -246,7 +246,7 @@
"""
self.cachedRecords.clear()
- return succeed(None)
+ return None
def clean(self):
@@ -492,7 +492,7 @@
log.error("Failed to parse XML augments file during cache refresh - ignoring")
self.lastCached = time.time()
- return succeed(None)
+ return None
def clean(self):
Modified: CalendarServer/trunk/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/upgrade.py 2014-04-08 16:28:26 UTC (rev 13196)
+++ CalendarServer/trunk/twistedcaldav/upgrade.py 2014-04-08 16:31:32 UTC (rev 13197)
@@ -746,7 +746,6 @@
@inlineCallbacks
def upgradeData(config, directory):
-
triggerPath = os.path.join(config.ServerRoot, TRIGGER_FILE)
if os.path.exists(triggerPath):
try:
@@ -1008,15 +1007,17 @@
log.warn("Migrated %d auto-schedule settings" % (len(augmentRecords),))
+
def loadDelegatesFromXML(xmlFile, service):
loader = XMLCalendarUserProxyLoader(xmlFile, service)
return loader.updateProxyDB()
+
@inlineCallbacks
def migrateDelegatesToStore(service, store):
directory = store.directoryService()
- txn = store.newTransaction()
+ txn = store.newTransaction(label="migrateDelegatesToStore")
for groupName, memberUID in (
yield service.query(
"select GROUPNAME, MEMBER from GROUPS"
@@ -1128,7 +1129,6 @@
else:
sqliteProxyService = None
-
# # Populate the group membership cache
# if (self.config.GroupCaching.Enabled and
# self.config.GroupCaching.EnableUpdater):
Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/mailgateway.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/mailgateway.py 2014-04-08 16:28:26 UTC (rev 13196)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/mailgateway.py 2014-04-08 16:31:32 UTC (rev 13197)
@@ -229,7 +229,7 @@
@type store: L{CommonDataStore}
"""
oldDB = MailGatewayTokensDatabase(path)
- txn = store.newTransaction()
+ txn = store.newTransaction(label="migrateTokensToStore")
for token, organizer, attendee, icaluid in oldDB.getAllTokens():
yield txn.imipCreateToken(organizer, attendee, icaluid, token=token)
yield txn.commit()
Modified: CalendarServer/trunk/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql.py 2014-04-08 16:28:26 UTC (rev 13196)
+++ CalendarServer/trunk/txdav/common/datastore/sql.py 2014-04-08 16:31:32 UTC (rev 13197)
@@ -444,6 +444,7 @@
if self.delayedTimeout:
self.delayedTimeout.cancel()
self.delayedTimeout = None
+ return succeed(None)
def _installLogTimer(self):
@@ -503,6 +504,9 @@
notifierFactories, label, migrating=False, disableCache=False,
authz_uid=None,
):
+ if label == "unlabeled" or not label:
+ raise AssertionError("Please make sure your transactions have a proper label")
+
self._store = store
self._calendarHomes = {}
self._addressbookHomes = {}
Modified: CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrade.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrade.py 2014-04-08 16:28:26 UTC (rev 13196)
+++ CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrade.py 2014-04-08 16:31:32 UTC (rev 13197)
@@ -48,7 +48,7 @@
@inlineCallbacks
def stepWithResult(self, result):
- sqlTxn = self.sqlStore.newTransaction()
+ sqlTxn = self.sqlStore.newTransaction(label="UpgradeAcquireLockStep.stepWithResult")
yield sqlTxn.acquireUpgradeLock()
yield sqlTxn.commit()
@@ -69,7 +69,7 @@
@inlineCallbacks
def stepWithResult(self, result):
- sqlTxn = self.sqlStore.newTransaction()
+ sqlTxn = self.sqlStore.newTransaction(label="UpgradeReleaseLockStep.stepWithResult")
yield sqlTxn.releaseUpgradeLock()
yield sqlTxn.commit()
@@ -170,7 +170,7 @@
self.log.warn("Required database key %s: %s." % (self.versionKey, required_version,))
# Get the schema version in the current database
- sqlTxn = self.sqlStore.newTransaction()
+ sqlTxn = self.sqlStore.newTransaction(label="UpgradeDatabaseCoreStep.getVersions")
dialect = sqlTxn.dialect
try:
actual_version = yield sqlTxn.calendarserverValue(self.versionKey)
Modified: CalendarServer/trunk/txdav/common/datastore/work/inbox_cleanup.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/work/inbox_cleanup.py 2014-04-08 16:28:26 UTC (rev 13196)
+++ CalendarServer/trunk/txdav/common/datastore/work/inbox_cleanup.py 2014-04-08 16:31:32 UTC (rev 13197)
@@ -149,7 +149,7 @@
@inlineCallbacks
def scheduleFirstInboxCleanup(store, seconds):
if config.InboxCleanup.Enabled:
- txn = store.newTransaction()
+ txn = store.newTransaction(label="scheduleFirstInboxCleanup")
wp = yield InboxCleanupWork._schedule(txn, seconds)
yield txn.commit()
returnValue(wp)
Modified: CalendarServer/trunk/txdav/common/datastore/work/revision_cleanup.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/work/revision_cleanup.py 2014-04-08 16:28:26 UTC (rev 13196)
+++ CalendarServer/trunk/txdav/common/datastore/work/revision_cleanup.py 2014-04-08 16:31:32 UTC (rev 13197)
@@ -130,7 +130,7 @@
@inlineCallbacks
def scheduleFirstFindMinRevision(store, seconds):
if config.RevisionCleanup.Enabled:
- txn = store.newTransaction()
+ txn = store.newTransaction(label="scheduleFirstFindMinRevision")
wp = yield FindMinValidRevisionWork._schedule(txn, seconds)
yield txn.commit()
returnValue(wp)
Modified: CalendarServer/trunk/txdav/who/augment.py
===================================================================
--- CalendarServer/trunk/txdav/who/augment.py 2014-04-08 16:28:26 UTC (rev 13196)
+++ CalendarServer/trunk/txdav/who/augment.py 2014-04-08 16:31:32 UTC (rev 13197)
@@ -251,7 +251,6 @@
fields[field] = value
-
@inlineCallbacks
def _augment(self, record):
if record is None:
@@ -380,7 +379,7 @@
def groups(self):
augmented = []
- txn = self.service._store.newTransaction()
+ txn = self.service._store.newTransaction(label="AugmentedDirectoryRecord.groups")
groupUIDs = yield txn.groupsFor(self.uid)
for groupUID in groupUIDs:
@@ -390,6 +389,8 @@
if groupRecord:
augmented.append((yield self.service._augment(groupRecord)))
+ yield txn.commit()
+
returnValue(augmented)
Modified: CalendarServer/trunk/txdav/who/delegates.py
===================================================================
--- CalendarServer/trunk/txdav/who/delegates.py 2014-04-08 16:28:26 UTC (rev 13196)
+++ CalendarServer/trunk/txdav/who/delegates.py 2014-04-08 16:31:32 UTC (rev 13197)
@@ -66,9 +66,9 @@
the members will consist of the records who have delegated *to*
this record.
"""
- parentUID, proxyType = self.uid.split(u"#")
+ parentUID, _ignore_proxyType = self.uid.split(u"#")
- txn = self.service._store.newTransaction()
+ txn = self.service._store.newTransaction(label="DirectoryRecord.members")
if self.recordType in (
RecordType.readDelegateGroup, RecordType.writeDelegateGroup
@@ -95,7 +95,6 @@
returnValue(records)
-
@inlineCallbacks
def setMembers(self, memberRecords):
"""
@@ -109,7 +108,7 @@
):
raise NotAllowedError("Setting members not supported")
- parentUID, proxyType = self.uid.split(u"#")
+ parentUID, _ignore_proxyType = self.uid.split(u"#")
readWrite = (self.recordType is RecordType.writeDelegateGroup)
log.debug(
@@ -118,7 +117,7 @@
m=[r.uid for r in memberRecords]
)
- txn = self.service._store.newTransaction()
+ txn = self.service._store.newTransaction(label="DirectoryRecord.setMembers")
yield txn.removeDelegates(parentUID, readWrite)
yield txn.removeDelegateGroups(parentUID, readWrite)
@@ -143,6 +142,7 @@
}.get(recordType, None)
+
def proxyTypeToRecordType(proxyType):
return {
"calendar-proxy-read": RecordType.readDelegateGroup,
@@ -230,7 +230,7 @@
"""
if delegate.recordType == BaseRecordType.group:
# find the groupID
- groupID, name, membershipHash, modified = yield txn.groupByUID(
+ groupID, _ignore_name, _ignore_membershipHash, _ignore_modified = yield txn.groupByUID(
delegate.uid
)
yield txn.addDelegateGroup(delegator.uid, groupID, readWrite)
@@ -238,6 +238,7 @@
yield txn.addDelegate(delegator.uid, delegate.uid, readWrite)
+
@inlineCallbacks
def removeDelegate(txn, delegator, delegate, readWrite):
"""
@@ -253,7 +254,7 @@
"""
if delegate.recordType == BaseRecordType.group:
# find the groupID
- groupID, name, membershipHash, modified = yield txn.groupByUID(
+ groupID, _ignore_name, _ignore_membershipHash, _ignore_modified = yield txn.groupByUID(
delegate.uid
)
yield txn.removeDelegateGroup(delegator.uid, groupID, readWrite)
@@ -261,6 +262,7 @@
yield txn.removeDelegate(delegator.uid, delegate.uid, readWrite)
+
@inlineCallbacks
def delegatesOf(txn, delegator, readWrite, expanded=False):
"""
@@ -287,6 +289,7 @@
returnValue(records)
+
@inlineCallbacks
def delegatedTo(txn, delegate, readWrite):
"""
Modified: CalendarServer/trunk/txdav/who/groups.py
===================================================================
--- CalendarServer/trunk/txdav/who/groups.py 2014-04-08 16:28:26 UTC (rev 13196)
+++ CalendarServer/trunk/txdav/who/groups.py 2014-04-08 16:31:32 UTC (rev 13197)
@@ -87,7 +87,7 @@
@inlineCallbacks
def scheduleNextGroupCachingUpdate(store, seconds):
- txn = store.newTransaction()
+ txn = store.newTransaction(label="scheduleNextGroupCachingUpdate")
notBefore = (
datetime.datetime.utcnow() + datetime.timedelta(seconds=seconds)
)
@@ -174,7 +174,6 @@
-
def diffAssignments(old, new):
"""
Compare two proxy assignment lists and return their differences in the form
@@ -267,11 +266,11 @@
) in changed:
readDelegateGroupID = writeDelegateGroupID = None
if readDelegateUID:
- readDelegateGroupID, _ignore_name, hash, modified = (
+ readDelegateGroupID, _ignore_name, hash, _ignore_modified = (
yield txn.groupByUID(readDelegateUID)
)
if writeDelegateUID:
- writeDelegateGroupID, _ignore_name, hash, modified = (
+ writeDelegateGroupID, _ignore_name, hash, _ignore_modified = (
yield txn.groupByUID(writeDelegateUID)
)
yield txn.assignExternalDelegates(
@@ -305,7 +304,7 @@
for member in members:
membershipHashContent.update(str(member.uid))
membershipHash = membershipHashContent.hexdigest()
- groupID, _ignore_cachedName, cachedMembershipHash, modified = (
+ groupID, _ignore_cachedName, cachedMembershipHash, _ignore_modified = (
yield txn.groupByUID(groupUID)
)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140408/8d2a0ec0/attachment-0001.html>
More information about the calendarserver-changes
mailing list