Skip to content
  • Mauritz Sundell's avatar
    bf7a132b
    Cherry-picked from mysql-5.6.22-release · bf7a132b
    Mauritz Sundell authored
    ------------------------------------------------------------
    revno: 6230
    revision-id: venkatesh.duggirala@oracle.com-20141030170343-4pfljkuwt48gkerg
    parent: marko.makela@oracle.com-20141030065549-onni0r95h2uc4s8w
    committer: Venkatesh Duggirala<venkatesh.duggirala@oracle.com>
    branch nick: mysql-5.6
    timestamp: Thu 2014-10-30 22:33:43 +0530
    message:
      Bug#19704825 TEMPORARY SLAVE TYPE CONVERSION TABLES RELEASED TO EARLY
      
      Problem: The memory used in preparing slave type conversion temporary table
      is getting released early and causing unexpected results
            
      Analysis: As part of bug#18770469 fix, We introduced an event
      m_event_mem_root (a special mem root), added to Log_event
      class. While server is creating the temporary table, the memory needed
      is allocated from this special mem root which will be freed in ~Log_event()
      i.e., the scope of this memroot is one event. But it could happen
      that in some cases, server might need to access this
      conversion temporary table for next following event. 
      For eg: A nested row event (insert is causing insert in a trigger)
      In this situation, the memory is getting delayed too early 
      and causing issues when the server is trying to access the temporary
      table inside the trigger.
            
      Fix: We cannot use a mem_root whose scope is limited to an event
      execution in this situation. With some further analysis, found out
      that clearing a thd->mem_root at the end of statement (upon applying
      an event which has STMT_END_F flag) will solve out of memory problem
      while running a long transactions (bug#18770469) and will also
      make this reported problem (memory is getting released early) to go away.
    bf7a132b
    Cherry-picked from mysql-5.6.22-release
    Mauritz Sundell authored
    ------------------------------------------------------------
    revno: 6230
    revision-id: venkatesh.duggirala@oracle.com-20141030170343-4pfljkuwt48gkerg
    parent: marko.makela@oracle.com-20141030065549-onni0r95h2uc4s8w
    committer: Venkatesh Duggirala<venkatesh.duggirala@oracle.com>
    branch nick: mysql-5.6
    timestamp: Thu 2014-10-30 22:33:43 +0530
    message:
      Bug#19704825 TEMPORARY SLAVE TYPE CONVERSION TABLES RELEASED TO EARLY
      
      Problem: The memory used in preparing slave type conversion temporary table
      is getting released early and causing unexpected results
            
      Analysis: As part of bug#18770469 fix, We introduced an event
      m_event_mem_root (a special mem root), added to Log_event
      class. While server is creating the temporary table, the memory needed
      is allocated from this special mem root which will be freed in ~Log_event()
      i.e., the scope of this memroot is one event. But it could happen
      that in some cases, server might need to access this
      conversion temporary table for next following event. 
      For eg: A nested row event (insert is causing insert in a trigger)
      In this situation, the memory is getting delayed too early 
      and causing issues when the server is trying to access the temporary
      table inside the trigger.
            
      Fix: We cannot use a mem_root whose scope is limited to an event
      execution in this situation. With some further analysis, found out
      that clearing a thd->mem_root at the end of statement (upon applying
      an event which has STMT_END_F flag) will solve out of memory problem
      while running a long transactions (bug#18770469) and will also
      make this reported problem (memory is getting released early) to go away.
Loading