Skip to content

Commit 7d352e2

Browse files
authored
Separate Innovation, LTS and old releases of MySQL backend (#33522)
* Separate Innovation, LTS and old releases of MySQL backend * Run tests against 'innovation' mysql releases
1 parent a851b18 commit 7d352e2

11 files changed

+58
-19
lines changed

dev/breeze/src/airflow_breeze/commands/developer_commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,11 +730,11 @@ def enter_shell(**kwargs) -> RunCommandResult:
730730
cmd.extend(["-c", cmd_added])
731731
if "arm64" in DOCKER_DEFAULT_PLATFORM:
732732
if shell_params.backend == "mysql":
733-
if shell_params.mysql_version == "8":
733+
if not shell_params.mysql_version.startswith("5"):
734734
get_console().print("\n[warn]MySQL use MariaDB client binaries on ARM architecture.[/]\n")
735735
else:
736736
get_console().print(
737-
f"\n[error]Only MySQL 8.0 is supported on ARM architecture, "
737+
f"\n[error]Only MySQL 8.x is supported on ARM architecture, "
738738
f"but got {shell_params.mysql_version}[/]\n"
739739
)
740740
sys.exit(1)

dev/breeze/src/airflow_breeze/global_constants.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,19 @@
8484

8585
ALLOWED_MOUNT_OPTIONS = [MOUNT_SELECTED, MOUNT_ALL, MOUNT_SKIP, MOUNT_REMOVE]
8686
ALLOWED_POSTGRES_VERSIONS = ["11", "12", "13", "14", "15"]
87-
ALLOWED_MYSQL_VERSIONS = ["5.7", "8"]
87+
# Oracle introduced new release model for MySQL
88+
# - LTS: Long Time Support releases, new release approx every 2 year,
89+
# with 5 year premier and 3 year extended support, no new features/removals during current LTS release.
90+
# the first LTS release should be in summer/fall 2024.
91+
# - Innovations: Shot living releases with short support cycle - only until next Innovation/LTS release.
92+
# See: https://dev.mysql.com/blog-archive/introducing-mysql-innovation-and-long-term-support-lts-versions/
93+
MYSQL_LTS_RELEASES: list[str] = []
94+
MYSQL_OLD_RELEASES = ["5.7", "8.0"]
95+
MYSQL_INNOVATION_RELEASE = "8.1"
96+
ALLOWED_MYSQL_VERSIONS = [*MYSQL_OLD_RELEASES, *MYSQL_LTS_RELEASES]
97+
if MYSQL_INNOVATION_RELEASE:
98+
ALLOWED_MYSQL_VERSIONS.append(MYSQL_INNOVATION_RELEASE)
99+
88100
ALLOWED_MSSQL_VERSIONS = ["2017-latest", "2019-latest"]
89101

90102
PIP_VERSION = "23.2.1"
@@ -190,7 +202,11 @@ def get_default_platform_machine() -> str:
190202
CURRENT_PYTHON_MAJOR_MINOR_VERSIONS = ALL_PYTHON_MAJOR_MINOR_VERSIONS
191203
CURRENT_POSTGRES_VERSIONS = ["11", "12", "13", "14", "15"]
192204
DEFAULT_POSTGRES_VERSION = CURRENT_POSTGRES_VERSIONS[0]
193-
CURRENT_MYSQL_VERSIONS = ["5.7", "8"]
205+
USE_MYSQL_INNOVATION_RELEASE = True
206+
if USE_MYSQL_INNOVATION_RELEASE:
207+
CURRENT_MYSQL_VERSIONS = ALLOWED_MYSQL_VERSIONS.copy()
208+
else:
209+
CURRENT_MYSQL_VERSIONS = [*MYSQL_OLD_RELEASES, *MYSQL_LTS_RELEASES]
194210
DEFAULT_MYSQL_VERSION = CURRENT_MYSQL_VERSIONS[0]
195211
CURRENT_MSSQL_VERSIONS = ["2017-latest", "2019-latest"]
196212
DEFAULT_MSSQL_VERSION = CURRENT_MSSQL_VERSIONS[0]

dev/breeze/src/airflow_breeze/utils/common_options.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
CacheableChoice,
5252
CacheableDefault,
5353
DryRunOption,
54+
MySQLBackendVersionType,
5455
UseAirflowVersionType,
5556
VerboseOption,
5657
)
@@ -151,7 +152,7 @@ def _set_default_from_parent(ctx: click.core.Context, option: click.core.Option,
151152
"-M",
152153
"--mysql-version",
153154
help="Version of MySQL used.",
154-
type=CacheableChoice(ALLOWED_MYSQL_VERSIONS),
155+
type=MySQLBackendVersionType(ALLOWED_MYSQL_VERSIONS),
155156
default=CacheableDefault(ALLOWED_MYSQL_VERSIONS[0]),
156157
show_default=True,
157158
)

dev/breeze/src/airflow_breeze/utils/custom_param_types.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,28 @@ def __init__(self, choices, case_sensitive: bool = True) -> None:
191191
super().__init__(choices=choices, case_sensitive=case_sensitive)
192192

193193

194+
class MySQLBackendVersionType(CacheableChoice):
195+
def convert(self, value, param, ctx):
196+
if isinstance(value, CacheableDefault):
197+
param_name = param.envvar if param.envvar else param.name.upper()
198+
mysql_version = read_from_cache_file(param_name)
199+
if mysql_version == "8":
200+
value = "8.0"
201+
get_console().print(
202+
f"\n[warning]Found outdated cached value {mysql_version} for parameter {param.name}. "
203+
f"Replaced by {value}"
204+
)
205+
write_to_cache_file(param_name, "8.0", check_allowed_values=False)
206+
else:
207+
if value == "8":
208+
value = "8.0"
209+
get_console().print(
210+
f"\n[warning]Provided outdated value {8} for parameter {param.name}. "
211+
f"Will use {value} instead"
212+
)
213+
return super().convert(value, param, ctx)
214+
215+
194216
class UseAirflowVersionType(BetterChoice):
195217
"""Extends choice with dynamic version number."""
196218

images/breeze/output-commands-hash.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file is automatically generated by pre-commit. If you have a conflict with this file
22
# Please do not solve it but run `breeze setup regenerate-command-images`.
33
# This command should fix the conflict and regenerate help images that you have conflict with.
4-
main:344261ca3aa7ff31e098b1d88280566a
4+
main:42493af4045e28dcf52040810fbb7036
55
build-docs:bfc91db55c595516fe84d56c96a5a8e0
66
ci:find-backtracking-candidates:17fe56b867a745e5032a08dfcd3f73ee
77
ci:fix-ownership:3e5a73533cc96045e72cb258783cfc96
@@ -57,16 +57,16 @@ sbom:update-sbom-information:0ce56884e5f842e3e80d6619df1ccc64
5757
sbom:935d041028e847d3faf763a95b51063e
5858
setup:autocomplete:fffcd49e102e09ccd69b3841a9e3ea8e
5959
setup:check-all-params-in-groups:639dfb061b8da02dcaa4a57b567ff42a
60-
setup:config:38ebaaf93ed42bc7b2a3000eeea2631d
60+
setup:config:fd32471ee31894decf91984615771add
6161
setup:regenerate-command-images:d5e29ec6acb1a6af7d83772c2962f89d
6262
setup:self-upgrade:4af905a147fcd6670a0e33d3d369a94b
6363
setup:version:be116d90a21c2afe01087f7609774e1e
64-
setup:8de3ed2645928e8f9f89c58f0ccd2a60
65-
shell:87e7bdcebe1180395adfec86b2a065f5
66-
start-airflow:f7216a8126ecf14b033e2ea677e1a105
64+
setup:fd391bab5277ad3aca65987a84144d51
65+
shell:c7adf57a354ecb496ae12fc0b9eaea80
66+
start-airflow:23df4528b3972977e58f7d29336500f7
6767
static-checks:5ded21248cd4f5617779f58ecf6c554c
6868
testing:docker-compose-tests:0c810047fc66a0cfe91119e2d08b3507
6969
testing:helm-tests:8e491da2e01ebd815322c37562059d77
70-
testing:integration-tests:486e4d91449ecdb7630ef2a470d705a3
71-
testing:tests:3c202e65824e405269e78f58936980e0
72-
testing:68a089bc30e0e60f834f205df1e9f086
70+
testing:integration-tests:f2a400ac9f722b9c279abbd4e3313e71
71+
testing:tests:abc232b1a9b416928ccc0a7dd904ed18
72+
testing:e6d79999174876ea42e73454f0ba9342

images/breeze/output-commands.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)