mysql 行锁与性能分析,以及等待超时

  1. mysql数据库请求等待超时, 不存在死锁, show processlist中只有一条sql
  2. select count(0) as count from s_asset where mtl_id = 7 and company_id = 68 for update
  3. `[2018-02-12 11:31:32.772] [ERROR] app - Error: ER_LOCK_WAIT_TIMEOUT: Lock wait timeout exceeded; try restarting transaction
    29572 at Query.Sequence._packetToError (/server/busrace/node_modules/mysql/lib/protocol/sequences/Sequence.js:52:14)
    29573 at Query.ErrorPacket (/server/busrace/node_modules/mysql/lib/protocol/sequences/Query.js:77:18)
    29574 at Protocol._parsePacket (/server/busrace/node_modules/mysql/lib/protocol/Protocol.js:279:23)
    29575 at Parser.write (/server/busrace/node_modules/mysql/lib/protocol/Parser.js:76:12)
    29576 at Protocol.write (/server/busrace/node_modules/mysql/lib/protocol/Protocol.js:39:16)
    29577 at Socket.<anonymous> (/server/busrace/node_modules/mysql/lib/Connection.js:103:28)
    29578 at emitOne (events.js:77:13)
    29579 at Socket.emit (events.js:169:7)
    29580 at readableAddChunk (_stream_readable.js:146:16)
    29581 at Socket.Readable.push (_stream_readable.js:110:10)
    29582 --------------------
    29583 at Protocol._enqueue (/server/busrace/node_modules/mysql/lib/protocol/Protocol.js:145:48)
    29584 at PoolConnection.query (/server/busrace/node_modules/mysql/lib/Connection.js:208:25)
    29585 at proto.reduceAssets (/server/busrace/model/s_asset.js:32:16)
    29586 at /server/busrace/service/company/trade.js:157:30
    29587 at carry (/server/busrace/node_modules/thenjs/then.js:54:10)
    29588 at Immediate._onImmediate (/server/busrace/node_modules/thenjs/then.js:64:13)
    29589 at processImmediate [as _immediateCallback] (timers.js:374:17)`
阅读 1.6k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进