JPA多线程事务。死锁

时间:2015-08-18 16:39:10

标签: mysql multithreading jpa transactions

我遇到了死锁问题。我有一个访问表上多线程读/写的系统(EVENTS)。 enter image description here

第一个操作是读取具有相同键的元组(ID_EVENTO)是否已存在(find方法)。在缺席的情况下,它继续插入。如果找到元组,则使用以下内容。

我的设置如下。如。多线程环境中的GlassFish 4.1,MySQL DB,Java 1.7,JPA(CMT + datasourse JTA)

的persistence.xml

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_1_0.xsd"
version="1.0">
<persistence-unit name="surebet-unit" transaction-type="JTA">
<jta-data-source>surebetDB</jta-data-source>
<class>com.surebetfinder.dao.ejb.Evento</class>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
        <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/surebetdb" />
        <property name="javax.persistence.jdbc.user" value="" />
        <property name="javax.persistence.jdbc.password" value="" />
        <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
        <property name="eclipselink.logging.level" value="ALL" />

    </properties>
</persistence-unit>

这是我的业务功能,它由异步bean

调用
@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
public class GestoreScommesse {
    private final static Logger log = Logger.getLogger(GestoreScommesse.class);

    @Resource
    private SessionContext context;

    @EJB
    private SurebetService service;

    @EJB
    private SurebetManager manager;

    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    private Evento creaScriveEvento(EventoMod e) throws SureBetException {
    log.debug("Cerco sul DB evento con ID " + e.getIdEvento());
    try {
        Evento evento = this.service.findLock(Evento.class, e.getIdEvento());           
        if (evento == null) {
            log.debug("Evento non presente sul DB con ID " + e.getIdEvento());
            evento = impostaEvento(e);
            log.debug("Scrivo EVENTO  "+evento);
            this.service.create(evento);
            log.debug("Creato nuovo evento su " + e.getIdEvento());
        } else {
            this.service.getEm().lock(evento, LockModeType.PESSIMISTIC_WRITE);
            log.debug("Evento già presente con id " + e.getIdEvento());
        }
        return evento;
    } catch (Throwable e1) {            
        log.error("Errore nella scrittura dell'evento ", e1);
        context.setRollbackOnly();
        throw new SureBetException(e1);     
    }
}

这是DAO:

@Stateless
@TransactionAttribute(TransactionAttributeType.MANDATORY)

public class SurebetService {

    @PersistenceContext
    EntityManager em;


    public <T> T find(Class<T> type, Object id) {
        this.em.flush();
        return (T) this.em.find(type, id);
    }


        public <T> T findLock(Class<T> type, Object id) {
            this.em.flush();
            return (T) this.em.find(type, id, LockModeType.PESSIMISTIC_WRITE);
}
    public EntityManager getEm() {
        return em;
    }

    public void setEm(EntityManager em) {
        this.em = em;
    }
}

这是错误:

    2015-08-18 17:22:03 ERROR [com.surebetfinder.logic.GestoreScommesse:130] - Errore nella lavorazione della giocata 
    javax.ejb.EJBTransactionRolledbackException
        at com.sun.ejb.containers.BaseContainer.mapLocal3xException(BaseContainer.java:2342)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2123)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2044)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:220)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
        at com.sun.proxy.$Proxy177.findWithNamedQuery(Unknown Source)
        at com.surebetfinder.dao.access.__EJB31_Generated__SurebetService__Intf____Bean__.findWithNamedQuery(Unknown Source)
        at com.surebetfinder.logic.GestoreScommesse.estraiBookmakerCorrente(GestoreScommesse.java:157)
        at com.surebetfinder.logic.GestoreScommesse.creaBookmaker(GestoreScommesse.java:137)
        at com.surebetfinder.logic.GestoreScommesse.lavoraGiocata(GestoreScommesse.java:119)
        at com.surebetfinder.logic.GestoreScommesse.lavoraScommessa(GestoreScommesse.java:73)
        at com.surebetfinder.logic.GestoreScommesse.memorizzaGiocate(GestoreScommesse.java:57)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1081)
        at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1153)
        at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4786)
        at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:656)
        at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
        at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
        at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:46)
        at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
        at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
        at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
        at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
        at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
        at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:140)
        at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
        at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
        at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:369)
        at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:4758)
        at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4746)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:212)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
        at com.sun.proxy.$Proxy175.memorizzaGiocate(Unknown Source)
        at com.surebetfinder.logic.__EJB31_Generated__GestoreScommesse__Intf____Bean__.memorizzaGiocate(Unknown Source)
        at com.surebetfinder.logic.processi.WorkerThread.processCommand(WorkerThread.java:45)
        at com.surebetfinder.logic.processi.WorkerThread.run(WorkerThread.java:35)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1081)
        at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1153)
        at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4786)
        at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:656)
        at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
        at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
        at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55)
        at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
        at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
        at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
        at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
        at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
        at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:140)
        at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
        at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
        at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:369)
        at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:4758)
        at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4746)
        at com.sun.ejb.containers.EjbAsyncTask.call(EjbAsyncTask.java:101)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean
        at com.sun.ejb.containers.EJBContainerTransactionManager.checkExceptionClientTx(EJBContainerTransactionManager.java:662)
        at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:495)
        at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4566)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2074)
        ... 77 more
    Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
    Error Code: 1205
    Call: UPDATE EVENTO SET VERSION = ? WHERE ((ID_EVENTO = ?) AND (VERSION = ?))
        bind => [3 parameters bound]
    Query: UpdateObjectQuery(Evento [idEvento=1833911, competizione=MLB, dtEvento=Wed Aug 19 01:05:00 CEST 2015, nazione=Usa, puntata=PITTSBURGH PIRATES - ARIZONA DIAMONDBACKS, sportBean=com.surebetfinder.dao.ejb.Sport@4f66de54])

我试图在没有:

的情况下运行方法creaScriveEvento

     this.service.getEm()。lock(evento,LockModeType.PESSIMISTIC_WRITE);

但是发生了僵局。

javax.ejb.EJBTransactionRolledbackException
    at com.sun.ejb.containers.BaseContainer.mapLocal3xException(BaseContainer.java:2342)
    at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2123)
    at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2044)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:220)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
    at com.sun.proxy.$Proxy283.create(Unknown Source)
    at com.surebetfinder.dao.access.__EJB31_Generated__SurebetService__Intf____Bean__.create(Unknown Source)
    at com.surebetfinder.logic.GestoreScommesse.creaScriveEvento(GestoreScommesse.java:94)
    at com.surebetfinder.logic.GestoreScommesse.lavoraScommessa(GestoreScommesse.java:69)
    at com.surebetfinder.logic.GestoreScommesse.memorizzaGiocate(GestoreScommesse.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1081)
    at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1153)
    at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4786)
    at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:656)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
    at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
    at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:46)
    at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
    at sun.reflect.GeneratedMethodAccessor231.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
    at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
    at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
    at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:140)
    at sun.reflect.GeneratedMethodAccessor243.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
    at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:369)
    at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:4758)
    at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4746)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:212)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
    at com.sun.proxy.$Proxy243.memorizzaGiocate(Unknown Source)
    at com.surebetfinder.logic.__EJB31_Generated__GestoreScommesse__Intf____Bean__.memorizzaGiocate(Unknown Source)
    at com.surebetfinder.logic.processi.WorkerThread.processCommand(WorkerThread.java:45)
    at com.surebetfinder.logic.processi.WorkerThread.run(WorkerThread.java:35)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1081)
    at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1153)
    at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4786)
    at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:656)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
    at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
    at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55)
    at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
    at sun.reflect.GeneratedMethodAccessor231.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
    at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
    at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
    at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:140)
    at sun.reflect.GeneratedMethodAccessor243.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
    at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:369)
    at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:4758)
    at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4746)
    at com.sun.ejb.containers.EjbAsyncTask.call(EjbAsyncTask.java:101)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean
    at com.sun.ejb.containers.EJBContainerTransactionManager.checkExceptionClientTx(EJBContainerTransactionManager.java:662)
    at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:495)
    at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4566)
    at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2074)
    ... 75 more
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
Error Code: 1213
Call: INSERT INTO EVENTO (ID_EVENTO, COMPETIZIONE, DT_EVENTO, NAZIONE, PUNTATA, VERSION, SPORT) VALUES (?, ?, ?, ?, ?, ?, ?)
    bind => [7 parameters bound]
Query: InsertObjectQuery(Evento [idEvento=1809516348, competizione=PRIMERA B METROPOLITANA, dtEvento=Tue Aug 18 00:00:00 CEST 2015, nazione=Argentina, puntata=DEPORTIVO ARMENIO - PLATENSE, sportBean=com.surebetfinder.dao.ejb.Sport@7a78042f])

我哪里错了?在多线程环境中处理事务的正确方法是什么?

    mysql> SHOW ENGINE INNODB STATUS\G
    *************************** 1. row ***************************
      Type: InnoDB
      Name:
    Status:
    =====================================
    2015-08-18 23:32:37 eb8 INNODB MONITOR OUTPUT
    =====================================
    Per second averages calculated from the last 2 seconds
    -----------------
    BACKGROUND THREAD
    -----------------
    srv_master_thread loops: 2103 srv_active, 0 srv_shutdown, 6679 srv_idle
    srv_master_thread log flush and writes: 8782
    ----------
    SEMAPHORES
    ----------
    OS WAIT ARRAY INFO: reservation count 7783
    OS WAIT ARRAY INFO: signal count 6379
    Mutex spin waits 4705, rounds 114746, OS waits 1536
    RW-shared spins 2425, rounds 73936, OS waits 2346
    RW-excl spins 1170, rounds 118156, OS waits 3786
    Spin rounds per wait: 24.39 mutex, 30.49 RW-shared, 100.99 RW-excl
    ------------------------
    LATEST DETECTED DEADLOCK
    ------------------------
    2015-08-18 23:09:45 177c
    *** (1) TRANSACTION:
    TRANSACTION 4107617, ACTIVE 41 sec inserting
    mysql tables in use 1, locked 1
    LOCK WAIT 4 lock struct(s), heap size 1184, 2 row lock(s)
    MySQL thread id 62, OS thread handle 0x1494, query id 1068350 localhost 127.0.0.
    1 developer update
    INSERT INTO EVENTO (ID_EVENTO, COMPETIZIONE, DT_EVENTO, NAZIONE, PUNTATA, VERSIO
    N, SPORT) VALUES (1838714764, 'PRIMERA B NACIONAL', '2015-08-19 09:00:00', 'Arge
    ntina', 'DOUGLAS HAIG - SPORTIVO BELGRANO', 1, 1)
    *** (1) WAITING FOR THIS LOCK TO BE GRANTED:
    RECORD LOCKS space id 337 page no 3 n bits 184 index `PRIMARY` of table `surebet
    db`.`evento` trx id 4107617 lock_mode X insert intention waiting
    Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0
     0: len 8; hex 73757072656d756d; asc supremum;;

    *** (2) TRANSACTION:
    TRANSACTION 4108047, ACTIVE 23 sec inserting, thread declared inside InnoDB 1
    mysql tables in use 1, locked 1
    4 lock struct(s), heap size 1184, 2 row lock(s)
    MySQL thread id 71, OS thread handle 0x177c, query id 1070886 localhost 127.0.0.
    1 developer update
    INSERT INTO EVENTO (ID_EVENTO, COMPETIZIONE, DT_EVENTO, NAZIONE, PUNTATA, VERSIO
    N, SPORT) VALUES (1838714764, 'PRIMERA B NACIONAL', '2015-08-19 09:00:00', 'Arge
    ntina', 'DOUGLAS HAIG - SPORTIVO BELGRANO', 1, 1)
    *** (2) HOLDS THE LOCK(S):
    RECORD LOCKS space id 337 page no 3 n bits 184 index `PRIMARY` of table `surebet
    db`.`evento` trx id 4108047 lock mode S
    Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0
     0: len 8; hex 73757072656d756d; asc supremum;;

    *** (2) WAITING FOR THIS LOCK TO BE GRANTED:
    RECORD LOCKS space id 337 page no 3 n bits 184 index `PRIMARY` of table `surebet
    db`.`evento` trx id 4108047 lock_mode X insert intention waiting
    Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0
     0: len 8; hex 73757072656d756d; asc supremum;;

    *** WE ROLL BACK TRANSACTION (2)
    ------------
    TRANSACTIONS
    ------------
    Trx id counter 4195230
    Purge done for trx's n:o < 4194808 undo n:o < 0 state: running but idle
    History list length 374
    LIST OF TRANSACTIONS FOR EACH SESSION:
    ---TRANSACTION 0, not started
    MySQL thread id 96, OS thread handle 0xeb8, query id 1263558 localhost 127.0.0.1
     developer init
    SHOW ENGINE INNODB STATUS
    ---TRANSACTION 4194931, not started
    MySQL thread id 87, OS thread handle 0x11e8, query id 1263556 localhost 127.0.0.
    1 developer cleaning up
    --------
    FILE I/O
    --------
    I/O thread 0 state: wait Windows aio (insert buffer thread)
    I/O thread 1 state: wait Windows aio (log thread)
    I/O thread 2 state: wait Windows aio (read thread)
    I/O thread 3 state: wait Windows aio (read thread)
    I/O thread 4 state: wait Windows aio (read thread)
    I/O thread 5 state: wait Windows aio (read thread)
    I/O thread 6 state: wait Windows aio (write thread)
    I/O thread 7 state: wait Windows aio (write thread)
    I/O thread 8 state: wait Windows aio (write thread)
    I/O thread 9 state: wait Windows aio (write thread)
    Pending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0, 0, 0, 0] ,
     ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0
    Pending flushes (fsync) log: 0; buffer pool: 0
    775 OS file reads, 30664 OS file writes, 12992 OS fsyncs
    0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
    -------------------------------------
    INSERT BUFFER AND ADAPTIVE HASH INDEX
    -------------------------------------
    Ibuf: size 1, free list len 324, seg size 326, 0 merges
    merged operations:
     insert 0, delete mark 0, delete 0
    discarded operations:
     insert 0, delete mark 0, delete 0
    Hash table size 205549, node heap has 74 buffer(s)
    0.00 hash searches/s, 0.00 non-hash searches/s
    ---
    LOG
    ---
    Log sequence number 922082698
    Log flushed up to   922082698
    Pages flushed up to 922082698
    Last checkpoint at  922082698
    0 pending log writes, 0 pending chkp writes
    6033 log i/o's done, 0.00 log i/o's/second
    ----------------------
    BUFFER POOL AND MEMORY
    ----------------------
    Total memory allocated 106299392; in additional pool allocated 0
    Dictionary memory allocated 118954
    Buffer pool size   6336
    Free buffers       5362
    Database pages     900
    Old database pages 312
    Modified db pages  0
    Pending reads 0
    Pending writes: LRU 0, flush list 0, single page 0
    Pages made young 5, not young 0
    0.00 youngs/s, 0.00 non-youngs/s
    Pages read 606, created 294, written 23155
    0.00 reads/s, 0.00 creates/s, 0.00 writes/s
    No buffer pool page gets since the last printout
    Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s

    LRU len: 900, unzip_LRU len: 0
    I/O sum[0]:cur[0], unzip sum[0]:cur[0]
    --------------
    ROW OPERATIONS
    --------------
    0 queries inside InnoDB, 0 queries in queue
    0 read views open inside InnoDB
    Main thread id 2168, state: sleeping
    Number of rows inserted 61722, updated 0, deleted 27507, read 983459
    0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
    ----------------------------
    END OF INNODB MONITOR OUTPUT
    ============================

    1 row in set (0.00 sec)

0 个答案:

没有答案