
Originally Posted by
rcashell
Instead of playing around with the transaction isolation level I would look more closely at your application and see where locks are being held on the tables and see if these need to remain on for the total duration of a transaction. In other words can the work be broken down into smaller transactions where they are either committed or rolled back which frees up the locks on the tables.
Most of the tables are InnoDB. At least the ones that I think could be involved at the moment.
All query's are handeld by a python script with Django. I use django transactions for each query.
Code:
from django.db import connection, transaction
cursor = connection.cursor()
success = cursor.execute(sqlQuery, point)
transaction.commit_unless_managed()
which is the last query in a the function saveGpsPoint. The traceback of the 'crashed' script is:
Code:
File "/home/freetrack/tcpserver/gpsparser.py", line 257, in __parseGps
gpslibs.saveGpsPoint(point)
File "/home/freetrack/tcpserver/gpslibs.py", line 75, in saveGpsPoint
success = cursor.execute(sqlQuery, point)
File "/usr/lib/python2.6/site-packages/django/db/backends/util.py", line 40, in execute
return self.cursor.execute(sql, params)
File "/usr/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 114, in execute
return self.cursor.execute(query, args)
File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 173, in execute
self.errorhandler(self, exc, value)
File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
DatabaseError: (1213, 'Deadlock found when trying to get lock; try restarting transaction')
The 'point query' in the traceback is also the last query displayed by de the debug. I'm not sure if I should look at that query or the next step taken by the script?
Bookmarks