Citus v10.x to v11.x or Newer Major Version Upgrade Error in Non-Transactional Metadata Sync Mode
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
When attempting to upgrade from Citus v10.x to newer major versions with a non-transactional metadata sync mode, an issue arises during the execution of the `citus_finalize_upgrade_to_citus11()` function by the following error message:
```
PL/pgSQL function citus_finish_citus_upgrade() line 25 at PERFORM
NOTICE: preparing all the existing partitioned table indexes
NOTICE: preparing to sync the metadata to all nodes
> Error: do not sync metadata in transaction block when the sync mode is nontransactional
HINT: resync after SET citus.metadata_sync_mode to 'transactional'
PL/pgSQL function citus_finalize_upgrade_to_citus11(boolean) line 174 at PERFORM
SQL statement "SELECT citus_finalize_upgrade_to_citus11()"
```
The problem specifically occurs when the transaction mode is set to non-transactional. It originates from the fact that metadata synchronization is called within a transaction block without considering the metadata sync mode. This behavior triggers the error message shown above. The relevant code section causing this issue can be found here:
https://github.com/citusdata/citus/blob/27ac44eb2a6be1c12c06f193d8d8511509a54bca/src/backend/distributed/sql/udfs/citus_finalize_upgrade_to_citus11/latest.sql#L209-L216
The issue can be traced to the guard condition defined in the following code section:
https://github.com/citusdata/citus/blob/27ac44eb2a6be1c12c06f193d8d8511509a54bca/src/backend/distributed/metadata/node_metadata.c#L1057-L1072
I think we need to adjust the logic in `citus_finalize_upgrade_to_citus11()` to ensure that metadata synchronization is performed correctly based on the sync mode in use.
Contributor guide
Assessment
This issue has not been assessed yet.