ZiLong
V2EX  ›  问与答

Mysql 的事务是互斥的么

  •  
  •   ZiLong · Sep 28, 2016 · 1916 views
    This topic created in 3694 days ago, the information mentioned may be changed or developed.

    具体来说,分别在不同线程并发调用带事务的某个方法,那么这些方法对数据的操作是互斥的么,即必须等某个方法的所有数据库操作完成后,才能执行下一个方法的数据库操作?

    3 replies  •  2016-09-28 16:03:30 +08:00
    pubby
    pubby
    Sep 28, 2016 via Android
    1
    事务不是锁
    ZiLong
    ZiLong
    OP
    Sep 28, 2016
    2
    @pubby 但是事务的隔离性是用锁等基础设施实现的
    pubby
    pubby
    Sep 28, 2016 via Android
    3
    但是事务用到的内部锁可能跟你期望的不一样啊。
    要互斥的话还是另外上锁,要跨机器的话,用 MySQL 的 GET_LOCK()之类的也很好实现
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4237 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 09:36 · PVG 17:36 · LAX 01:36 · JFK 04:36
    ♥ Do have faith in what you're doing.