Skip to content

Commit d7aae0e

Browse files
Jimmy Yangdahlerlend
authored andcommitted
bug#27708249 - PREVENT DOWNGRADE on 8.0 DATABASE INSTALLATIONS
Reviewed by: Sivert Sorunmgaard<[email protected]>
1 parent db3b68a commit d7aae0e

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

share/errmsg-utf8.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18038,6 +18038,8 @@ ER_STARTING_INIT
1803818038
ER_ENDING_INIT
1803918039
eng "%s (mysqld %s) initializing of server has completed"
1804018040

18041+
ER_IB_MSG_1272
18042+
eng "Cannot boot server version %lu on data directory built by version %lu. Downgrade is not supported"
1804118043
#
1804218044
# End of 8.0 Server error messages.
1804318045
# (Please read comments from the header of this section before adding error

storage/innobase/fil/fil0fil.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5137,12 +5137,16 @@ dberr_t fil_ibd_open(bool validate, fil_type_t purpose, space_id_t space_id,
51375137
return (DB_ERROR);
51385138
}
51395139

5140-
#ifdef UNIV_DEBUG
51415140
if (validate && !old_space && !for_import) {
5142-
ut_ad(df.server_version() == DD_SPACE_CURRENT_SRV_VERSION);
5141+
if (df.server_version() > DD_SPACE_CURRENT_SRV_VERSION) {
5142+
ib::error(ER_IB_MSG_1272, DD_SPACE_CURRENT_SRV_VERSION,
5143+
df.server_version());
5144+
/* Server version is less than the tablespace server version.
5145+
We don't support downgrade for 8.0 server, so report error */
5146+
return (DB_SERVER_VERSION_LOW);
5147+
}
51435148
ut_ad(df.space_version() == DD_SPACE_CURRENT_SPACE_VERSION);
51445149
}
5145-
#endif /* UNIV_DEBUG */
51465150

51475151
/* For encryption tablespace, initialize encryption information.*/
51485152
if (is_encrypted && !for_import) {

storage/innobase/include/db0err.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ enum dberr_t {
145145
DB_CANT_CREATE_GEOMETRY_OBJECT, /*!< Cannot create specified Geometry
146146
data object */
147147
DB_CANNOT_OPEN_FILE, /*!< Cannot open a file */
148-
DB_FTS_TOO_MANY_WORDS_IN_PHRASE,
149-
/*!< Too many words in a phrase */
148+
DB_FTS_TOO_MANY_WORDS_IN_PHRASE, /*!< Too many words in a phrase */
149+
DB_SERVER_VERSION_LOW, /* Server version is lower than tablespace version */
150150

151151
DB_IO_ERROR = 100, /*!< Generic IO error */
152152

storage/innobase/ut/ut0ut.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,11 @@ const char *ut_strerr(dberr_t num) {
579579
case DB_INVALID_ENCRYPTION_META:
580580
return ("Invalid encryption meta-data information");
581581

582+
case DB_SERVER_VERSION_LOW:
583+
return (
584+
"Cannot boot server with lower version than that built the "
585+
"tablespace");
586+
582587
case DB_ERROR_UNSET:;
583588
/* Fall through. */
584589

0 commit comments

Comments
 (0)