Skip to content
  • Marc Alff's avatar
    349ec4b0
    Bug#17243619 NEGATIVE VALUES FOR LOW COLUMNS · 349ec4b0
    Marc Alff authored
     IN MEMORY_SUMMARY_GLOBAL_BY_EVENT_NAME
    
    This bug is similar to
     bug 17473077 - EVER INCREASING MEMORY USAGE REPORTED FOR
    EVENT SCHEDULER
    
    Some data structures are shared in the server,
    which imply that the memory instrument used should be flagged with
    PSI_FLAG_GLOBAL.
    
    What is particular to this fix is that the data structures used are
    containers, such as lists, hash tables, etc.
    
    Currently, the performance schema instrumentation,
    for containers, works as follows.
    
    Elements X, Y and Z are instrumented with their dedicated keys,
    "memory/sql/X", "memory/sql/Y" or "memory/sql/Z",
    so that statistics are separate for X, Y and Z
    
    Generic containers are instrumented with a common key,
    so that Container<X>, Container<Y> and Container<Z>
    all end up instrumented under the same key "memory/sql/Container".
    
    This leads to the following issues:
    
    - Statistics for Container<X>, Container<Y> and Container<Z> are all counted
      under the same bucket. This makes very difficult to understand where
      memory is really used.
    
    - Statistics for 'X' and 'Container<X>' are not aggregated,
      which makes it difficult to really measure the total footprint
      of a "Container of X" data structure.
    
    - Container<X> can be a global structure (shared) while Container<Y>
      can be a per session structure. Each need different accounting flags
      (PSI_FLAG_GLOBAL or not), but this is impossible with a common
      key like "memory/sql/Container", leading to the bug reported.
    
    What this fix implements is as follows:
    
    - Container keys like "memory/sql/Container" are removed.
    
    - Containers now take the memory instrumentation key from the caller,
      so that Container<X> is instrumented with "memory/sql/X"
      and Container<Y> is instrumented with "memory/sql/Y"
    
    - 'X' and 'Container<X>' are now instrumented together,
      with the key for 'X'.
      This affects tests output, which measure now a bigger (and more accurate)
      memory usage.
    
    The affected containers are:
    - HASH and my_hash_init()
    - DYNAMIC_ARRAY and my_init_dynamic_array()
    - class hash_filo and hash_filo::hash_filo()
    - class Hash_set and Hash_set::Hash_set()
    
    The change is big in size, but mechanical: always pass the instrumentation
    key explicitely from the calling code, for containers.
    349ec4b0
    Bug#17243619 NEGATIVE VALUES FOR LOW COLUMNS
    Marc Alff authored
     IN MEMORY_SUMMARY_GLOBAL_BY_EVENT_NAME
    
    This bug is similar to
     bug 17473077 - EVER INCREASING MEMORY USAGE REPORTED FOR
    EVENT SCHEDULER
    
    Some data structures are shared in the server,
    which imply that the memory instrument used should be flagged with
    PSI_FLAG_GLOBAL.
    
    What is particular to this fix is that the data structures used are
    containers, such as lists, hash tables, etc.
    
    Currently, the performance schema instrumentation,
    for containers, works as follows.
    
    Elements X, Y and Z are instrumented with their dedicated keys,
    "memory/sql/X", "memory/sql/Y" or "memory/sql/Z",
    so that statistics are separate for X, Y and Z
    
    Generic containers are instrumented with a common key,
    so that Container<X>, Container<Y> and Container<Z>
    all end up instrumented under the same key "memory/sql/Container".
    
    This leads to the following issues:
    
    - Statistics for Container<X>, Container<Y> and Container<Z> are all counted
      under the same bucket. This makes very difficult to understand where
      memory is really used.
    
    - Statistics for 'X' and 'Container<X>' are not aggregated,
      which makes it difficult to really measure the total footprint
      of a "Container of X" data structure.
    
    - Container<X> can be a global structure (shared) while Container<Y>
      can be a per session structure. Each need different accounting flags
      (PSI_FLAG_GLOBAL or not), but this is impossible with a common
      key like "memory/sql/Container", leading to the bug reported.
    
    What this fix implements is as follows:
    
    - Container keys like "memory/sql/Container" are removed.
    
    - Containers now take the memory instrumentation key from the caller,
      so that Container<X> is instrumented with "memory/sql/X"
      and Container<Y> is instrumented with "memory/sql/Y"
    
    - 'X' and 'Container<X>' are now instrumented together,
      with the key for 'X'.
      This affects tests output, which measure now a bigger (and more accurate)
      memory usage.
    
    The affected containers are:
    - HASH and my_hash_init()
    - DYNAMIC_ARRAY and my_init_dynamic_array()
    - class hash_filo and hash_filo::hash_filo()
    - class Hash_set and Hash_set::Hash_set()
    
    The change is big in size, but mechanical: always pass the instrumentation
    key explicitely from the calling code, for containers.
Loading