>It fails with the state then we have 2 indexes (leaf_part_rri->ri_NumIndices=2) and EACH OF them have an ancestor. So, both of them are added as arbiters.
I found the cause of the issue.
As Álvaro mentioned early - get_partition_ancestors does not uses any caches, so, each scan invalidates catalog snapshot [0].
In our case for first index - snapshot sees data before index_concurrently_swap committed, but for second one - after. It is rear case, but possible.
It is not a new problem (caused by that patch set), the same may happen before, but in little bit different way:
1) some index selected (old one) for plan
2) index_concurrently_swap committed
3) get_partition_ancestors uses new catalog snapshot and sees 0 ancestors for the index - the same error
So, test found the issue - great. I'll prepare the fix and additonal test later this week.