Deadlock between reputation-tracker-install-indexes and block-explorer-install

Getting a deadlock error on reputation tracker index creation while also running block explorer installation on 1.27.6rc9.

reputation-tracker-install-indexes:

reputation-tracker-install-indexes-1  | Waiting for HAF to be out of massive sync
reputation-tracker-install-indexes-1  | NOTICE:  HAF instance is ready. Exiting wait loop.
reputation-tracker-install-indexes-1  |  wait_for_ready_instance 
reputation-tracker-install-indexes-1  | -------------------------
reputation-tracker-install-indexes-1  |  
reputation-tracker-install-indexes-1  | (1 row)
reputation-tracker-install-indexes-1  | 
reputation-tracker-install-indexes-1  | Creating indexes, this might take a while.
reputation-tracker-install-indexes-1  | SET
reputation-tracker-install-indexes-1  | Timing is on.
reputation-tracker-install-indexes-1  | DO
reputation-tracker-install-indexes-1  | Time: 1.239 ms
reputation-tracker-install-indexes-1  | psql:/app/scripts/../db/rep_indexes.sql:36: ERROR:  deadlock detected
reputation-tracker-install-indexes-1  | DETAIL:  Process 39741 waits for ShareLock on virtual transaction 94/12; blocked by process 39851.
reputation-tracker-install-indexes-1  | Process 39851 waits for ShareUpdateExclusiveLock on relation 16671 of database 16397; blocked by process 39741.
reputation-tracker-install-indexes-1  | HINT:  See server log for query details.

Postgresql logs:

2024-11-20 03:54:57 UTC [39741]: app=psql LOG:  process 39741 detected deadlock while waiting for ShareLock on virtual transaction 94/12 after 1000.122 ms
2024-11-20 03:54:57 UTC [39741]: app=psql DETAIL:  Process holding the lock: 39851. Wait queue: .
2024-11-20 03:54:57 UTC [39741]: app=psql STATEMENT:  CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS effective_comment_vote_idx ON hafd.operations USING btree
        (
            (body_binary::jsonb -> 'value' ->> 'author'),
            (body_binary::jsonb -> 'value' ->> 'voter'),
            (body_binary::jsonb -> 'value' ->> 'permlink'),
            id desc
        )
        WHERE hive.operation_id_to_type_id(id) = 72;
2024-11-20 03:54:57 UTC [39741]: app=psql ERROR:  deadlock detected
2024-11-20 03:54:57 UTC [39741]: app=psql DETAIL:  Process 39741 waits for ShareLock on virtual transaction 94/12; blocked by process 39851.
        Process 39851 waits for ShareUpdateExclusiveLock on relation 16671 of database 16397; blocked by process 39741.
        Process 39741: CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS effective_comment_vote_idx ON hafd.operations USING btree
        (
            (body_binary::jsonb -> 'value' ->> 'author'),
            (body_binary::jsonb -> 'value' ->> 'voter'),
            (body_binary::jsonb -> 'value' ->> 'permlink'),
            id desc
        )
        WHERE hive.operation_id_to_type_id(id) = 72;
        Process 39851: CREATE INDEX CONCURRENTLY IF NOT EXISTS hive_operations_comment_search_permlink ON hafd.operations USING btree
        (
            (body_binary::jsonb -> 'value' ->> 'author'),
            (body_binary::jsonb -> 'value' ->> 'parent_author'),
                  (body_binary::jsonb -> 'value' ->> 'permlink'),
            hive.operation_id_to_block_num(id)
        )
        WHERE hive.operation_id_to_type_id(id) = 1;
2024-11-20 03:54:57 UTC [39741]: app=psql HINT:  See server log for query details.
2024-11-20 03:54:57 UTC [39741]: app=psql STATEMENT:  CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS effective_comment_vote_idx ON hafd.operations USING btree
        (
            (body_binary::jsonb -> 'value' ->> 'author'),
            (body_binary::jsonb -> 'value' ->> 'voter'),
            (body_binary::jsonb -> 'value' ->> 'permlink'),
            id desc
        )
        WHERE hive.operation_id_to_type_id(id) = 72;
2024-11-20 03:54:57 UTC [39851]: app=psql LOG:  process 39851 acquired ShareUpdateExclusiveLock on relation 16671 of database 16397 after 10468433.719 ms
2024-11-20 03:54:57 UTC [39851]: app=psql STATEMENT:  CREATE INDEX CONCURRENTLY IF NOT EXISTS hive_operations_comment_search_permlink ON hafd.operations USING btree
        (
            (body_binary::jsonb -> 'value' ->> 'author'),
            (body_binary::jsonb -> 'value' ->> 'parent_author'),
                  (body_binary::jsonb -> 'value' ->> 'permlink'),
            hive.operation_id_to_block_num(id)
        )
        WHERE hive.operation_id_to_type_id(id) = 1;
2024-11-20 03:54:57 UTC [39741]: app=psql LOG:  disconnection: session time: 2:54:42.119 user=haf_admin database=haf_block_log host=172.18.0.6 port=36778
Edited by TechCoderX