Skip to content

Commit 79140c0

Browse files
committed
Bug#35079426 Change ndb_restore output to hide format of the backup file
Backport to 7.5+ Two changes : i) Fix regression introduced to ndb_restore in 8.0 where the backup file format version is shown for both the backup file format version and the version of the cluster which produced the backup. ii) Modify the backup file format version output to be in Hex to reduce confusion between the version of the file format, and the version of the cluster which produced the backup. Example output diffs : 8.0 before : Backup version in files: ndb-6.3.11 ndb version: ndb-6.3.11 8.0 after : Backup from version : mysql-8.0.34 ndb-8.0.34 file format : 6030b Examples from mtr backup archive : Backup file format : 50102 Backup file format : 50112 Backup file format : 60208 Backup from version : mysql-5.1.23 ndb-6.3.11 file format : 6030b Backup from version : mysql-5.1.44 ndb-7.0.14 file format : 6030b Backup from version : mysql-5.1.44 ndb-7.1.4 file format : 6030b Backup from version : mysql-5.5.20 ndb-7.2.6 file format : 6030b Backup from version : mysql-5.6.46 ndb-7.4.26 file format : 6030b Backup from version : mysql-5.7.21 ndb-7.5.9 file format : 6030b Backup from version : mysql-5.7.25 ndb-7.6.10 file format : 6030b Backup from version : mysql-8.0.17 ndb-8.0.17 file format : 6030b Backup from version : mysql-8.0.18 ndb-8.0.18 file format : 6030b Change-Id: Iefffde85edb25b599f6817e1765f824e4e5e95d0
1 parent 6b4fd0a commit 79140c0

File tree

1 file changed

+39
-40
lines changed

1 file changed

+39
-40
lines changed

storage/ndb/tools/restore/restore_main.cpp

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2022, Oracle and/or its affiliates.
2+
Copyright (c) 2003, 2023, Oracle and/or its affiliates.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License, version 2.0,
@@ -1350,48 +1350,47 @@ main(int argc, char** argv)
13501350
exitHandler(NdbRestoreStatus::Failed);
13511351
}
13521352

1353-
const BackupFormat::FileHeader & tmp = metaData.getFileHeader();
1354-
const Uint32 version = tmp.BackupVersion;
1355-
1356-
char buf[NDB_VERSION_STRING_BUF_SZ];
1357-
char new_buf[NDB_VERSION_STRING_BUF_SZ];
1358-
info.setLevel(254);
1359-
1360-
if (version >= NDBD_RAW_LCP)
13611353
{
1362-
restoreLogger.log_info("Backup version in files: %s ndb version: %s",
1363-
ndbGetVersionString(version, 0,
1364-
isDrop6(version) ? "-drop6" : 0,
1365-
buf, sizeof(buf)),
1366-
ndbGetVersionString(tmp.NdbVersion, tmp.MySQLVersion, 0,
1367-
buf, sizeof(buf)));
1368-
}
1369-
else
1370-
{
1371-
restoreLogger.log_info("Backup version in files: %s",
1372-
ndbGetVersionString(version, 0,
1373-
isDrop6(version) ? "-drop6" : 0,
1374-
buf, sizeof(buf)));
1375-
}
1354+
const BackupFormat::FileHeader & tmp = metaData.getFileHeader();
1355+
const Uint32 backupFileVersion = tmp.BackupVersion;
1356+
const Uint32 backupNdbVersion = tmp.NdbVersion;
1357+
const Uint32 backupMySQLVersion = tmp.MySQLVersion;
13761358

1377-
/**
1378-
* check wheater we can restore the backup (right version).
1379-
*/
1380-
// in these versions there was an error in how replica info was
1381-
// stored on disk
1382-
if (version >= MAKE_VERSION(5,1,3) && version <= MAKE_VERSION(5,1,9))
1383-
{
1384-
restoreLogger.log_error("Restore program incompatible with backup versions between %s and %s"
1385-
,ndbGetVersionString(MAKE_VERSION(5,1,3), 0, 0, buf, sizeof(buf))
1386-
,ndbGetVersionString(MAKE_VERSION(5,1,9), 0, 0, new_buf, sizeof(new_buf))
1387-
);
1388-
exitHandler(NdbRestoreStatus::Failed);
1389-
}
1359+
char buf[NDB_VERSION_STRING_BUF_SZ];
1360+
info.setLevel(254);
1361+
if (backupFileVersion >= NDBD_RAW_LCP)
1362+
{
1363+
restoreLogger.log_info("Backup from version : %s file format : %x",
1364+
ndbGetVersionString(backupNdbVersion, backupMySQLVersion, 0,
1365+
buf, sizeof(buf)),
1366+
backupFileVersion);
1367+
}
1368+
else
1369+
{
1370+
restoreLogger.log_info("Backup file format : %x",
1371+
backupFileVersion);
1372+
}
13901373

1391-
if (version > NDB_VERSION)
1392-
{
1393-
restoreLogger.log_error("Restore program older than backup version. Not supported. Use new restore program");
1394-
exitHandler(NdbRestoreStatus::Failed);
1374+
/**
1375+
* check whether we can restore the backup (right version).
1376+
*/
1377+
// in these versions there was an error in how replica info was
1378+
// stored on disk
1379+
if (backupFileVersion >= MAKE_VERSION(5,1,3) && backupFileVersion <= MAKE_VERSION(5,1,9))
1380+
{
1381+
char new_buf[NDB_VERSION_STRING_BUF_SZ];
1382+
restoreLogger.log_error("Restore program incompatible with backup file versions between %s and %s"
1383+
,ndbGetVersionString(MAKE_VERSION(5,1,3), 0, 0, buf, sizeof(buf))
1384+
,ndbGetVersionString(MAKE_VERSION(5,1,9), 0, 0, new_buf, sizeof(new_buf))
1385+
);
1386+
exitHandler(NdbRestoreStatus::Failed);
1387+
}
1388+
1389+
if (backupFileVersion > NDB_VERSION)
1390+
{
1391+
restoreLogger.log_error("Restore program older than backup version. Not supported. Use new restore program");
1392+
exitHandler(NdbRestoreStatus::Failed);
1393+
}
13951394
}
13961395

13971396
restoreLogger.log_debug("Load content");

0 commit comments

Comments
 (0)