Bug #48662 Need warnings infrastructure support for removing duplicates
Submitted: 10 Nov 2009 10:50 Modified: 10 Nov 2009 18:48
Reporter: Thava Alagu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: General Severity:S4 (Feature request)
Version:5.1 OS:Any
Assigned to: CPU Architecture:Any

[10 Nov 2009 10:50] Thava Alagu
Description:
Backup team found that it will be useful to have some infrastructure support to remove duplicates in the list of warnings reported to user.

Specifically, these interfaces are proposed to be added :

 Warning_info::merge_warnings(Warning_info *); 
     This will merge source and destination warning list removing duplicates.
Note that, if there are duplicates within the source list, they should be 
removed as well.

Warning_info::push_warning(MYSQL_ERROR*);
     Pushes readily available warning.

Warning_info::push_unique_warning(MYSQL_ERROR*);
     Pushes the warning only if it is not available on the stack already.

How to repeat:
Code inspection. This is feature request.

Suggested fix:
For the purpose of checking for equality condition of two errors,
following logic will be used : 

  - If (sql_errno, sql_state, error_level, message_text) are same then they are
    considered equal without comparing for the other error conditions.
    In this case, oldest error available will be retained, the new error will be
    discarded.

    Note: The MYSQL_ERROR also has some condition state like schema name, etc.
          They won't be compared for this purpose.
          [ Clarify if this is not a problem. ]
[19 Nov 2009 19:04] Sergei Golubchik
It's not the first time such a feature is requested.

Last time it was solved by using the interface correctly, instead of promiscuously over-generating warnings and relying on the warning subsystem for removing duplicates.