• Daniele Sciascia's avatar
    MDEV-13549 Fix test galera.galera_wsrep_desync_wsrep_on · 7925cdff
    Daniele Sciascia authored
    The test tends to fail if many parallel instances of it are executed:
    
    ```
    mysqltest: At line 23: query 'ALTER TABLE t1 ADD PRIMARY KEY (f1)' failed:
    1317: Query execution was interrupted
    ```
    
    The `ALTER` fails because it is BF aborted due to an earlier `INSERT SELECT`
    that is being applied:
    
    ```
    INSERT INTO t1 (f1) SELECT ...
    
    --connection node_2
    SET GLOBAL wsrep_desync = TRUE;
    SET SESSION wsrep_on = FALSE;
    
    ALTER TABLE t1 ADD PRIMARY KEY (f1);
    
    SET SESSION wsrep_on = TRUE;
    SET GLOBAL wsrep_desync = FALSE;
    ```
    
    And because the `ALTER` is executed with `wsrep_on = OFF`, it does not
    run in total order isolation.
    To avoid the problem it must be ensured that the `ALTER` only after the
    large `INSERT SELECT` is done. To do so it is sufficient to issue
    `SELECT COUNT(*) FROM t1;` from `node_2` before turning off wsrep.
    The `SELECT` will trigger `wsrep_sync_wait` and proceed only after the
    `INSERT SELECT` from node_1 is done.
    7925cdff
galera_wsrep_desync_wsrep_on.result 1.24 KB