TiDB Upgrade Check Error

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb升级检查报错

| username: 舞动梦灵

Today, I upgraded from version 4.0.0 to 4.0.9 and found many errors during the check.
I can understand THP and numctl, but what does it mean that the port number is in use? Isn’t TiDB itself using it? Do these ports need to be completely unused:
tiup cluster check test-cluster --cluster

| username: 像风一样的男子 | Original post link

This check is for a newly installed cluster. You don’t need to check it for an upgrade; just proceed with the upgrade directly.

| username: TiDBer_小阿飞 | Original post link

Is this after the upgrade?

| username: 舞动梦灵 | Original post link

No, the command executed before the upgrade.

| username: 舞动梦灵 | Original post link

The check for a fresh installation is this, right?

tiup cluster check ./topology.yaml --apply --user tidb -p

The official documentation for upgrading mentions these two commands: If you upgrade directly, it will report an error, right?

tiup cluster check test-cluster --cluster
tiup cluster upgrade tidb-test v4.0.9 --transfer-timeout=3600
| username: tidb菜鸟一只 | Original post link

The command tiup cluster check <cluster-name> --cluster does not check the port number, right? Is your current cluster name “test-cluster”?

| username: 舞动梦灵 | Original post link

Yes. The cluster is named test-cluster.

| username: tidb菜鸟一只 | Original post link

I tried it, and the items checked are only these, there is nothing related to ports…


| username: 舞动梦灵 | Original post link

Yours doesn’t have a port. In my own virtual machine tests from 4.0.2 to 4.0.9 and from 4.0.2 to 5.0.0, there was no port check. However, in the company’s test environment, there was this prompt when checking 4.0.0. I don’t know why, but this 4.0.0 was upgraded from the previous 3.0 version. I checked the upgrade from 3.0 to 4.0 and there was no check command. I imported the ansible init file and then directly upgraded with tiup. This was my previous upgrade check:

| username: 舞动梦灵 | Original post link

If you upgrade directly without any issues, you can continue using it. If there are errors, can you roll back? I couldn’t find the rollback method in the official documentation.

| username: tidb菜鸟一只 | Original post link

Rollback is not possible, but port conflicts shouldn’t be an issue, right? Your components will undergo rolling restarts, and during the restart, the ports will naturally be freed up.

| username: 舞动梦灵 | Original post link

What if the upgrade fails? Will it affect usage? I’m just worried that some files might get replaced halfway through the upgrade and then it fails. Some files might not get replaced. That would be really awkward. If it gets aborted midway~~~ what if it becomes unusable~~~

| username: xfworld | Original post link

Before upgrading, back up the data first.

| username: tidb菜鸟一只 | Original post link

You can back up the data first, and if the upgrade fails, restore it.

| username: 舞动梦灵 | Original post link

This is what I think, but if the upgrade fails, won’t there be a problem with this cluster? Would we need to rebuild it? It can’t affect the development team’s usage and testing. We need to allocate a specific time for this and inform the leadership to get approval. I’m currently preparing to find a space server to directly install a single-node TiDB. Then I’ll back up and restore this 4.0.0 version there and set up a CDC real-time synchronization. If there are no issues, then we can proceed with the upgrade. I’ve been looking for resources all afternoon but haven’t found any.

| username: tidb菜鸟一只 | Original post link

Upgrading from 4.0.0 to 4.0.9 shouldn’t be a big issue. However, if you are upgrading across versions, different versions of components might indeed cause problems. You might want to consider backing up all the components. In case of failure, you can directly restore the components, which should also work.

| username: 舞动梦灵 | Original post link

Can all components be backed up? Do you mean directly using cp or TiDB’s backup tool?

| username: zhanggame1 | Original post link

If it really doesn’t work, you can install MySQL on your local machine and synchronize it.

| username: 舞动梦灵 | Original post link

TiDB has space locally. Installing a MySQL is not a problem. What do you mean, syncing TiDB to this MySQL? Then if the upgrade fails, how do you roll back?

| username: tidb菜鸟一只 | Original post link

Directly make a cp backup of all the local components. If the upgrade fails, just cp them back, and the database should work normally.