Skip to content

2025.1.2.0-b81

@fizaaluthra fizaaluthra tagged this 20 Oct 14:52
Summary:
During a YSQL major upgrade, if namespace creation fails in `ProcessPendingNamespace`, the cleanup code unconditionally removes the namespace from `namespace_names_mapper_` but leaves it in `namespace_ids_map_`. This is incorrect because:

1) During major upgrades, namespace map entries are shared between both the old and new YSQL major versions.
2) It causes an inconsistent state where the namespace exists in one map but not the other.

On the second upgrade attempt after rollback, the upgrade process fails when trying to access the removed namespace:

1) For yugabyte database specifically: The error is `Namespace yugabyte of type 3 not found` because the upgrade tries to retrieve yugabyte's OID looking it up in the namespace maps, and the lookup fails.

2) For other databases: The error would be `Namespace is unexpectedly missing from the namespace names mapper` when `CreateNamespace` checks for the namespace's existence during upgrade.

Fix the issue by:
1) Skipping the `namespace_names_mapper_` cleanup in `ProcessPendingNamespace` if an upgrade is in progress.
2) Clearing any transaction metadata from namespaces that may remain from the failed upgrade attempt during rollback.
Jira: DB-18526

Original commit: ff1c1301311000b492b4f29db61ac0372bc41fc0 / D47230

Test Plan: ./yb_build.sh release --cxx-test integration-tests_ysql_major_upgrade-test --gtest_filter YsqlMajorUpgradeTest.NamespaceMapConsistencyAfterFailedUpgrade

Reviewers: hsunder

Reviewed By: hsunder

Subscribers: ybase

Differential Revision: https://phorge.dev.yugabyte.com/D47585
Assets 2
Loading