[TiDB Usage Environment] Production Environment
[TiDB Version]
[Reproduction Path]
[Encountered Issues: Problem Phenomenon and Impact]
[Resource Configuration]
[Attachments: Screenshots/Logs/Monitoring]
Currently using TIDB V4.0.9, what is the best version to upgrade to? How to upgrade? What is the rollback plan?
The current TiDB version is V4.0.9. It is recommended to upgrade to the latest stable version, V5.3.2. Upgrading can provide better performance, stability, and feature improvements.
The general path for upgrading TiDB is to upgrade minor versions one by one. For example, first upgrade from V4.0.9 to the latest version of V4.0.x (such as V4.0.13), then upgrade to the latest version of V5.0.x (such as V5.0.12), and finally upgrade to V5.3.2. At each upgrade step, make sure to read the official documentation and follow the instructions to avoid issues.
Before upgrading, ensure to back up important data and configuration files, and conduct thorough testing in a non-production environment. Make sure you understand the changes and considerations that may arise during the upgrade process.
If issues occur during the upgrade, you can handle them according to the following rollback plan:
Restore the backed-up data: Use the backup data you created before the upgrade.
Roll back to the previous version: Downgrade step by step in reverse order until the issue is resolved.
Seek support: If you encounter serious issues or cannot roll back, seek help from the TiDB community or official technical support.
Remember, upgrading is an important operation. Ensure to make thorough preparations before upgrading and carefully read the relevant guidelines in the official documentation.
My suggestion is to upgrade to 6.5.3 first.
Upgrade through tiup, and note that if there is TiFlash, it does not support online upgrading the TiFlash component from versions earlier than 5.3 to versions 5.3 and later; only offline upgrades are possible.
For clusters managed by TiDB Ansible in version 4.0, you need to first follow the instructions in the 4.0 version documentation to import the cluster into TiUP (tiup cluster), and then follow the instructions in this document to upgrade to version 6.5.3.
TiDB currently does not support downgrade rollback, so it is recommended to back up the current database first. If you have a test environment, you can perform the upgrade verification on the test environment first, and then upgrade the production environment after confirming that there are no issues.
Is it an online environment? Do not upgrade directly to 6.x.
There have been issues with performance degradation after upgrading to 6.x.
Regardless of which version you upgrade to, you should first check if the execution plan has changed and if there is any performance degradation.
Set up a test environment to verify your SQL first.
For rollback, within the 4.0 version, you should be able to directly revert to the original version, but cross-major version rollbacks are not possible.
If conditions permit, you can create a new cluster to synchronize data for the upgrade. This way, you can roll back if any issues arise. The biggest problem with in-place upgrades is that you cannot roll back.
It is recommended to upgrade directly to the latest version 7.1. However, make sure to conduct thorough testing and have proper backups in place before upgrading.