[CalendarServer-dev] [Calendar and Contacts Server] #471: Migration creates not null constraint violation
Calendar and Contacts Server
trac at macosforge.org
Tue Dec 27 03:50:29 PST 2011
#471: Migration creates not null constraint violation
----------------------------------+-----------------------------------------
Reporter: mail@… | Owner: wsanchez@…
Type: Defect | Status: new
Priority: 5: Not set | Milestone:
Component: Calendar Server | Severity: Other
Keywords: | Radar:
----------------------------------+-----------------------------------------
I updated my calendar server today to current trunk and got the following:
{{{
root at vserver:~ # calendarserver_dbinspect
Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 388, in errback
self._startRunCallbacks(fail)
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 455, in _startRunCallbacks
self._runCallbacks()
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 542, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 1076, in gotResult
_inlineCallbacks(r, g, deferred)
--- <exception caught here> ---
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 1018, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib64/python2.7/site-packages/twisted/python/failure.py",
line 350, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib64/python2.7/site-
packages/txdav/common/datastore/upgrade/sql/upgrade.py", line 117, in
databaseUpgrade
yield self.upgradeVersion(actual_version, required_version, dialect)
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 1018, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib64/python2.7/site-packages/twisted/python/failure.py",
line 350, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib64/python2.7/site-
packages/txdav/common/datastore/upgrade/sql/upgrade.py", line 180, in
upgradeVersion
yield self.applyUpgrade(fp)
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 1018, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib64/python2.7/site-packages/twisted/python/failure.py",
line 350, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib64/python2.7/site-
packages/txdav/common/datastore/upgrade/sql/upgrade.py", line 345, in
applyUpgrade
yield doUpgrade(self.sqlStore)
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 1018, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib64/python2.7/site-packages/twisted/python/failure.py",
line 350, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib64/python2.7/site-
packages/txdav/common/datastore/upgrade/sql/upgrades/upgrade_from_1_to_2.py",
line 38, in doUpgrade
yield splitCalendars(sqlStore)
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 1018, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib64/python2.7/site-packages/twisted/python/failure.py",
line 350, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib64/python2.7/site-
packages/txdav/common/datastore/upgrade/sql/upgrades/upgrade_from_1_to_2.py",
line 85, in splitCalendars
yield doToEachCalendarHomeNotAtVersion(sqlStore, UPGRADE_TO_VERSION,
doIt)
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 1018, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib64/python2.7/site-packages/twisted/python/failure.py",
line 350, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib64/python2.7/site-
packages/txdav/common/datastore/upgrade/sql/upgrades/util.py", line 90, in
doToEachCalendarHomeNotAtVersion
yield doIt(home)
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 1018, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib64/python2.7/site-packages/twisted/python/failure.py",
line 350, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib64/python2.7/site-
packages/txdav/common/datastore/upgrade/sql/upgrades/upgrade_from_1_to_2.py",
line 82, in doIt
yield home.splitCalendars()
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 1018, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib64/python2.7/site-packages/twisted/python/failure.py",
line 350, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib64/python2.7/site-packages/txdav/caldav/datastore/sql.py",
line 250, in splitCalendars
split_count = yield calendar.splitCollectionByComponentTypes()
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 1018, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib64/python2.7/site-packages/twisted/python/failure.py",
line 350, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib64/python2.7/site-packages/txdav/caldav/datastore/sql.py",
line 458, in splitCollectionByComponentTypes
yield self._splitComponentType(component)
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 1018, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib64/python2.7/site-packages/twisted/python/failure.py",
line 350, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib64/python2.7/site-packages/txdav/caldav/datastore/sql.py",
line 497, in _splitComponentType
newcalendar = yield self._home.createCalendarWithName("%s-%s" %
(self._name, component.lower(),))
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 1018, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib64/python2.7/site-packages/twisted/python/failure.py",
line 350, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib64/python2.7/site-packages/txdav/common/datastore/sql.py",
line 973, in createChildWithName
yield self._childClass.create(self, name)
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 1018, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib64/python2.7/site-packages/twisted/python/failure.py",
line 350, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib64/python2.7/site-packages/txdav/common/datastore/sql.py",
line 1951, in create
yield child._initSyncToken()
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 1018, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib64/python2.7/site-packages/twisted/python/failure.py",
line 350, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib64/python2.7/site-packages/txdav/common/datastore/sql.py",
line 1404, in _initSyncToken
collectionName=self._name)))[0][0]
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py",
line 1018, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib64/python2.7/site-packages/twisted/python/failure.py",
line 350, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib64/python2.7/site-packages/txdav/common/datastore/sql.py",
line 524, in execSQL
results = (yield self._sqlTxn.execSQL(*a, **kw))
File "/usr/lib64/python2.7/site-packages/twext/internet/threadutils.py",
line 64, in _oneWorkUnit
result = instruction()
File "/usr/lib64/python2.7/site-packages/twext/enterprise/adbapi2.py",
line 293, in <lambda>
lambda : self._reallyExecSQL(*args, **kw)
File "/usr/lib64/python2.7/site-packages/twext/enterprise/adbapi2.py",
line 230, in _reallyExecSQL
self._cursor.execute(sql, args)
File "/usr/lib64/python2.7/site-
packages/txdav/base/datastore/dbapiclient.py", line 76, in execute
self.realCursor.execute(sql, args)
File "/usr/lib64/python2.7/site-packages/pgdb.py", line 259, in execute
self.executemany(operation, (params,))
File "/usr/lib64/python2.7/site-packages/pgdb.py", line 289, in
executemany
raise DatabaseError("error '%s' in '%s'" % (msg, sql))
pg.DatabaseError: error 'FEHLER: NULL-Wert in Spalte »revision« verletzt
Not-Null-Constraint
' in 'insert into CALENDAR_OBJECT_REVISIONS (CALENDAR_HOME_RESOURCE_ID,
CALENDAR_NAME, CALENDAR_RESOURCE_ID, DELETED, RESOURCE_NAME) values (1,
'calendar-vtodo', 2872, False, NULL) returning REVISION'
}}}
This happened on start of either the calendarserver or
calendarserver_shell or the calendarserver_dbinspect.
The only way arround it seemed to drop the not null constraint in the db.
{{{
caldav=> ALTER TABLE calendar_object_revisions alter revision DROP NOT
NULL;
}}}
I have the following in my db:
{{{
+--------------------------------------+------------+--------------------------------------------+-----------+
| Owner UID | Short Name |
Calendar | Resources |
|--------------------------------------+------------+--------------------------------------------+-----------|
| 272c501f-366c-517d-8af3-44c37777ef83 | felix | 029D1394-0FBB-
4CA4-9BE4-9477E0A27D4B | 81 |
| 272c501f-366c-517d-8af3-44c37777ef83 | felix | 029D1394-0FBB-
4CA4-9BE4-9477E0A27D4B-vtodo | 1 |
| 272c501f-366c-517d-8af3-44c37777ef83 | felix |
99F86220-B8F3-4639-9A05-F87B4B007C1E | 40 |
| 272c501f-366c-517d-8af3-44c37777ef83 | felix | calendar
| 394 |
| 272c501f-366c-517d-8af3-44c37777ef83 | felix | calendar-vtodo
| 2 |
| 272c501f-366c-517d-8af3-44c37777ef83 | felix | inbox
| 12 |
| 83dbe083-6779-5acc-b21c-9627b581b4fb | mac | D335E491-8502-42AD-
9E26-6848D2255FD8 | 3 |
| 83dbe083-6779-5acc-b21c-9627b581b4fb | mac | calendar
| 5 |
| 83dbe083-6779-5acc-b21c-9627b581b4fb | mac | calendar-vtodo
| 1 |
| 83dbe083-6779-5acc-b21c-9627b581b4fb | mac | inbox
| 1 |
+--------------------------------------+------------+--------------------------------------------+-----------+
}}}
How should the revisions be set?
--
Ticket URL: <http://trac.calendarserver.org/ticket/471>
Calendar and Contacts Server </>
HTTP/WebDAV/CalDAV Server
More information about the calendarserver-dev
mailing list