Closed Bug 683742 Opened 14 years ago Closed 14 years ago

Can't create new files/versions for repacked jetpacks

Categories

(addons.mozilla.org Graveyard :: API, defect, P1)

x86
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: clouserw, Assigned: jbalogh)

Details

We attempted to upgrade from 1.0 to 1.1rc1 today. For each success in the logs we got this: Aug 31 14:23:44 celery-dev1.addons.phx1.mozilla.com: [][] z.jp.repack:ERROR [123348]: Error creating new version/file. :/data/www/addons-dev.allizom.org/zamboni/apps/files/tasks.py:156#012Traceback (most recent call last):#012 File "/data/www/addons-dev.allizom.org/zamboni/apps/files/tasks.py", line 150, in repackage_jetpack#012 ApplicationsVersions.objects.create(**app)#012 File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/models/manager.py", line 138, in create#012 return self.get_query_set().create(**kwargs)#012 File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/models/query.py", line 360, in create#012 obj.save(force_insert=True, using=self.db)#012 File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/models/base.py", line 463, in save#012 self.save_base(using=using, force_insert=force_insert, force_update=force_update)#012 File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/models/base.py", line 556, in save_base#012 result = manager._insert(values, return_id=update_pk, using=using)#012 File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/models/manager.py", line 198, in _insert#012 return insert_query(self.model, values, **kwargs)#012 File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/models/query.py", line 1448, in insert_query#012 return query.get_compiler(using=using).execute_sql(return_id)#012 File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/models/sql/compiler.py", line 806, in execute_sql#012 cursor = super(SQLInsertCompiler, self).execute_sql(None)#012 File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/models/sql/compiler.py", line 750, in execute_sql#012 cursor.execute(sql, params)#012 File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/backends/mysql/base.py", line 86, in execute#012 return self.cursor.execute(query, args)#012 File "/usr/lib64/python2 syslog cuts off tracebacks, so it's not very helpful. It comes from apps/files/tasks.py:237
# Sync the compatible apps of the new version. for app in old_version.apps.values(): app.update(version_id=new_version.id, id=None) ---> ApplicationsVersions.objects.create(**app)
In [7]: a = Addon.objects.get(id=187588L) In [8]: a.versions.all() Out[8]: [<Version: 1.11.sdk.1.1>, <Version: 1.11>, <Version: 1.10>, <Version: 1.9>, <Version: 1.8>, <Version: 1.7>, <Version: 1.6>, <Version: 1.5>, <Version: 1.4>, <Version: 1.3>, <Version: 1.2>, <Version: 1.1>, <Version: 1.0>] In [9]: a,b = a.versions.all()[:2] In [10]: a Out[10]: <Version: 1.11.sdk.1.1> In [11]: b Out[11]: <Version: 1.11> In [12]: a.apps.values() Out[12]: [{'max_id': 421L, 'min_id': 349L, 'application_id': 1L, 'id': 121623L, 'version_id': 1266570L}] In [13]: v = a.apps.values()[0] In [14]: v Out[14]: {'application_id': 1L, 'id': 121623L, 'max_id': 421L, 'min_id': 349L, 'version_id': 1266570L} In [15]: v.update(version_id=a.id, id=None) In [16]: v Out[16]: {'application_id': 1L, 'id': None, 'max_id': 421L, 'min_id': 349L, 'version_id': 1266570L} In [17]: from versions.models import ApplicationsVersions In [18]: ApplicationsVersions.objects.create(**v) --------------------------------------------------------------------------- IntegrityError Traceback (most recent call last) /data/www/addons-dev.allizom.org/zamboni/<ipython console> in <module>() /data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/models/manager.pyc in create(self, **kwargs) 136 137 def create(self, **kwargs): --> 138 return self.get_query_set().create(**kwargs) 139 140 def filter(self, *args, **kwargs): IntegrityError: (1062, "Duplicate entry '1-1266570' for key 'application_id'")
This happens because we already have some app compatibility for this version via the install.rdf parsing. The fix is to merge apps if the already exist.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: 6.2.3 → 6.2.4
Priority: -- → P1
Using the master db to avoid slave lag: https://github.com/jbalogh/zamboni/commit/99ff4ab4f Making try/except blocks more granular and avoiding crashing in app syncing: https://github.com/jbalogh/zamboni/commit/9c6cead (there's enough info in the logs that I can fix up any errors) Using transactions so we don't get versions without proper files: https://github.com/jbalogh/zamboni/commit/76ac5773 I think the main problem was the slave lag.
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.