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

Issue/#1043 Minimum database version check #1053

Merged

Conversation

Askaholic
Copy link
Collaborator

Closes #1043

@Askaholic Askaholic force-pushed the issue/#1043-database-version-check branch 8 times, most recently from 252bb47 to c53f94f Compare March 2, 2025 20:01
@Askaholic Askaholic force-pushed the issue/#1043-database-version-check branch from c53f94f to 4d8f300 Compare March 2, 2025 20:02
@Askaholic Askaholic marked this pull request as ready for review March 2, 2025 20:09
@Askaholic Askaholic requested a review from Brutus5000 March 2, 2025 20:09
Comment on lines +236 to +239
raise RuntimeError(
f"Database version v{version} does not meet minimum requirement "
f"v{FLYWAY_MINIMUM_REQUIRED_VERSION}",
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this sufficient to actually crash the application?

Copy link
Collaborator Author

@Askaholic Askaholic Mar 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it looks something like this:

$ pipenv run devserver
DEBUG    Mar 02  15:51:36 asyncio                        Using selector: EpollSelector
INFO     Mar 02  15:51:36 root                           Lobby dev (Python 3.10.0) on linux named faf-python-server
INFO     Mar 02  15:51:36 root                           Event loop: <_UnixSelectorEventLoop running=True closed=False debug=False>
Traceback (most recent call last):
  File "/home/user/Documents/fa-server/main.py", line 214, in <module>
    exit_code = asyncio.run(main())
  File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
    return future.result()
  File "/home/user/Documents/fa-server/main.py", line 80, in main
    database_version = await get_and_validate_database_version(database)
  File "/home/user/Documents/fa-server/server/db/__init__.py", line 236, in get_and_validate_database_version
    raise RuntimeError(
RuntimeError: Database version v136 does not meet minimum requirement v1000
Exception ignored in: <function Connection.__del__ at 0x7f63a4fe5990>
Traceback (most recent call last):
  File "/home/user/Documents/fa-server/.venv/lib/python3.10/site-packages/aiomysql/connection.py", line 1131, in __del__
  File "/home/user/Documents/fa-server/.venv/lib/python3.10/site-packages/aiomysql/connection.py", line 339, in close
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 700, in close
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 745, in call_soon
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 510, in _check_closed
RuntimeError: Event loop is closed


$ echo $?
1

@Askaholic Askaholic merged commit 4ef84a0 into FAForever:develop Mar 3, 2025
8 checks passed
@Askaholic Askaholic deleted the issue/#1043-database-version-check branch March 3, 2025 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On startup verify minimum database schema version
2 participants