Actions
Issue #4170
closedChecksum constraint error when syncing a package
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 45
Quarter:
Description
Failure from pulp_smash below.
pulp_rpm/tests/functional/api/test_publish.py:123:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../virtualenv/python3.6.7/lib/python3.6/site-packages/pulp_smash/pulp3/utils.py:82: in sync
return client.post(urljoin(remote['_href'], 'sync/'), data)
../../../virtualenv/python3.6.7/lib/python3.6/site-packages/pulp_smash/api.py:444: in post
return self.request('POST', url, json=json, **kwargs)
../../../virtualenv/python3.6.7/lib/python3.6/site-packages/pulp_smash/api.py:481: in request
requests.request(method, **request_kwargs),
../../../virtualenv/python3.6.7/lib/python3.6/site-packages/pulp_smash/api.py:148: in json_handler
_handle_202(client._cfg, response, client.pulp_host) # pylint:disable=protected-access
../../../virtualenv/python3.6.7/lib/python3.6/site-packages/pulp_smash/api.py:88: in _handle_202
_check_tasks(tasks, ('error',))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tasks = ({'_href': '/pulp/api/v3/tasks/6d288ec1-4562-467e-9538-ca64cd8b747c/', 'created': '2018-11-16T18:11:27.696106Z', 'crea...te-packages/django/db/backends/utils.py", line 85, in _execute\n return self.cursor.execute(sql, params)\n'}, ...},)
task_errors = ('error',)
def _check_tasks(tasks, task_errors):
"""Inspect each task's ``error``, ``exception`` and ``traceback`` fields.
If any of these fields is non-null for any tasks, raise a
``TaskReportError``.
"""
for task in tasks:
for field in task_errors:
if task[field] is not None:
msg = 'Task report {} contains a {}: {}\nFull task report: {}'
msg = msg.format(task['_href'], field, task[field], task)
> raise exceptions.TaskReportError(msg, task)
E pulp_smash.exceptions.TaskReportError: ('Task report /pulp/api/v3/tasks/6d288ec1-4562-467e-9538-ca64cd8b747c/ contains a error: {\'code\': None, \'description\': \'duplicate key value violates unique constraint "pulp_rpm_package_pkgId_key"\\nDETAIL: Key ("pkgId")=(ceb0f0bb58be244393cc565e8ee5ef0ad36884d8ba8eec74542ff47d299a34c1) already exists.\\n\', \'traceback\': \' File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/rq/worker.py", line 793, in perform_job\\n rv = job.perform()\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/rq/job.py", line 599, in perform\\n self._result = self._execute()\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/rq/job.py", line 605, in _execute\\n return self.func(*self.args, **self.kwargs)\\n File "/home/travis/build/pulp/pulp_rpm/pulp_rpm/app/tasks/synchronizing.py", line 69, in synchronize\\n loop.run_until_complete(pipeline)\\n File "/opt/python/3.6.7/lib/python3.6/asyncio/base_events.py", line 473, in run_until_complete\\n return future.result()\\n File "/home/travis/build/pulp/pulp/plugin/pulpcore/plugin/stages/api.py", line 129, in create_pipeline\\n await asyncio.gather(*futures)\\n File "/home/travis/build/pulp/pulp/plugin/pulpcore/plugin/stages/content_unit_stages.py", line 115, in __call__\\n declarative_content.content.save()\\n File "/home/travis/build/pulp/pulp/pulpcore/pulpcore/app/models/base.py", line 83, in save\\n return super().save(*args, **kwargs)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/base.py", line 718, in save\\n force_update=force_update, update_fields=update_fields)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/base.py", line 748, in save_base\\n updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/base.py", line 831, in _save_table\\n result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/base.py", line 869, in _do_insert\\n using=using, raw=raw)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method\\n return getattr(self.get_queryset(), name)(*args, **kwargs)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/query.py", line 1136, in _insert\\n return query.get_compiler(using=using).execute_sql(return_id)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1289, in execute_sql\\n cursor.execute(sql, params)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute\\n return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers\\n return executor(sql, params, many, context)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute\\n return self.cursor.execute(sql, params)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__\\n raise dj_exc_value.with_traceback(traceback) from exc_value\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute\\n return self.cursor.execute(sql, params)\\n\'}\nFull task report: {\'_href\': \'/pulp/api/v3/tasks/6d288ec1-4562-467e-9538-ca64cd8b747c/\', \'created\': \'2018-11-16T18:11:27.696106Z\', \'state\': \'failed\', \'started_at\': \'2018-11-16T18:11:27.807960Z\', \'finished_at\': \'2018-11-16T18:11:28.477947Z\', \'non_fatal_errors\': [], \'error\': {\'code\': None, \'description\': \'duplicate key value violates unique constraint "pulp_rpm_package_pkgId_key"\\nDETAIL: Key ("pkgId")=(ceb0f0bb58be244393cc565e8ee5ef0ad36884d8ba8eec74542ff47d299a34c1) already exists.\\n\', \'traceback\': \' File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/rq/worker.py", line 793, in perform_job\\n rv = job.perform()\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/rq/job.py", line 599, in perform\\n self._result = self._execute()\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/rq/job.py", line 605, in _execute\\n return self.func(*self.args, **self.kwargs)\\n File "/home/travis/build/pulp/pulp_rpm/pulp_rpm/app/tasks/synchronizing.py", line 69, in synchronize\\n loop.run_until_complete(pipeline)\\n File "/opt/python/3.6.7/lib/python3.6/asyncio/base_events.py", line 473, in run_until_complete\\n return future.result()\\n File "/home/travis/build/pulp/pulp/plugin/pulpcore/plugin/stages/api.py", line 129, in create_pipeline\\n await asyncio.gather(*futures)\\n File "/home/travis/build/pulp/pulp/plugin/pulpcore/plugin/stages/content_unit_stages.py", line 115, in __call__\\n declarative_content.content.save()\\n File "/home/travis/build/pulp/pulp/pulpcore/pulpcore/app/models/base.py", line 83, in save\\n return super().save(*args, **kwargs)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/base.py", line 718, in save\\n force_update=force_update, update_fields=update_fields)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/base.py", line 748, in save_base\\n updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/base.py", line 831, in _save_table\\n result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/base.py", line 869, in _do_insert\\n using=using, raw=raw)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method\\n return getattr(self.get_queryset(), name)(*args, **kwargs)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/query.py", line 1136, in _insert\\n return query.get_compiler(using=using).execute_sql(return_id)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1289, in execute_sql\\n cursor.execute(sql, params)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute\\n return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers\\n return executor(sql, params, many, context)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute\\n return self.cursor.execute(sql, params)\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__\\n raise dj_exc_value.with_traceback(traceback) from exc_value\\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute\\n return self.cursor.execute(sql, params)\\n\'}, \'worker\': \'/pulp/api/v3/workers/2/\', \'parent\': None, \'spawned_tasks\': [], \'progress_reports\': [{\'message\': \'Downloading and Parsing Metadata\', \'state\': \'completed\', \'total\': 5, \'done\': 5, \'suffix\': \'\', \'task\': \'/pulp/api/v3/tasks/6d288ec1-4562-467e-9538-ca64cd8b747c/\'}, {\'message\': \'Downloading Artifacts\', \'state\': \'completed\', \'total\': None, \'done\': 0, \'suffix\': \'\', \'task\': \'/pulp/api/v3/tasks/6d288ec1-4562-467e-9538-ca64cd8b747c/\'}, {\'message\': \'Associating Content\', \'state\': \'canceled\', \'total\': None, \'done\': 0, \'suffix\': \'\', \'task\': \'/pulp/api/v3/tasks/6d288ec1-4562-467e-9538-ca64cd8b747c/\'}], \'created_resources\': []}', {'_href': '/pulp/api/v3/tasks/6d288ec1-4562-467e-9538-ca64cd8b747c/', 'created': '2018-11-16T18:11:27.696106Z', 'state': 'failed', 'started_at': '2018-11-16T18:11:27.807960Z', 'finished_at': '2018-11-16T18:11:28.477947Z', 'non_fatal_errors': [], 'error': {'code': None, 'description': 'duplicate key value violates unique constraint "pulp_rpm_package_pkgId_key"\nDETAIL: Key ("pkgId")=(ceb0f0bb58be244393cc565e8ee5ef0ad36884d8ba8eec74542ff47d299a34c1) already exists.\n', 'traceback': ' File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/rq/worker.py", line 793, in perform_job\n rv = job.perform()\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/rq/job.py", line 599, in perform\n self._result = self._execute()\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/rq/job.py", line 605, in _execute\n return self.func(*self.args, **self.kwargs)\n File "/home/travis/build/pulp/pulp_rpm/pulp_rpm/app/tasks/synchronizing.py", line 69, in synchronize\n loop.run_until_complete(pipeline)\n File "/opt/python/3.6.7/lib/python3.6/asyncio/base_events.py", line 473, in run_until_complete\n return future.result()\n File "/home/travis/build/pulp/pulp/plugin/pulpcore/plugin/stages/api.py", line 129, in create_pipeline\n await asyncio.gather(*futures)\n File "/home/travis/build/pulp/pulp/plugin/pulpcore/plugin/stages/content_unit_stages.py", line 115, in __call__\n declarative_content.content.save()\n File "/home/travis/build/pulp/pulp/pulpcore/pulpcore/app/models/base.py", line 83, in save\n return super().save(*args, **kwargs)\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/base.py", line 718, in save\n force_update=force_update, update_fields=update_fields)\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/base.py", line 748, in save_base\n updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/base.py", line 831, in _save_table\n result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/base.py", line 869, in _do_insert\n using=using, raw=raw)\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method\n return getattr(self.get_queryset(), name)(*args, **kwargs)\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/query.py", line 1136, in _insert\n return query.get_compiler(using=using).execute_sql(return_id)\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1289, in execute_sql\n cursor.execute(sql, params)\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute\n return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers\n return executor(sql, params, many, context)\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute\n return self.cursor.execute(sql, params)\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__\n raise dj_exc_value.with_traceback(traceback) from exc_value\n File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute\n return self.cursor.execute(sql, params)\n'}, 'worker': '/pulp/api/v3/workers/2/', 'parent': None, 'spawned_tasks': [], 'progress_reports': [{'message': 'Downloading and Parsing Metadata', 'state': 'completed', 'total': 5, 'done': 5, 'suffix': '', 'task': '/pulp/api/v3/tasks/6d288ec1-4562-467e-9538-ca64cd8b747c/'}, {'message': 'Downloading Artifacts', 'state': 'completed', 'total': None, 'done': 0, 'suffix': '', 'task': '/pulp/api/v3/tasks/6d288ec1-4562-467e-9538-ca64cd8b747c/'}, {'message': 'Associating Content', 'state': 'canceled', 'total': None, 'done': 0, 'suffix': '', 'task': '/pulp/api/v3/tasks/6d288ec1-4562-467e-9538-ca64cd8b747c/'}], 'created_resources': []})
Related issues
Actions
Problem: duplicate content can't by synced
Solution: fix the content unit saver stage
This patch addresses 2 problems:
Error because an exception was being caught during a transaction
The q() method did not provide the correct query for Content objects
closes #4170 https://pulp.plan.io/issues/4170