• Sujatha Sivakumar's avatar
    Bug#17429677:LAST ARGUMENT OF LOAD DATA ...SET ...STATEMENT · bdb62daa
    Sujatha Sivakumar authored
    REPEATED TWICE IN BINLOG
    
    Problem:
    =======
    If LOAD DATA ... SET ... is used the last argument of SET is
    repeated twice in replication binlog.
    
    Analysis:
    ========
    LOAD DATA statements are reconstructed once again before
    they are written to the binary log. When SET clauses are
    specified as part of LOAD DATA statement, these SET clause
    user command strings need to be stored in order to rebuild
    the original user command. During parsing each column and
    the value in the SET command are stored in two differenet
    lists. All the values are stored in a string list.
    
    When SET expression has more than one value as shown in the
    following example:
    SET a = @A, b = CONCAT(@b, '| 123456789');
    
    Parser extracts values in the following manner i.e Item name
    , value string, actual length of the value of the item with
    in the string.
    
    Item a:
    Value for a:"= @A, b = CONCAT(@b, '| 123456789')
    str_length = 4
    Item b:
    Value for b:"= CONCAT(@b, '| 123456789')
    str_length = 27
    
    During reconstructing the LOAD DATA command the above
    strings are retrived as it is and appended to the LOAD DATA
    statement. Hence it becomes as shown below.
    
    SET `a`= @A, b = CONCAT(@b, '| 123456789'),
    `b`= CONCAT(@b, '| 123456789')
    
    Fix:
    ===
    During reconstruction of SET command, retrieve exact item
    value string rather than reading the entire string.
    bdb62daa
sql_load.cc 58.6 KB