Skip to content
Snippets Groups Projects
  • Alvaro Herrera's avatar
    97ff2a56
    Don't MultiXactIdIsRunning when in recovery · 97ff2a56
    Alvaro Herrera authored
    In 9.1 and earlier, it is possible for index_getnext() to try to examine
    a heap buffer for possible HOT-prune when in recovery; this causes a
    problem when a multixact is found in a tuple's Xmax, because
    GetMultiXactIdMembers refuses to run when in recovery, raising an error:
    	ERROR:  cannot GetMultiXactIdMembers() during recovery
    
    This can be solved easily by having MultiXactIdIsRunning always return
    false when in recovery, which is reasonable because a HOT standby cannot
    acquire further tuple locks nor update/delete tuples.
    
    (Note: it doesn't look like this specific code path has a problem in
    9.2, because instead of doing HeapTupleSatisfiesUpdate directly,
    heap_hot_search_buffer uses HeapTupleIsSurelyDead instead.  Still, there
    may be other paths affected by the same bug, for instance in pgrowlocks,
    and the multixact code hasn't changed; so apply the same fix
    throughout.)
    
    Apply this fix to 9.0 through 9.2.  In 9.3 the multixact code has been
    changed completely and is no longer subject to this problem.
    
    Per report from Marko Tiikkaja,
    https://www.postgresql.org/message-id/54EB3283.2080305@joh.to
    Analysis by Andres Freund
    97ff2a56
    History
    Don't MultiXactIdIsRunning when in recovery
    Alvaro Herrera authored
    In 9.1 and earlier, it is possible for index_getnext() to try to examine
    a heap buffer for possible HOT-prune when in recovery; this causes a
    problem when a multixact is found in a tuple's Xmax, because
    GetMultiXactIdMembers refuses to run when in recovery, raising an error:
    	ERROR:  cannot GetMultiXactIdMembers() during recovery
    
    This can be solved easily by having MultiXactIdIsRunning always return
    false when in recovery, which is reasonable because a HOT standby cannot
    acquire further tuple locks nor update/delete tuples.
    
    (Note: it doesn't look like this specific code path has a problem in
    9.2, because instead of doing HeapTupleSatisfiesUpdate directly,
    heap_hot_search_buffer uses HeapTupleIsSurelyDead instead.  Still, there
    may be other paths affected by the same bug, for instance in pgrowlocks,
    and the multixact code hasn't changed; so apply the same fix
    throughout.)
    
    Apply this fix to 9.0 through 9.2.  In 9.3 the multixact code has been
    changed completely and is no longer subject to this problem.
    
    Per report from Marko Tiikkaja,
    https://www.postgresql.org/message-id/54EB3283.2080305@joh.to
    Analysis by Andres Freund