• Andrei's avatar
    MDEV-26071: rpl.rpl_perfschema_applier_status_by_worker failed in bb … · 216d99bb
    Andrei authored
    …with: Test assertion failed
    
    Problem:
    =======
    Assertion text: 'Value returned by SSS and PS table for Last_Error_Number
    should be same.'
    Assertion condition: '"1146" = "0"'
    Assertion condition, interpolated: '"1146" = "0"'
    Assertion result: '0'
    
    Analysis:
    ========
    In parallel replication when slave is started the worker pool gets
    activated and it gets cleared when slave stops. Each time the worker pool
    gets activated a backup worker pool also gets created to store worker
    specific perforance schema information in case of errors. On error, all
    relevant information is copied from rpl_parallel_thread to rli and it gets
    cleared from thread.  Then server waits for all workers to complete their
    work, during this stage performance schema table specific worker info is
    stored into the backup pool and finally the actual pool gets cleared. If
    users query the performance schema table to know the status of workers the
    information from backup pool will be used. The test simulates
    ER_NO_SUCH_TABLE error and verifies the worker information in pfs table.
    Test works fine if execution occurs in following order.
    
    Step 1. Error occurred 'worker information is copied to backup pool'.
    Step 2. handle_slave_sql invokes 'rpl_parallel_resize_pool_if_no_slaves' to
    deactivate worker pool, it marks the pool->count=0
    Step 3. PFS table is queried, since actual pool is deactivated backup pool
    information is read.
    
    If the Step 3 happens prior to Step2 the pool is yet to be deactivated and
    the actual pool is read, which doesn't have any error details as they were
    cleared. Hence test ocasionally fails.
    
    Fix:
    ===
    Upon error mark the back pool as being active so that if PFS table is
    quried since the backup pool is flagged as valid its information will be
    read, in case it is not flagged regular pool will be read.
    
    This work is one of the last pieces created by the late Sujatha Sivakumar.
    216d99bb
rpl_parallel.h 15.2 KB