Project: YugabyteDB (App Definition and Development / Database)
File: ta-21491.md

title: TA-21491 headerTitle: Failure of upgrades to release versions 2.18 and 2.20 headcontent: 19 Mar 2024 type: docs showRightNav: true cascade: unversioned: true menu: preview_releases: identifier: ta-21491 weight: 1 rightNav: hideH2: true type: docs | Product | Affected Versions | Related Issues | Fixed In | | :- | : | :- | :- | | {{<product "ybdb, yba">}} | {{<release "2.18, 2.20">}} | {{<issue 21491>}} | {{<release "2.20.2.1, 2.18.7.0">}} | Upgrading from prior versions (other than v2.14, v2.16) to v2.18 or v2.20 fails due to a race condition during post upgrade. While the yb-tservers themselves can be healthy and their raft configurations can remain intact, they will fail to heartbeat to the yb-master. This is a race condition ( that can happen even while the probability is low ) that requires YugabyteDB Anywhere to execute a post-upgrade action of un-blacklisting yb-tservers at the exact same time as yb-master executing a background task of generating `universe_uuid` field. This issue is less likely in v2.20 due to the post upgrade actions taking much longer in v2.20 compared to v2.18 reducing the probability of hitting it significantly. v2.14 and v2.16 releases are not impacted by this issue. This is because the flag `masterenableuniverseuuidheartbeat_check` is not auto-promoted and so the functionality is OFF by default until you explicitly turn it ON. Set the `masterenableuniverseuuidheartbeat_check` flag on yb-master to false. It can be performed as a non-rolling, non-restart YBA upgrade after the database upgrade is complete. After this flag change is applied, upgrade to a release with the fix and to re-enable the flag. Re-enabling the flag requires running a command to clear the `universeuuid` on all nodes. After the `universeuuid` is cleared, the flag can be re-enabled on yb-master. The `universe_uuid` field was added to `ClusterConfig` as part of . This is essentially an identity for the universe which all the yb-tservers inherit from the yb-master as part of the heartbeat. If set, this value is not meant to change on either the yb-tservers or yb-masters and provides a way for the yb-master to reject any heartbeats from a different universe. For universes upgrading from an older release to one having the preceeding commit, the catalog manager generates a new `universeuuid` and propagates that to the yb-tserver. However, before persisting the `universeuuid` in cluster_config, the version number is not being incremented. As a result of this, the following race is possible: Cluster gets upgraded to a release with commit and the feature `masterenableuniverseuuidheartbeat_check` is enabled due to promotion of flags. YBA reads the cluster configuration (ClusterConfig) at version 'X'. Catalog manager background thread runs and generates a new `universe_uuid`, persists it in ClusterConfig and propagates it to all the yb-tservers. YBA from Step 2 updates the ClusterConfig using `ChangeMasterClusterConfigRequestPB` with version 'X'. (For un-blacklisting nodes) Update from Step 4 succeeds because ClusterConfig version 'X' on disk matches the one in the request 'X', effectively overwriting the `universe_uuid` generated in Step 3. Catalog manager background thread runs again and because the `universe_uuid` is empty, it generates a new one again. After the new `universeuuid` is generated on the catalog manager in Step 6, yb-master essentially starts rejecting heartbeats from all the yb-tservers which keep reporting the previous `universeuuid` generated by the catalog manager in Step 3.