I'm having trouble with a Postgres RDS SDE geodatabase.
It has a number of parcel fabric datasets in it all at version 5.
SDE Version was 11.1, Postgres version 12.15, postgis 3.4.
We first upgraded postgres to 13.17.
We noticed that there was some performance hits but users reported it was about normal. Then we proceeded to upgrade the geodatabase to 11.3 using Pro.
[16:17:29.847] Begin validation of sde.sde_branch_tables_modified entries with invalid edit_moments...
[16:47:46.289] Failed during validation of sde.sde_branch_tables_modified entries with invalid edit_moments
[16:47:46.289] SDE release upgrade not completed(-409).
[16:47:46.290] ERROR installing/upgrading ArcSDE, Error = -409
-409 means connection was lost to the db server.
PGAdmin showed a query was hanging for a number of hours.
It was hanging for a number of hours on a query like this:
DELETE from schema.featureclass T
where t.gdb_archive_oid in
(
select gdb_archive_oid from (
select B.gdb_branch_id, B.gdb_archive_oid
FROM sde.sde_branches A, schema.featureclass B
WHERE B.gdb_branch_id = A.branch_id AND
B.gdb_from_date > A.branch_moment
) tb_
)
Checking the WHERE clause i could see that no results were being returned so nothing would have been deleted from the query.
The query was cancelled and the sde upgrade finished with a failed result.
So I attempted again using python and server's arcgispro-py3 and still had the same issue.
We had the 'schema' user run rebuild indexes tool, which seemed to have helped the performance of the query. Retrying the sde upgrade worked, and no branch versioning inconsistencies were reported and no further action needed to be taken.
However, when trying to pull in branch versioned data into Pro, we get this error.

Any thoughts on how to address this Invalid branch moment issue?