Skip to content
  • Praveenkumar Hulakund's avatar
    83556c14
    Bug#28122841 - CREATE EVENT/PROCEDURE/FUNCTION CRASHES WITH ACCENT INSENSITIVE · 83556c14
    Praveenkumar Hulakund authored
    NAMES.
    
    Issue here is, stored routines, events and resource group names
    are case and accent insensitive. While creating MDL_key and
    data-dictionary cache keys, only case sensitiveness is considered
    but not the accent sensitiveness for these object names. Hence
    key comparison of accent insensitive name yielded the wrong
    result and hit the asserts mentioned in the bug report.
    
    While creating MDL_key and DD cache key, currently the case
    is stripped off by lower casing the names. But for key comparisons
    to yield correct result, even the accent should be stripped off
    from the names.
    
    So to fix this issue, while creating keys for MDL and DD cache
    the object names are normalized (to strip off both case and accent).
    The normalized name contains weights of each character of the
    name (strnxfrm() of collation is used to normalize the name).
    utf8_general_ci collation is used by these objects and normalized
    name contains two byte value for each character with the
    utf8_general_ci collation. The normalized name is used in the
    comparison and it yields the expected result.
    
    MDL_key with normalized object name:
    
      MDL_key::mdl_key_init() is overloaded to accept the normalized
      object name and form a key with a quadruplet
    
       @<mdl_namespace@>+@<database name@>+@<normalized object name@>+
                                                  @<object name@>
    
      For key compare operations, key length only till end of
      normalized object name is used.
    
      Object name in the MDL_key is used by the performance_schema
      for metadata locks listing. Similar to MDL_key from for columns,
      object name is stored only if there is sufficient space.
      Not listing a object name from the performance schema when
      there is no space should be OK instead of increasing the MDL_key
      size to store full object name.
    
    DD cache key with normalized object name:
    
      DD Global_name_key, Item_name_key and Routine_name_key class's
      operator<() is updated to compare object names using my_strnncoll().
      New static method name_collation() in dd::tables::* classes gets the
      collation used for the name field. Same collation is used with
      my_strnncoll() to yield the correct results.
    
      TODO: Object_table_definition_impl::name_collation() is implemented
            as a static function now.
            Changing name collation is not supported during upgrade now.
            To support this, static definition of this method should be
            avoided and should provide a possibility to have different
            collations for actual and target table definition.
    
    Sroutine_has_entry with normalized routine object name:
    
      The key for the Sroutine_has_entry hash is modified to hold the
      normalized names for the stored routines now. Binary comparison
      of routine keys yield the correct results.
    
    Change-Id: I70276c4128422168ba81c9d5e28efe8d80244d9b
    83556c14
    Bug#28122841 - CREATE EVENT/PROCEDURE/FUNCTION CRASHES WITH ACCENT INSENSITIVE
    Praveenkumar Hulakund authored
    NAMES.
    
    Issue here is, stored routines, events and resource group names
    are case and accent insensitive. While creating MDL_key and
    data-dictionary cache keys, only case sensitiveness is considered
    but not the accent sensitiveness for these object names. Hence
    key comparison of accent insensitive name yielded the wrong
    result and hit the asserts mentioned in the bug report.
    
    While creating MDL_key and DD cache key, currently the case
    is stripped off by lower casing the names. But for key comparisons
    to yield correct result, even the accent should be stripped off
    from the names.
    
    So to fix this issue, while creating keys for MDL and DD cache
    the object names are normalized (to strip off both case and accent).
    The normalized name contains weights of each character of the
    name (strnxfrm() of collation is used to normalize the name).
    utf8_general_ci collation is used by these objects and normalized
    name contains two byte value for each character with the
    utf8_general_ci collation. The normalized name is used in the
    comparison and it yields the expected result.
    
    MDL_key with normalized object name:
    
      MDL_key::mdl_key_init() is overloaded to accept the normalized
      object name and form a key with a quadruplet
    
       @<mdl_namespace@>+@<database name@>+@<normalized object name@>+
                                                  @<object name@>
    
      For key compare operations, key length only till end of
      normalized object name is used.
    
      Object name in the MDL_key is used by the performance_schema
      for metadata locks listing. Similar to MDL_key from for columns,
      object name is stored only if there is sufficient space.
      Not listing a object name from the performance schema when
      there is no space should be OK instead of increasing the MDL_key
      size to store full object name.
    
    DD cache key with normalized object name:
    
      DD Global_name_key, Item_name_key and Routine_name_key class's
      operator<() is updated to compare object names using my_strnncoll().
      New static method name_collation() in dd::tables::* classes gets the
      collation used for the name field. Same collation is used with
      my_strnncoll() to yield the correct results.
    
      TODO: Object_table_definition_impl::name_collation() is implemented
            as a static function now.
            Changing name collation is not supported during upgrade now.
            To support this, static definition of this method should be
            avoided and should provide a possibility to have different
            collations for actual and target table definition.
    
    Sroutine_has_entry with normalized routine object name:
    
      The key for the Sroutine_has_entry hash is modified to hold the
      normalized names for the stored routines now. Binary comparison
      of routine keys yield the correct results.
    
    Change-Id: I70276c4128422168ba81c9d5e28efe8d80244d9b
Loading