-
-
Notifications
You must be signed in to change notification settings - Fork 139
Closed
Description
Upgraded to latest docker and there's an error about not being able to create a unique index in common_taskhistory for the unique task_id index. There are many duplicates in the table from exists tasks that were processing when I did the upgrade. What should my next step be to resolve the duplicates?
This is the container log when it started up after the upgrade. I tried removing some duplicates but just kept finding more.
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service tubesync-init: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
2025-07-16 19:28:51,739 [tubesync/INFO] Using database connection: postgresql://tubesync:[hidden]@192.168.9.81:5433/tubesync
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 103, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
psycopg.errors.UniqueViolation: could not create unique index "common_taskhistory_task_id_5601b8bb_uniq"
DETAIL: Key (task_id)=(85215e51-71e7-4a68-9faa-c04252763843) is duplicated.
CONTEXT: parallel worker
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/manage.py", line 18, in <module>
main()
File "/app/manage.py", line 14, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.11/dist-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.11/dist-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.11/dist-packages/django/core/management/base.py", line 416, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.11/dist-packages/django/core/management/base.py", line 460, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/core/management/base.py", line 107, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/core/management/commands/migrate.py", line 353, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/db/migrations/executor.py", line 135, in migrate
state = self._migrate_all_forwards(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
state = self.apply_migration(
TUBESYNC_RESET_DOWNLOAD_DIR=True, Resetting /downloads directory permissions
Operations to perform:
Apply all migrations: admin, auth, background_task, common, contenttypes, sessions, sync
Running migrations:
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/db/migrations/executor.py", line 255, in apply_migration
state = migration.apply(state, schema_editor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/db/migrations/migration.py", line 132, in apply
operation.database_forwards(
File "/usr/local/lib/python3.11/dist-packages/django/db/migrations/operations/fields.py", line 241, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/base/schema.py", line 912, in alter_field
self._alter_field(
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/postgresql/schema.py", line 274, in _alter_field
super()._alter_field(
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/base/schema.py", line 1208, in _alter_field
self.execute(self._create_unique_sql(model, [new_field]))
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/postgresql/schema.py", line 48, in execute
return super().execute(sql, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/base/schema.py", line 204, in execute
cursor.execute(sql, params)
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/usr/local/lib/python3.11/dist-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 103, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
django.db.utils.IntegrityError: could not create unique index "common_taskhistory_task_id_5601b8bb_uniq"
DETAIL: Key (task_id)=(85215e51-71e7-4a68-9faa-c04252763843) is duplicated.
CONTEXT: parallel worker
s6-rc: warning: unable to start service tubesync-init: command exited 1
Metadata
Metadata
Assignees
Labels
No labels
Projects
Status
Done