/var/log/vmware/upgrade/vcdb_req.err logs on the destination vCenter show the following entries :Missing constraints: VPX_HIST_STAT1_120.PK_VPX_HIST_STAT1_120;VPX_HIST_STAT2_15.PK_VPX_HIST_STAT2_15;VPX_HIST_STAT1_99.PK_VPX_HIST_STAT1_99;VPX_HIST_STAT1_125.PK_VPX_HIST_STAT1_125;VPX_HIST_STAT2_44.PK_VPX_HIST_STAT2_44;VPX_HIST_STAT2_4.PK_VPX_HIST_STAT2_4;VPX_HIST_STAT3_13.PK_VPX_HIST_STAT3_13;VPX_HIST_STAT2_22.PK_VPX_HIST_STAT2_22;VPX_HIST_STAT1_123.PK_VPX_HIST_STAT1_123;VPX_HIST_STAT2_13.PK_VPX_HIST_STAT2_13;VPX_HI
/var/log/vmware/vpostgres/postgresql.log the full list of problematic tables will be displayed : Missing constraints: VPX_HIST_STAT1_120.PK_VPX_HIST_STAT1_120;VPX_HIST_STAT2_15.PK_VPX_HIST_STAT2_15;VPX_HIST_STAT1_99.PK_VPX_HIST_STAT1_99;VPX_HIST_STAT1_125.PK_VPX_HIST_STAT1_125;VPX_HIST_STAT2_44.PK_VPX_HIST_STAT2_44;VPX_HIST_STAT2_4.PK_VPX_HIST_STAT2_4;VPX_HIST_STAT3_13.PK_VPX_HIST_STAT3_13;VPX_HIST_STAT2_22.PK_VPX_HIST_STAT2_22;VPX_HIST_STAT1_123.PK_VPX_HIST_STAT1_123;VPX_HIST_STAT2_13.PK_VPX_HIST_STAT2_13;VPX_HIST_STAT1_107.PK_VPX_HIST_STAT1_107;VPX_HIST_STAT1_137.PK_VPX_HIST_STAT1_137;VPX_HIST_STAT2_7.PK_VPX_HIST_STAT2_7;VPX_HIST_STAT1_138.PK_VPX_HIST_STAT1_138;
vCenter Server 7.x
vCenter Server 8.x
This is due to missing Primary Key constraint on the PK_VPX_HIST_STAT#_X relations on the VPX_HIST_STAT#_X tables.
Note : Make sure you have taken proper snapshots of your vCenter Server before proceeding with any DB changes. Take powered off snapshots of vCenter Servers if they are in ELM ( Enhanced Linked Mode ) .
Fix the missing indexes and add the Primary Key constraint with the below steps :
Start a PSQL Session on the vCenter Server : psql -d VCDB -U postgres
From the tables reported on the error in the postgresql.log file, run the following command : \d+ vc.vpx_hist_stat#_x;
The output should show the list of Indexes which includes the index : pk_vpx_hist_stat#_x with the constraint UNIQUE.
If the Index does not exist, verify if the columns that make up the Index exist i.e counter_id and time_id
Run the following command to recreate the index : CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS pk_vpx_hist_stat#_X ON vc.vpx_hist_stat#_X (counter_id, time_id);
Run the following command to add the PRIMARY_KEY constraint to the Index : ALTER TABLE vc.vpx_hist_stat#_X ADD CONSTRAINT pk_vpx_hist_stat#_X PRIMARY KEY USING INDEX pk_vpx_hist_stat#_X;
Run the following command and verify that the index is marked as primary key : \d+ vc.vpx_hist_stat#_x;
Run the pre-upgrade checks again from the upgrade workflow.
If you are facing any challenges with identifying the commands or steps to execute , please reach out to Broadcom Support