使用MAMP在codeigniter中获取未知的事务错误

时间:2012-04-26 13:05:31

标签: mysql codeigniter transactions mamp

我正在使用MAMP和codeigniter框架。


我面临一个非常奇怪的问题。我写的是一条活跃的记录声明。

$this->db->select('user_vcard.pro_pic_filename AS `author_pro_pic_filepath`');

如果我在CI语句中使用AS author_pro_pic_filepath,则在执行HTTP请求后,我得到一个SERVER ERROR。然后,如果我尝试刷新页面,我的浏览器会停止很长时间,然后,在某一时刻,它说

Error Number: 1205.
Lock wait timeout exceeded; try restarting transaction

但是,如果我用任何其他名称替换AS author_pro_pic_filepath,它就可以正常工作。


以下是我试图解决问题的一些事情:

  1. 我导出了数据库的.sql转储并将其保存在安全的地方
  2. 我尝试丢弃所有表格。
  3. 我尝试删除整个数据库。
  4. 我清除了表中的所有MySQL用户权限
  5. 我清除了浏览器中的所有Cookie,会话数据
  6. 我尝试了Safari和Chrome
  7. 我试图关闭MAMP。
  8. 我试图关闭我的笔记本电脑。
  9. 我试着一起完成上述所有工作。
  10. 我也尝试关闭codeigniter代码中的所有事务语句。
  11. 结果无变化。它总是表现得像我上面提到的那样。

    我在我的应用中的其他几个文件中使用了相同的活动记录语句。它到处都很好。但只有在这个特定的文件中,我才面临上述问题。


    SQL查询的结果:SHOW ENGINE INNODB MUTEX;

    Rows: 2
    
    Type    InnoDB  
    Name    /users/severin/MAMPexp/MAMP_packages/mysql-5.5.9/storage/innobase/srv/srv0srv.c:1030    
    Status  os_waits=1
    
    Type    InnoDB
    Name    /users/severin/MAMPexp/MAMP_packages/mysql-5.5.9/storage/innobase/log/log0log.c:832 
    Status  os_waits=7
    

    SQL查询的结果:SHOW ENGINE INNODB MUTEX;

    Rows: 1
    
    Type    InnoDB      
    Name    
    Status  
    =====================================
    120426 18:39:04 INNODB MONITOR OUTPUT
    =====================================
    Per second averages calculated from the last 5 seconds
    -----------------
    BACKGROUND THREAD
    -----------------
    srv_master_thread loops: 56 1_second, 56 sleeps, 5 10_second, 8 background, 8 flush
    srv_master_thread log flush and writes: 57
    ----------
    SEMAPHORES
    ----------
    OS WAIT ARRAY INFO: reservation count 8, signal count 8
    Mutex spin waits 2, rounds 31, OS waits 1
    RW-shared spins 7, rounds 210, OS waits 7
    RW-excl spins 0, rounds 0, OS waits 0
    Spin rounds per wait: 15.50 mutex, 30.00 RW-shared, 0.00 RW-excl
    ------------
    TRANSACTIONS
    ------------
    Trx id counter 8BCB
    Purge done for trx's n:o < 8BBD undo n:o < 0
    History list length 149
    LIST OF TRANSACTIONS FOR EACH SESSION:
    ---TRANSACTION 0, not started, OS thread id 4531712000
    MySQL thread id 55, query id 926 localhost root
    SHOW ENGINE INNODB STATUS
    ---TRANSACTION 8BBB, not started, OS thread id 4531163136
    MySQL thread id 44, query id 820 localhost doc2doc
    ---TRANSACTION 8BBD, ACTIVE 486 sec, OS thread id 4531437568
    3 lock struct(s), heap size 376, 2 row lock(s), undo log entries 1
    MySQL thread id 45, query id 831 localhost doc2doc
    Trx read view will not see trx with id >= 8BBE, sees < 8BBE
    --------
    FILE I/O
    --------
    I/O thread 0 state: waiting for i/o request (insert buffer thread)
    I/O thread 1 state: waiting for i/o request (log thread)
    I/O thread 2 state: waiting for i/o request (read thread)
    I/O thread 3 state: waiting for i/o request (read thread)
    I/O thread 4 state: waiting for i/o request (read thread)
    I/O thread 5 state: waiting for i/o request (read thread)
    I/O thread 6 state: waiting for i/o request (write thread)
    I/O thread 7 state: waiting for i/o request (write thread)
    I/O thread 8 state: waiting for i/o request (write thread)
    I/O thread 9 state: waiting for i/o request (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
    413 OS file reads, 520 OS file writes, 381 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 0, seg size 2, 0 merges
    merged operations:
    insert 0, delete mark 0, delete 0
    discarded operations:
    insert 0, delete mark 0, delete 0
    Hash table size 276707, node heap has 1 buffer(s)
    0.00 hash searches/s, 0.00 non-hash searches/s
    ---
    LOG
    ---
    Log sequence number 5050799
    Log flushed up to   5050799
    Last checkpoint at  5050799
    0 pending log writes, 0 pending chkp writes
    370 log i/o's done, 0.00 log i/o's/second
    ----------------------
    BUFFER POOL AND MEMORY
    ----------------------
    Total memory allocated 137363456; in additional pool allocated 0
    Dictionary memory allocated 114130
    Buffer pool size   8192
    Free buffers       7736
    Database pages     455
    Old database pages 0
    Modified db pages  0
    Pending reads 0
    Pending writes: LRU 0, flush list 0, single page 0
    Pages made young 0, not young 0
    0.00 youngs/s, 0.00 non-youngs/s
    Pages read 402, created 53, written 322
    0.00 reads/s, 0.00 creates/s, 0.00 writes/s
    Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
    Pages read ahead 0.00/s, evicted without access 0.00/s
    LRU len: 455, 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
    2 read views open inside InnoDB
    Main thread id 4506259456, state: waiting for server activity
    Number of rows inserted 507, updated 2, deleted 0, read 1679
    0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
    ----------------------------
    END OF INNODB MONITOR OUTPUT
    ============================
    

1 个答案:

答案 0 :(得分:0)

OMG ...........我花了两天的时间试图计算出来后,我证明自己是 big time dumb ass 这个。

我正在调用辅助函数,而我之前没有加载过帮助函。

原谅我的愚蠢。