简体   繁体   中英

Is innodb_flush_log_at_trx_commit=1 means that if commit return ok, the buffer is flush to log?

I write a test program:

  1. start a transaction
  2. insert 100000 rows into a table
  3. commit
  4. select count(1) from the table and get 100000 returned
  5. use kill -9 to shutdown mysqld thread

then restart, I found that innodb crash recovery happended

Did you read https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_flush_log_at_trx_commit ? It says in part:

  • innodb_flush_log_at_trx_commit

    The default value of 1 is required for full ACID compliance. With this value, the contents of the InnoDB log buffer are written out to the log file at each transaction commit and the log file is flushed to disk.

Are you surprised that InnoDB crash recovery runs after you kill -9 the mysqld process? It's not clear from your question if you're asking if this is normal. It is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM