The reason for this session waiting can be found out in the
pg_locks table.
In this case, the
gp_segment_configuration table is being locked by a
gpbackup process that is running when the full recovery was run:
gpadmin=# select * from pg_locks where relation=5036;
locktype | database | relation | page | tuple | virtualxid | transactionid | classid | objid | objsubid | virtualtransaction | pid | mode | granted | mppsessionid | mppiswr iter | gp_segment_id
----------+----------+----------+------+-------+------------+---------------+---------+-------+----------+--------------------+------+-----------------+---------+--------------+-------- -----+---------------
relation | 0 | 5036 | | | | | | | | 3/71 | 4309 | AccessShareLock | t | 24 | t | -1 (1 row)
In
pg_locks, you also notice that the following query shows
gprecoverseg is waiting.
Note: The
locktype may vary.
gpadmin=# select * from pg_locks where relation=5036;
locktype | database | relation | page | tuple | virtualxid | transactionid | classid | objid | objsubid | virtualtransaction | pid | mode | granted | mppsession
id | mppiswriter | gp_segment_id
---------------+----------+----------+------+-------+------------+---------------+---------+-------+----------+--------------------+-------+---------------------+---------+-----------
---+-------------+---------------
resynchronize | 0 | 5036 | | | | | | | | 5/0 | 20927 | AccessExclusiveLock | f |
0 | f | 0
(1 row)
In order to resolve the issue, you need to let the backup complete or cancel the backup so that it releases the lock on
gp_segment_configuration. Once this is done,
gprecoverseg -F will proceed successfully since it will get the lock it needs on
gp_segment_configuration.