self-hosted icon indicating copy to clipboard operation
self-hosted copied to clipboard

During the restore process, the "id" field is incremented

Open WilenChen opened this issue 1 year ago • 5 comments

Self-Hosted Version

Sentry 23.12.1

CPU Architecture

x86_64

Docker Version

24.0.6

Docker Compose Version

2.12.2

Steps to Reproduce

In the restore process, the "id" field is incremented instead of following the "pk" field in the backup.json file. image

Expected Result

To restore the ID field using the "pk" field during the project recovery.

Actual Result

The project ID increments directly from 1 during the restoration process.

Event ID

No response

WilenChen avatar Dec 27 '23 09:12 WilenChen

By default, this is the intended effect, since restore needs to work on an already-used database (ex: what if you are restoring into a DB that already has pk 12?). How difficult is it to alter DSNs manually post-restore?

azaslavsky avatar Dec 27 '23 18:12 azaslavsky

By default, this is the intended effect, since restore needs to work on an already-used database (ex: what if you are restoring into a DB that already has pk 12?). How difficult is it to alter DSNs manually post-restore?

Yes, but the situation now is that after I restored, all the project_id have changed. In that case, I need to republish all my projects. I feel that the cost of restore is a bit high in this way. My database is empty. Perhaps the restore script could support the selection of whether the database is empty or not, instead of directly avoiding conflict issues.

WilenChen avatar Dec 28 '23 01:12 WilenChen

I solved this problem by adjusting the backup.json and using placeholders to replace the missing ids (which were deleted previously). Thank you for your timely response. What I'm doing now is migrating the Sentry server, and the restore method has helped me a lot. @azaslavsky

WilenChen avatar Dec 28 '23 06:12 WilenChen

I'll think about possibly adding this feature, since it would be useful to not have to change DSNs after a restore. Thanks for the suggestion!

azaslavsky avatar Dec 28 '23 17:12 azaslavsky

I'm going to be looking at this feature this week. Hopefully we'll have something out before 24.2.0 lands in mid-February. Thank you for the patience!

azaslavsky avatar Jan 22 '24 17:01 azaslavsky

Well, it's definitely been more than a week, but the fix is in flight. This should be available on nightly and 24.5.0 once it is merged: https://github.com/getsentry/sentry/pull/67621.

azaslavsky avatar Mar 25 '24 18:03 azaslavsky