Lock wait timeout exceeded; try restarting transaction

Ich auftreten Lock wait timeout exceeded error.
unten ist die Ausnahme:

org.springframework.dao.CannotAcquireLockException: 
### Error updating database.  Cause: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
### The error may involve commManager.updateOrderHotelInfo-Inline
### The error occurred while setting parameters
### Cause: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
; SQL []; Lock wait timeout exceeded; try restarting transaction; nested exception is java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:261)
 at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
 at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:71)
 at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)
 at $Proxy21.update(Unknown Source)
 at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:246)

Frühjahr Transaktion config

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>

nutzen Spring-annotation @Transactional,es zu werfen Ausnahme.aber ändern zu @Transactional(propagation=Propagation.REQUIRES_NEW) ,ist es ok.

Ich ausführen von show engine innodb status \G auf den MySqlServer ,diese Ausgabe:
--TRANSAKTION 107D2F81, AKTIV 18 sec ab index Lesen
mysql tables in use 1, gesperrt 1
SPERRE WARTEN Sie 5 lock struct(s), heap-Größe 1248, 3 row lock(s), undo-log-Einträge 1
Der MySQL thread id 23795, OS-thread-handle 0x50e8a940, query-id 207416339 192.168.126.236 ppb Aktualisieren
UPDATE commission_order_hotel_info_ext
SET auditor_tel = '0898-88350052',

            global_commission_percent = 10.00,


            guarantee = '{\"type\":\"none\"}' 
    WHERE
        hotel_id = 10190

Trx lese-Ansicht nicht sehen trx mit id >= 107D2F82, sieht < 107D1795
------- TRX WARTET SEIT 18 SEC FÜR DIESES SCHLOSS GEWÄHRT WERDEN:

DATENSATZ SPERREN-space-id 3123 Seite 3 n bit 128-index PRIMARY Tabelle hms.commission_order_hotel_info_ext trx-id 107D2F81 lock_mode X warten

TABLE LOCK table hms.order_hotel_info trx-id 107D2F81 Sperrmodus IX
DATENSATZ SPERREN-space-id 2874 Seite 16 n bits 1272 index uniq_hotel_id Tabelle hms.order_hotel_info trx-id 107D2F81 lock_mode X-sperren rec aber keine Lücke
DATENSATZ SPERREN-space-id 2874 Seite 6 n bits 184 index PRIMARY Tabelle hms.order_hotel_info trx-id 107D2F81 lock_mode X-sperren rec aber keine Lücke
TABLE LOCK table hms.commission_order_hotel_info_ext trx-id 107D2F81 Sperrmodus IX
DATENSATZ SPERREN-space-id 3123 Seite 3 n bit 128-index PRIMARY Tabelle hms.commission_order_hotel_info_ext trx-id 107D2F81 lock_mode X warten
---TRANSAKTION 107D1795, ACTIVE 845 sec
5 lock-struct(s), heap-Größe 1248, 59 row lock(s), undo-log-Einträge 2
Der MySQL thread id 23819, OS-thread-handle 0x50dc7940, query-id 207389624 192.168.126.83 ppb
Trx-lese-Ansicht nicht sehen trx mit id >= 107D1796, sieht < 107D1796
TABLE LOCK table hms.order_hotel_info trx-id 107D1795 Sperrmodus IX
DATENSATZ SPERREN-space-id 2874 Seite 16 n bits 1272 index uniq_hotel_id Tabelle hms.order_hotel_info trx-id 107D1795 lock_mode X-sperren rec aber keine Lücke
DATENSATZ SPERREN-space-id 2874 Seite 44 n bits 232 index PRIMARY Tabelle hms.order_hotel_info trx-id 107D1795 lock_mode X-sperren rec aber keine Lücke
TABLE LOCK table hms.commission_order_hotel_info_ext trx-id 107D1795 Sperrmodus IX
DATENSATZ SPERREN-space-id 3123 Seite 3 n bit 128-index PRIMARY Tabelle hms.commission_order_hotel_info_ext trx-id 107D1795 lock_mode X

welche Schritte es zu lösen

  • Würden Sie bitte Ihre Transaktion Einstellungen und Ihren code damit wir sehen können, was könnte das Problem verursachen?
  • nutzen Spring-annotation @Transactional,es zu werfen Ausnahme.aber ändern zu @Transactional(propagation=Propagation.REQUIRES_NEW) ,ist es ok.
  • hinzufügen MySQL-server-Informationen.isolation ist REPEATABLE-READ
InformationsquelleAutor fuyou001 | 2012-10-11
Schreibe einen Kommentar