Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore failed: 'Site' object has no attribute 'get_possible_relocation_scopes' #2424

Closed
ingria opened this issue Sep 24, 2023 · 5 comments
Closed

Comments

@ingria
Copy link

ingria commented Sep 24, 2023

Self-Hosted Version

23.9.1

CPU Architecture

x86_x64

Docker Version

24.0.4

Docker Compose Version

2.18.1

Steps to Reproduce

Execute ./scripts/restore.sh

Expected Result

Backup is restored

Actual Result

I receive an error:

AttributeError: 'Site' object has no attribute 'get_possible_relocation_scopes'

Logs:

#...whole bunch of containers...
 Container sentry-self-hosted-vroom-1  Started
 Container sentry-self-hosted-snuba-subscription-consumer-events-1  Started
 Container sentry-self-hosted-snuba-transactions-consumer-1  Started
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
/usr/local/lib/python3.8/site-packages/memcache.py:1303: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if key is '':
/usr/local/lib/python3.8/site-packages/memcache.py:1304: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if key_extra_len is 0:
Traceback (most recent call last):
  File "/usr/local/bin/sentry", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/sentry/runner/__init__.py", line 193, in main
    func(**kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/sentry/runner/decorators.py", line 29, in inner
    return ctx.invoke(f, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/sentry/runner/commands/backup.py", line 150, in import_global
    import_in_global_scope(
  File "/usr/local/lib/python3.8/site-packages/sentry/backup/imports.py", line 321, in import_in_global_scope
    return _import(src, ImportScope.Global, flags=flags, printer=printer)
  File "/usr/local/lib/python3.8/site-packages/sentry/backup/imports.py", line 204, in _import
    do_write()
  File "/usr/local/lib/python3.8/site-packages/sentry/backup/imports.py", line 164, in do_write
    if o.get_possible_relocation_scopes() & allowed_relocation_scopes:
AttributeError: 'Site' object has no attribute 'get_possible_relocation_scopes'
Error in scripts/_lib.sh:69.
'$dc run --rm -T web import global /etc/sentry/backup.json' exited with status 1
-> ./scripts/restore.sh:main:4
--> scripts/_lib.sh:restore:69

Cleaning up...

If I checkout to previous commit (e.g. 9eb056), I don't get this error, but restore still doesn't work:

 Container sentry-self-hosted-snuba-api-1  Started
 Container sentry-self-hosted-snuba-sessions-consumer-1  Started
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Usage: sentry import [OPTIONS] COMMAND [ARGS]...

  Performs non-destructive imports of core data for a Sentry installation.

Options:
  --help  Show this message and exit.

Commands:
  config         Import all configuration and administrator accounts...
  global         Import all Sentry data from an exported JSON file.
  organizations  Import the Sentry organizations, and all constituent...
  users          Import the Sentry users from an exported JSON file.

Event ID

No response

@hubertdeng123
Copy link
Member

Thanks for filing this issue. We'll look into this.

cc: @azaslavsky

@azaslavsky
Copy link
Contributor

Was this from a backup taken after you had migrated to 23.9.1 as well? Or is this from an earlier version?

@ingria
Copy link
Author

ingria commented Sep 27, 2023

I cannot tell for sure now, because I had to delete the “donor” instance. But I remember updating it with ./install.sh before calling ./backup.sh

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Sep 27, 2023
@zechen706
Copy link

Was this from a backup taken after you had migrated to 23.9.1 as well? Or is this from an earlier version?

same error , backup from 21.7.0 to 23.10.0

@azaslavsky
Copy link
Contributor

I cannot tell for sure now, because I had to delete the “donor” instance. But I remember updating it with ./install.sh before calling ./backup.sh

I'm sorry you're experiencing this!

My suspicion is that the backup was generated from a version before 23.9.1, because the model you are having trouble uploading, sites.site, is no longer included in the export as of that version, as specified here. As noted in the release notes for 23.9.1, that release constitutes a breaking change to the backup/restore script, and data from before that change will no longer work. I think the best course of action is to revert back to 23.8.0, try to restore on that version, then upgrade to 23.9.1 once the restore is complete.

same error , backup from 21.7.0 to 23.10.0

You mean 23.9.1? In any case, I would suggest the same advice as above: pull 23.8.0, restore there, then upgrade to 23.9.1. I'll also note that there are hard stops on your migration path that you should take care use as milestones.

@getsantry getsantry bot removed the status in GitHub Issues with 👀 Sep 27, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Archived in project
Development

No branches or pull requests

5 participants