• Marko Mäkelä's avatar
    MDEV-12057 Embedded server shutdown hangs in InnoDB · 1b4b4f68
    Marko Mäkelä authored
    Ever since MDEV-5800 enabled indexed virtual columns for InnoDB,
    the InnoDB shutdown relied on close_connections() that would set
    thd->killed for the InnoDB purge threads. Alas, the embedded server
    shutdown is not invoking close_connections(), and thus InnoDB purge
    threads fail to initiate shutdown, causing a hang.
    
    innodb_inited: Remove. Use srv_was_started instead.
    
    innobase_fast_shutdown: Remove. Use srv_fast_shutdown instead.
    
    srv_running: Renamed from thd_destructor_myvar, and made global.
    The value NULL means that shutdown was requested or the purge threads
    should not be running because of innodb_read_only_mode=1.
    
    innobase_init(): Set srv_was_started after ensuring that srv_running
    was initialized. (In innodb_read_only mode, the purge threads are not
    started and we do not care if srv_running==NULL.)
    
    innobase_start_or_create_for_mysql(): Do not set srv_was_started.
    Let it be set by the only caller innobase_init().
    
    srv_purge_should_exit(): Check also srv_was_started and srv_running
    when evaluating thd->killed.
    1b4b4f68
srv0srv.cc 90.7 KB