mysql如果一个事务一直没有commit并且也没有rollback会怎样?
巴扎黑
巴扎黑 2017-04-17 13:46:53
0
4
908

mysql如果一个事务一直没有commit并且也没有rollback会怎样?
有什么办法查询到这些没有被commit也没有被rollback的事务。?

巴扎黑
巴扎黑

reply all (4)
PHPzhong

If there is an uncommitted transaction in MySQL, then the AUTOCOMMIT automatic submission parameter should be 0 at this time.
However, if you operate through MySQL drivers in other languages, these drivers generally have the function of automatically recovering AUTOCOMMIT. After the request processing is completed, unprocessed transactions will be automatically ROLLBACKed.

    阿神

    When the connection times out, transactions that have not been committed on that connection will be rolled back

      左手右手慢动作

      1. When the link is disconnected, it will automatically rollback
      2. When there is a deadlock or the lock times out, it will also rollback

        黄舟

        When the database connection is disconnected or the request ends, it will usually rollback automatically

        This is the answer everyone will give, but is it actually the rollback of the server, the startup environment (FPM), or the connection library operation of the code? ? ? Not sure, but my guess is that the tool class connected to the database automatically rollbacks, or the startup environment (FPM) automatically rollbacks directly when the server is ready to return data to the client

        There are also official documents on the Internet, for example, PHP-mysql is a rollback automatically called by PDO (database driver library). But it didn’t say when exactly it would be disconnected. . .

          Latest Downloads
          More>
          Web Effects
          Website Source Code
          Website Materials
          Front End Template
          About us Disclaimer Sitemap
          php.cn:Public welfare online PHP training,Help PHP learners grow quickly!