Skip to content

Commit 59ef9b9

Browse files
committed
Merge branch 'mysql-8.0' into mysql-trunk
2 parents c22a356 + 9a940ab commit 59ef9b9

File tree

15 files changed

+413
-113
lines changed

15 files changed

+413
-113
lines changed

MYSQL_VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ MYSQL_VERSION_MAJOR=8
22
MYSQL_VERSION_MINOR=3
33
MYSQL_VERSION_PATCH=0
44
MYSQL_VERSION_EXTRA=
5+
MYSQL_VERSION_STABILITY="INNOVATION"

cmake/mysql_version.cmake

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,32 @@ MACRO(GET_MYSQL_VERSION)
6262
MESSAGE(FATAL_ERROR "MYSQL_VERSION file cannot be parsed.")
6363
ENDIF()
6464

65+
MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_STABILITY" MYSQL_VERSION_STABILITY)
66+
67+
IF(NOT DEFINED MYSQL_VERSION_STABILITY)
68+
MESSAGE(FATAL_ERROR "MYSQL_VERSION file cannot be parsed, missing version attributes.")
69+
ENDIF()
70+
71+
IF(NOT MYSQL_VERSION_STABILITY STREQUAL "\"LTS\"" AND
72+
NOT MYSQL_VERSION_STABILITY STREQUAL "\"INNOVATION\"")
73+
MESSAGE(FATAL_ERROR "MYSQL_VERSION_STABILITY can be set to INNOVATION or LTS.")
74+
ENDIF()
75+
76+
# Versions like 8.0.x, 8.4.x, and x.7.y (x > 8) should be LTS
77+
IF ((MAJOR_VERSION EQUAL "8" AND MINOR_VERSION EQUAL "0" AND PATCH_VERSION GREATER "34") OR
78+
(MAJOR_VERSION EQUAL "8" AND MINOR_VERSION EQUAL "4") OR
79+
(MAJOR_VERSION GREATER "8" AND MINOR_VERSION EQUAL "7"))
80+
IF (NOT MYSQL_VERSION_STABILITY STREQUAL "\"LTS\"")
81+
MESSAGE(FATAL_ERROR "Version ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION} should "
82+
"be an LTS release.")
83+
ENDIF()
84+
ELSE()
85+
IF (NOT MYSQL_VERSION_STABILITY STREQUAL "\"INNOVATION\"")
86+
MESSAGE(FATAL_ERROR "Version ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION} should "
87+
"be an innovation release.")
88+
ENDIF()
89+
ENDIF()
90+
6591
SET(VERSION
6692
"${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${EXTRA_VERSION}")
6793
MESSAGE(STATUS "MySQL ${VERSION}")

include/mysql_version.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#define MYSQL_BASE_VERSION "mysqld-@MYSQL_BASE_VERSION@"
1414
#define MYSQL_SERVER_SUFFIX_DEF "@MYSQL_SERVER_SUFFIX@"
1515
#define MYSQL_VERSION_ID @MYSQL_VERSION_ID@
16+
#define MYSQL_VERSION_STABILITY @MYSQL_VERSION_STABILITY@
1617
#define MYSQL_PORT @MYSQL_TCP_PORT@
1718
#define MYSQL_ADMIN_PORT @MYSQL_ADMIN_TCP_PORT@
1819
#define MYSQL_PORT_DEFAULT @MYSQL_TCP_PORT_DEFAULT@

mysql-test/t/dd_schema_dd_properties_debug.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
--source include/have_case_sensitive_file_system.inc
1010

1111
--let $file = $MYSQL_TMP_DIR/dd_properties.txt
12-
--let $filter = MYSQLD_VERSION|DD_VERSION|NDBINFO_VERSION|LCTN|IS_VERSION|PS_VERSION|SDI_VERSION|MINOR_DOWNGRADE_THRESHOLD
12+
--let $filter = MYSQLD_VERSION|DD_VERSION|NDBINFO_VERSION|LCTN|IS_VERSION|PS_VERSION|SDI_VERSION|MINOR_DOWNGRADE_THRESHOLD|MYSQL_VERSION_STABILITY|SERVER_DOWNGRADE_THRESHOLD|SERVER_UPGRADE_THRESHOLD
1313
--source include/dd_schema_dd_properties.inc
1414
--cat_file $file
1515
--remove_file $file

share/messages_to_clients.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10049,7 +10049,7 @@ ER_SIMULATED_INJECTION_ERROR
1004910049
eng "%s %s %zu."
1005010050

1005110051
#
10052-
# End of 8.1 error messages (server-to-client).
10052+
# End of 8.1+ error messages (server-to-client).
1005310053
# Do NOT add messages intended for the error log above!
1005410054
#
1005510055

share/messages_to_error_log.txt

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12246,13 +12246,43 @@ ER_CONVERT_MULTI_VALUE
1224612246
ER_IB_DDL_CONVERT_HEAP_NOT_FOUND
1224712247
eng "Heap required to convert columns is not present."
1224812248

12249+
ER_SERVER_DOWNGRADE_FROM_VERSION
12250+
eng "MySQL server downgrading from version '%u' to '%u'."
12251+
12252+
ER_BEYOND_SERVER_DOWNGRADE_THRESHOLD
12253+
eng "Invalid MySQL server downgrade: Cannot downgrade from %u to %u. Target MySQL server version is lower than the server downgrade threshold %u."
12254+
12255+
ER_BEYOND_SERVER_UPGRADE_THRESHOLD
12256+
eng "Invalid MySQL server upgrade: Cannot upgrade from %u to %u. Target MySQL server version is lower than the server upgrade threshold %u."
12257+
12258+
ER_INVALID_SERVER_UPGRADE_NOT_LTS
12259+
eng "Invalid MySQL server upgrade: Cannot upgrade from %u to %u. Upgrade to next major version is only allowed from the last LTS release, which version %u is not."
12260+
12261+
ER_INVALID_SERVER_DOWNGRADE_NOT_PATCH
12262+
eng "Invalid MySQL server downgrade: Cannot downgrade from %u to %u. Downgrade is only permitted between patch releases."
12263+
12264+
ER_FAILED_GET_DD_PROPERTY
12265+
eng "Failed to get the data dictionary property %s."
12266+
12267+
ER_FAILED_SET_DD_PROPERTY
12268+
eng "Failed to set the data dictionary property %s."
12269+
12270+
ER_SERVER_DOWNGRADE_STATUS
12271+
eng "Server downgrade from '%d' to '%d' %s."
12272+
12273+
ER_INFORMATION_SCHEMA_VERSION_CHANGE
12274+
eng "%s information schema from version %u to %u."
12275+
12276+
ER_PERFORMANCE_SCHEMA_VERSION_CHANGE
12277+
eng "%s performance schema from version %u to %u."
12278+
1224912279
#
1225012280
# End of 8.0 error messages intended to be written to the server error log.
1225112281
#
1225212282

1225312283

1225412284
#
12255-
# Start of 8.1 error messages intended to be written to the server error log.
12285+
# Start of 8.1+ error messages intended to be written to the server error log.
1225612286
# Append 8.0 error log messages to the end of the _previous_ section.
1225712287
# Messages intended to be sent to _clients_ go in messages_to_clients.txt!
1225812288
#
@@ -12370,7 +12400,7 @@ ER_WARN_DEPRECATED_OR_BLOCKED_CIPHER
1237012400

1237112401

1237212402
#
12373-
# End of 8.1 error messages intended to be written to the server error log.
12403+
# End of 8.1+ error messages intended to be written to the server error log.
1237412404
#
1237512405

1237612406

sql/dd/dd_version.h

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,75 @@ static_assert(DD_VERSION <= MYSQL_VERSION_ID,
253253
static const uint DD_VERSION_MINOR_DOWNGRADE_THRESHOLD = DD_VERSION;
254254
static_assert(DD_VERSION_MINOR_DOWNGRADE_THRESHOLD <= MYSQL_VERSION_ID,
255255
"This release can not use a version number from the future");
256+
257+
/**
258+
A new release model supporting Long Term Stability (LTS) and innovation
259+
releases is being introduced. The LTS releases will be kept as stable as
260+
possible, patch updates will be provided mostly for critical issues.
261+
Innovation releases will be released regularly with new features.
262+
263+
When we start a new major version, e.g. 9.0.0, this is an innovation release.
264+
Each consecutive release is a new innovation release where the minor version
265+
number is incremented. The last minor version for a given major version is an
266+
LTS release, this will normally have minor version 7, e.g. 9.7.0. The LTS
267+
release will have regular CPU releases (critical patch update) where the major
268+
and minor versions stay unchanged, and only the patch number is incremented
269+
(e.g. 9.7.1, 9.7.2 etc.). In parallel with the CPU releases, a new major
270+
version will also be released, starting with an incremented major version
271+
number (e.g. 10.0.0). In some cases, the innovation releases may also have
272+
CPU releases, e.g. 9.1.0, 9.1.1 etc.
273+
274+
With the release model supporting LTS releases, we will have to support
275+
downgrade between patch releases. Normally, there will be no changes in
276+
features in a patch release, and the disk image should have a similar format,
277+
both in terms of record layout, data dictionary structure, system table
278+
definitions, information schema, performance schema, etc. However, there might
279+
be situations where changes that are not backwards compatible need to be made
280+
within a patch release. For some server artifacts, we already have mechanisms
281+
in place to allow older versions to reject a downgrade attempt (e.g. if the
282+
data dictionary is changed, the older version will reject the downgrade
283+
attempt). For other artifacts, there is no such mechanism. Thus, we introduce
284+
the SERVER_DOWNGRADE_THRESHOLD which makes it possible to define how far back
285+
the current version should be able to downgrade. On a downgrade attempt,
286+
the target version will look at the threshold which has been stored
287+
persistently by the actual server that we downgrade from. If the target server
288+
version is lower than the threshold, it will reject the downgrade attempt.
289+
290+
The threshold defaults to 0. This means that downgrade back to the first patch
291+
for the given version is possible. E.g. if LTS version 9.7.2 has the threshold
292+
defined to 0, downgrades to 9.7.1 and 9.7.0 is possible. Then, if LTS version
293+
9.7.3 is released with the threshold set to 9.7.2, then only downgrade to
294+
9.7.2 is possible. Downgrades to or from innovation releases are never
295+
supported, regardless of the downgrade threshold.
296+
*/
297+
constexpr uint SERVER_DOWNGRADE_THRESHOLD = 0;
298+
static_assert(SERVER_DOWNGRADE_THRESHOLD <= MYSQL_VERSION_ID,
299+
"This release can not use a version number from the future");
300+
301+
/**
302+
The new release model explained above will also open the possibility of
303+
upgrading to a version that has been released in the past. I.e., we will
304+
upgrade from an actual version to a target version with a higher version
305+
number, but an earlier (older) GA release date.
306+
307+
Like for the patch downgrades mentioned above, we already have mechanisms in
308+
place to allow older versions to reject an upgrade attempt (e.g. if the data
309+
dictionary is changed, the older version will reject the upgrade attempt).
310+
For other artifacts, there is no such mechanism. Thus, we introduce the
311+
SERVER_UPGRADE_THRESHOLD which makes it possible to define how far back
312+
the current version should be able to upgrade. On an upgrade attempt, the
313+
target version will look at the threshold which has been stored persistently
314+
by the actual server that we upgrade from. If the target server version is
315+
lower than the threshold, it will reject the upgrade attempt.
316+
317+
The threshold defaults to 0. This means that for upgrades to any higher
318+
version is possible (unless prohibited by other rules). E.g. if LTS version
319+
9.7.2 has the threshold defined to 0, upgrades to 10.0.0, 10.1.0 etc. is
320+
possible. Then, if LTS version 9.7.3 is released with the upgrade threshold
321+
set to 10.2.0, then upograde from 9.7.3 is possible only to 10.2.0 or higher.
322+
*/
323+
constexpr uint SERVER_UPGRADE_THRESHOLD = 0;
324+
256325
} // namespace dd
257326

258327
#endif /* DD__DD_VERSION_INCLUDED */

sql/dd/impl/bootstrap/bootstrap_ctx.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static constexpr uint SERVER_VERSION_80016 = 80016;
8888

8989
/*
9090
Set of unsupported server version labels. An unsupported server version is a
91-
version from which we can't upgrade.
91+
version from which we can't upgrade or downgrade.
9292
*/
9393
static std::set<uint> unsupported_server_versions = {};
9494

@@ -150,13 +150,22 @@ class DD_bootstrap_ctx {
150150
bool supported_server_version(uint version) const {
151151
return (unsupported_server_versions.find(version) ==
152152
unsupported_server_versions.end()) &&
153-
MYSQL_VERSION_ID > version;
153+
(MYSQL_VERSION_ID > version || is_server_patch_downgrade(version));
154154
}
155155

156156
bool supported_server_version() const {
157157
return supported_server_version(m_upgraded_server_version);
158158
}
159159

160+
bool is_server_patch_downgrade(uint compare_server_version) const {
161+
return (compare_server_version / 100 == MYSQL_VERSION_ID / 100) &&
162+
(compare_server_version % 100 > MYSQL_VERSION_ID % 100);
163+
}
164+
165+
bool is_server_patch_downgrade() const {
166+
return is_server_patch_downgrade(m_upgraded_server_version);
167+
}
168+
160169
void set_upgraded_server_version(uint upgraded_server_version) {
161170
m_upgraded_server_version = upgraded_server_version;
162171
}

0 commit comments

Comments
 (0)