Issue 32 in deseb: evolvedb fails:

1 view
Skip to first unread message

codesite...@google.com

unread,
Jul 16, 2008, 12:24:52 AM7/16/08
to deseb-...@googlegroups.com
Issue 32: evolvedb fails:
http://code.google.com/p/deseb/issues/detail?id=32

New issue report by garthk:
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Issue attributes:
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

codesite...@google.com

unread,
Jul 16, 2008, 12:29:52 AM7/16/08
to deseb-...@googlegroups.com

Comment #1 by garthk:
D'oh! I slipped and hit Enter.

I have a relatively complicated upgrade to apply. 'manage evolvedb'
would fail when I
tried to apply the upgrade:

Traceback (most recent call last):
File "./manage", line 11, in <module>
execute_manager(settings)

File "/Users/garth/git/MDS-git/trunk/django/core/management/__init__.py",
line 301,
in execute_manager
utility.execute()

File "/Users/garth/git/MDS-git/trunk/django/core/management/__init__.py",
line 248,
in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/garth/git/MDS-git/trunk/django/core/management/base.py",
line 77, in
run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/garth/git/MDS-git/trunk/django/core/management/base.py",
line 91, in
execute
output = self.handle(*args, **options)

File "/Users/garth/git/MDS-git/trunk/deseb/management/commands/evolvedb.py", line
39, in handle
self.handle_app(app, **options)

File "/Users/garth/git/MDS-git/trunk/deseb/management/commands/evolvedb.py", line
47, in handle_app
options.get('managed_upgrade_only', False))
File "/Users/garth/git/MDS-git/trunk/deseb/schema_evolution.py", line
708, in evolvedb
connection._commit() # commit changes
File "/Users/garth/git/MDS-git/trunk/django/db/backends/__init__.py",
line 20, in
_commit
return self.connection.commit()
_mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you
can't run this
command now")

(The line numbers are different from trunk r77; I've been applying a
few fixes.)

Every time I see "Commands out of sync", I suspect use of transaction
commands at the
wrong time.

Defining and using a new run_commands function wrapped in
django.db.transaction.commit_on_success fixed the problem. I've
attached the source
for run_commands and the modified evolvedb.

Attachments:
schema_evolution__evolvedb.py 4.3 KB

codesite...@google.com

unread,
Jul 16, 2008, 12:36:54 AM7/16/08
to deseb-...@googlegroups.com

Comment #2 by burchik:
Have never seen this error before. Kinda related to recent django trunk
I think.
But how do I repeat the error on my computer?


Issue attribute updates:
Status: NeedInfo

codesite...@google.com

unread,
Jul 16, 2008, 4:18:32 AM7/16/08
to deseb-...@googlegroups.com

Comment #3 by garthk:
The patch moves the command execution into a method using Django's documented transaction handling
method. If it doesn't break your tests, why not just roll it out — even if your custom SQL changes don't
happen to force the symptom?

That said, send me mail (garth at deadlybloodyserious dot com), and I'll send you the old and new model
definitions.

For an exact environment match, you'll need Python 2.5.1 with django/trunk r7920, MySQLdb.__version ==
'1.2.2', and MySQL 5.0.51b.

codesite...@google.com

unread,
Jul 16, 2008, 5:25:43 AM7/16/08
to deseb-...@googlegroups.com

Comment #4 by burchik:
Well, how do I know if this change will cause any other issues to
happen from time to
time?


Issue attribute updates:
Status: Accepted

codesite...@google.com

unread,
Jul 16, 2008, 10:38:18 PM7/16/08
to deseb-...@googlegroups.com

Comment #5 by garthk:
Excellent question — how do you know if *any* change will cause other issues? That's
what unit tests are for.

I'd hold for a while yet, regardless: I'm getting the error message again despite the
suggested code change. I'll let you know if I nail it down.

Reply all
Reply to author
Forward
0 new messages