self-hosted
self-hosted copied to clipboard
同样的版本导入数据到一个新装的环境时出错
备份时使用脚本:scripts/backup.sh
恢复时进入web容器,执行命令:sentry import /tmp/backup.json 报以下错误: (恢复的环境是新装的环境,版本和旧的是一样的)
Are you restoring from a backup of the same version of Sentry? Are you restoring onto a clean database? If so then this IntegrityError might be our fault, you can open an issue here: https://github.com/getsentry/sentry/issues/new/choose Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/sentry/db/postgres/decorators.py", line 91, in inner return func(self, sql, *args, **kwargs) File "/usr/local/lib/python3.8/site-packages/sentry/db/postgres/base.py", line 86, in execute return self.cursor.execute(sql, clean_bad_params(params)) psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "sentry_useremail_user_id_email_ade975f1_uniq" DETAIL: Key (user_id, email)=(2, [email protected]) already exists.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/usr/local/lib/python3.8/site-packages/sentry/db/postgres/decorators.py", line 77, in inner raise_the_exception(self.db, e) File "/usr/local/lib/python3.8/site-packages/sentry/db/postgres/decorators.py", line 75, in inner return func(self, *args, **kwargs) File "/usr/local/lib/python3.8/site-packages/sentry/db/postgres/decorators.py", line 18, in inner return func(self, *args, **kwargs) File "/usr/local/lib/python3.8/site-packages/sentry/db/postgres/decorators.py", line 95, in inner raise exc_info0.with_traceback(exc_info[2]) File "/usr/local/lib/python3.8/site-packages/sentry/db/postgres/decorators.py", line 91, in inner return func(self, sql, *args, **kwargs) File "/usr/local/lib/python3.8/site-packages/sentry/db/postgres/base.py", line 86, in execute return self.cursor.execute(sql, clean_bad_params(params)) psycopg2.errors.UniqueViolation: UniqueViolation('duplicate key value violates unique constraint "sentry_useremail_user_id_email_ade975f1_uniq"\nDETAIL: Key (user_id, email)=(2, [email protected]) already exists.\n') SQL: INSERT INTO "sentry_useremail" ("id", "user_id", "email", "validation_hash", "date_hash_added", "is_verified") VALUES (%s, %s, %s, %s, %s, %s) RETURNING "sentry_useremail"."id"
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/sentry", line 8, in
Assigning to @getsentry/support for routing ⏲️
会不会跟导入的数据ID自增序列跳了一个数有关系?
Hi @xtyinbiao found issue already? if not try to delete users before importing or just change the email if possible. It's look like the users email that gonna imported is the same as the user/email that created to this new sentry.
Or in very version >=23.11.0 if i not mistaken. you can choose which one you want to import like users only, project only or global which is import all data including users
Cheers Baskoro
More update on this @xtyinbiao got same issue when testing with 23.5.1 version and i did some workaround here https://github.com/getsentry/self-hosted/issues/3201 some people believe it happens due to how transaction handled by django or atomic orm
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀