|
1 | 1 | /*
|
2 |
| - Copyright (c) 2003, 2022, Oracle and/or its affiliates. |
| 2 | + Copyright (c) 2003, 2023, Oracle and/or its affiliates. |
3 | 3 |
|
4 | 4 | This program is free software; you can redistribute it and/or modify
|
5 | 5 | it under the terms of the GNU General Public License, version 2.0,
|
@@ -1350,48 +1350,47 @@ main(int argc, char** argv)
|
1350 | 1350 | exitHandler(NdbRestoreStatus::Failed);
|
1351 | 1351 | }
|
1352 | 1352 |
|
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) |
1361 | 1353 | {
|
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; |
1376 | 1358 |
|
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 | + } |
1390 | 1373 |
|
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 | + } |
1395 | 1394 | }
|
1396 | 1395 |
|
1397 | 1396 | restoreLogger.log_debug("Load content");
|
|
0 commit comments