Skip to content
  • Marc Alff's avatar
    3fedb757
    Bug#20896539 - A QUERY DIGEST SOMETIMES CONTAIN BACKTICKS AND SOMETIMES NOT · 3fedb757
    Marc Alff authored
    DEPENDING ON CS
    
    Before this fix, queries like
      SELECT * from t1
    would be instrumented:
    - sometime with a digest text of SELECT * from t1, and a digest hash H1
    - sometime with a digest text of SELECT * from `t1`, and a digest hash H2
    
    The root cause is in the parser, which, for the same query text t1,
    returns:
    - sometime an IDENT token
    - sometime an IDENT_QUOTED token,
    depending on both:
    - whether the identifier is strictly a 7bit string or not
    - whether the character set used to express the query text is multi byte or
      not
    
    For use of digests and digest texts, such as:
    - aggregation statistics by digest in the performance schema
    - query match in the query rewrite plugin
    - query match in the firewall plugin
    the code fails to identify similar queries,
    because of the difference in computed digest.
    
    With this fix, both tokens:
    - IDENT
    - IDENT_QUOTED
    are reduced to the same value, and printed the same way,
    so that digests and digests texts are the same for similar queries.
    3fedb757
    Bug#20896539 - A QUERY DIGEST SOMETIMES CONTAIN BACKTICKS AND SOMETIMES NOT
    Marc Alff authored
    DEPENDING ON CS
    
    Before this fix, queries like
      SELECT * from t1
    would be instrumented:
    - sometime with a digest text of SELECT * from t1, and a digest hash H1
    - sometime with a digest text of SELECT * from `t1`, and a digest hash H2
    
    The root cause is in the parser, which, for the same query text t1,
    returns:
    - sometime an IDENT token
    - sometime an IDENT_QUOTED token,
    depending on both:
    - whether the identifier is strictly a 7bit string or not
    - whether the character set used to express the query text is multi byte or
      not
    
    For use of digests and digest texts, such as:
    - aggregation statistics by digest in the performance schema
    - query match in the query rewrite plugin
    - query match in the firewall plugin
    the code fails to identify similar queries,
    because of the difference in computed digest.
    
    With this fix, both tokens:
    - IDENT
    - IDENT_QUOTED
    are reduced to the same value, and printed the same way,
    so that digests and digests texts are the same for similar queries.
Loading