《MySQL 5.6 Manual 原文翻译》show engine innodb stauts

来源:互联网 发布:网络中的喷子 编辑:程序博客网 时间:2024/05/16 19:52
14.2.13.4.1. InnoDB Standard Monitor and Lock Monitor Output

The Lock Monitor is the same as the standard Monitor except that it includes additional lock information. Enabling either monitor for periodic output by creating the associated InnoDB table turns on the same output stream, but the stream includes the extra information if the Lock Monitor is enabled. For example, if you create theinnodb_monitor and innodb_lock_monitor tables, that turns on a single output stream. The stream includes extra lock information until you disable the Lock Monitor by removing the innodb_lock_monitor table.

这个Lock Monitor 和标准的Moinitor一样,不过又包含了一些额外的关于lock的信息。启动了monitor,他会记录一些Innodb表的信息,当然,启动了Lock Monitor,除此之外,还会记录一些额外的信息。例如,如果你创建了一个innodb_monitor和innodb_lock_monitor这两个表,那会把记录信息放在用一个输出流里面。这个输出流(stream)会一直保存这些信息知道你删掉了innodb_lock_monitor这个表来禁用掉Lock Monitor这个特性。

Example InnoDB Monitor output:

mysql> SHOW ENGINE INNODB STATUS\G*************************** 1. row ***************************Status:=====================================030709 13:00:59 INNODB MONITOR OUTPUT=====================================Per second averages calculated from the last 18 seconds----------BACKGROUND THREAD----------srv_master_thread loops: 53 1_second, 44 sleeps, 5 10_second, 7 background,  7 flushsrv_master_thread log flush and writes: 48----------SEMAPHORES----------OS WAIT ARRAY INFO: reservation count 413452, signal count 378357--Thread 32782 has waited at btr0sea.c line 1477 for 0.00 seconds thesemaphore: X-lock on RW-latch at 41a28668 created in file btr0sea.c line 135a writer (thread id 32782) has reserved it in mode wait exclusivenumber of readers 1, waiters flag 1Last time read locked in file btr0sea.c line 731Last time write locked in file btr0sea.c line 1347Mutex spin waits 0, rounds 0, OS waits 0RW-shared spins 2, rounds 60, OS waits 2RW-excl spins 0, rounds 0, OS waits 0Spin rounds per wait: 0.00 mutex, 20.00 RW-shared, 0.00 RW-excl------------------------LATEST FOREIGN KEY ERROR------------------------030709 13:00:59 Transaction:TRANSACTION 0 290328284, ACTIVE 0 sec, process no 3195inserting15 lock struct(s), heap size 2496, undo log entries 9MySQL thread id 25, query id 4668733 localhost heikki updateinsert into ibtest11a (D, B, C) values (5, 'khDk' ,'khDk')Foreign key constraint fails for table test/ibtest11a:,  CONSTRAINT `0_219242` FOREIGN KEY (`A`, `D`) REFERENCES `ibtest11b` (`A`,  `D`) ON DELETE CASCADE ON UPDATE CASCADETrying to add in child table, in index PRIMARY tuple: 0: len 4; hex 80000101; asc ....;; 1: len 4; hex 80000005; asc ....;; 2: len 4; hex 6b68446b; asc khDk;; 3: len 6; hex 0000114e0edc; asc ...N..;; 4: len 7; hex 00000000c3e0a7; asc .......;; 5: len 4; hex 6b68446b; asc khDk;;But in parent table test/ibtest11b, in index PRIMARY,the closest match we can find is record:RECORD: info bits 0 0: len 4; hex 8000015b; asc ...[;; 1: len 4; hex80000005; asc ....;; 2: len 3; hex 6b6864; asc khd;; 3: len 6; hex0000111ef3eb; asc ......;; 4: len 7; hex 800001001e0084; asc .......;; 5:len 3; hex 6b6864; asc khd;;------------------------LATEST DETECTED DEADLOCK------------------------030709 12:59:58*** (1) TRANSACTION:TRANSACTION 0 290252780, ACTIVE 1 sec, process no 3185insertingLOCK WAIT 3 lock struct(s), heap size 320, undo log entries 146MySQL thread id 21, query id 4553379 localhost heikki updateINSERT INTO alex1 VALUES(86, 86, 794,'aA35818','bb','c79166','d4766t','e187358f','g84586','h794',date_format('2001-04-03 12:54:22','%Y-%m-%d%H:%i'),7*** (1) WAITING FOR THIS LOCK TO BE GRANTED:RECORD LOCKS space id 0 page no 48310 n bits 568 table test/alex1 indexsymbole trx id 0 290252780 lock mode S waitingRecord lock, heap no 324 RECORD: info bits 0 0: len 7; hex 61613335383138;asc aa35818;; 1:*** (2) TRANSACTION:TRANSACTION 0 290251546, ACTIVE 2 sec, process no 3190inserting130 lock struct(s), heap size 11584, undo log entries 437MySQL thread id 23, query id 4554396 localhost heikki updateREPLACE INTO alex1 VALUES(NULL, 32, NULL,'aa3572','','c3572','d6012t','',NULL,'h396', NULL, NULL, 7.31,7.31,7.31,200)*** (2) HOLDS THE LOCK(S):RECORD LOCKS space id 0 page no 48310 n bits 568 table test/alex1 indexsymbole trx id 0 290251546 lock_mode X locks rec but not gapRecord lock, heap no 324 RECORD: info bits 0 0: len 7; hex 61613335383138;asc aa35818;; 1:*** (2) WAITING FOR THIS LOCK TO BE GRANTED:RECORD LOCKS space id 0 page no 48310 n bits 568 table test/alex1 indexsymbole trx id 0 290251546 lock_mode X locks gap before rec insert intentionwaitingRecord lock, heap no 82 RECORD: info bits 0 0: len 7; hex 61613335373230;asc aa35720;; 1:*** WE ROLL BACK TRANSACTION (1)------------TRANSACTIONS------------Trx id counter 0 290328385Purge done for trx's n:o < 0 290315608 undo n:o < 0 17History list length 20Total number of lock structs in row lock hash table 70LIST OF TRANSACTIONS FOR EACH SESSION:---TRANSACTION 0 0, not started, process no 3491MySQL thread id 32, query id 4668737 localhost heikkishow innodb status---TRANSACTION 0 290328384, ACTIVE 0 sec, process no 320538929 inserting1 lock struct(s), heap size 320MySQL thread id 29, query id 4668736 localhost heikki updateinsert into speedc values (1519229,1, 'hgjhjgghggjgjgjgjgjggjgjgjgjgjgggjgjgjlhhgghggggghhjhghgggggghjhghghghghghhhhghghghjhhjghjghjkghjghjghjghjfhjfh---TRANSACTION 0 290328383, ACTIVE 0 sec, process no 318028684 committing1 lock struct(s), heap size 320, undo log entries 1MySQL thread id 19, query id 4668734 localhost heikki updateinsert into speedcm values (1603393,1, 'hgjhjgghggjgjgjgjgjggjgjgjgjgjgggjgjgjlhhgghggggghhjhghgggggghjhghghghghghhhhghghghjhhjghjghjkghjghjghjghjfhjf---TRANSACTION 0 290328327, ACTIVE 0 sec, process no 320036880 starting index readLOCK WAIT 2 lock struct(s), heap size 320MySQL thread id 27, query id 4668644 localhost heikki Searching rows forupdateupdate ibtest11a set B = 'kHdkkkk' where A = 89572------- TRX HAS BEEN WAITING 0 SEC FOR THIS LOCK TO BE GRANTED:RECORD LOCKS space id 0 page no 65556 n bits 232 table test/ibtest11a indexPRIMARY trx id 0 290328327 lock_mode X waitingRecord lock, heap no 1 RECORD: info bits 0 0: len 9; hex 73757072656d756d00;asc supremum.;;---------------------TRANSACTION 0 290328284, ACTIVE 0 sec, process no 319534831 rollback of SQL statementROLLING BACK 14 lock struct(s), heap size 2496, undo log entries 9MySQL thread id 25, query id 4668733 localhost heikki updateinsert into ibtest11a (D, B, C) values (5, 'khDk' ,'khDk')---TRANSACTION 0 290327208, ACTIVE 1 sec, process no 31903278258 lock struct(s), heap size 5504, undo log entries 159MySQL thread id 23, query id 4668732 localhost heikki updateREPLACE INTO alex1 VALUES(86, 46, 538,'aa95666','bb','c95666','d9486t','e200498f','g86814','h538',date_format('2001-04-03 12:54:22','%Y-%m-%d%H:%i'),---TRANSACTION 0 290323325, ACTIVE 3 sec, process no 318530733 inserting4 lock struct(s), heap size 1024, undo log entries 165MySQL thread id 21, query id 4668735 localhost heikki updateINSERT INTO alex1 VALUES(NULL, 49, NULL,'aa42837','','c56319','d1719t','',NULL,'h321', NULL, NULL, 7.31,7.31,7.31,200)--------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 (write thread)Pending normal aio reads: 0, aio writes: 0, ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0Pending flushes (fsync) log: 0; buffer pool: 0151671 OS file reads, 94747 OS file writes, 8750 OS fsyncs25.44 reads/s, 18494 avg bytes/read, 17.55 writes/s, 2.33 fsyncs/s-------------------------------------INSERT BUFFER AND ADAPTIVE HASH INDEX-------------------------------------Ibuf for space 0: size 1, free list len 19, seg size 21,85004 inserts, 85004 merged recs, 26669 mergesHash table size 207619, used cells 14461, node heap has 16 buffer(s)1877.67 hash searches/s, 5121.10 non-hash searches/s---LOG---Log sequence number 18 1212842764Log flushed up to   18 1212665295Last checkpoint at  18 11358772900 pending log writes, 0 pending chkp writes4341 log i/o's done, 1.22 log i/o's/second----------------------BUFFER POOL AND MEMORY----------------------Total memory allocated 84966343; in additional pool allocated 1402624Buffer pool size   3200Free buffers       110Database pages     3074Modified db pages  2674Pending reads 0Pending writes: LRU 0, flush list 0, single page 0Pages read 171380, created 51968, written 19468828.72 reads/s, 20.72 creates/s, 47.55 writes/sBuffer pool hit rate 999 / 1000--------------ROW OPERATIONS--------------0 queries inside InnoDB, 0 queries in queueMain thread process no. 3004, id 7176, state: purgingNumber of rows inserted 3738558, updated 127415, deleted 33707, read 7557791586.13 inserts/s, 50.89 updates/s, 28.44 deletes/s, 107.88 reads/s----------------------------END OF INNODB MONITOR OUTPUT============================

InnoDB Monitor output is limited to 1MB when produced using the SHOW ENGINE INNODB STATUS statement. This limit does not apply to output written to the server's error output.

当执行show engine innodb status,InnoDB Monitor 会被限制为1MB的大小。这个限制不会应用到服务器的错误输出当中

Some notes on the output sections:

一些输出内容notes章节:

Status

This section shows the timestamp, the monitor name, and the number of seconds that per-second averages are based on. The number of seconds is the elapsed time between the current time and the last time InnoDB Monitor output was printed.

这一章节会显示出timestamp,monitor的名字,每秒的平均数量。这个秒的数量显示的是当前的时间和上一个Innodb Monitor 显示出信息的时间的差值。

BACKGROUND THREAD

The srv_master_thread lines shows work done by the main background thread.

这个srv_master_thread 显示出主要后台进程做了什么事情。

SEMAPHORES

信号量

This section reports threads waiting for a semaphore and statistics on how many times threads have needed a spin or a wait on a mutex or a rw-lock semaphore. A large number of threads waiting for semaphores may be a result of disk I/O, or contention problems inside InnoDB. Contention can be due to heavy parallelism of queries or problems in operating system thread scheduling. Setting the innodb_thread_concurrency system variable smaller than the default value might help in such situations. The Spin rounds per wait line shows the number of spinlock rounds per OS wait for a mutex.

这一章节主要显示一些等待信号量的线程和那些需要获得spin或者获得mutex或者获得rw-lock的次数上的信号量。如果存在有很多等待信号量的线程,那么会是磁盘的IO不给力,或者存在在Innodb上面的争用问题。这个争用问题主要体现在一个大量的并行查询上面或者因为操作系统的进程调度。把innodb_thread_concurrency设置为较小的值相比于默认值,对这样的case是有帮助的。这个Spin rounds per wait 主要显示了每个操作系统的轮巡数,对于等待获取mutex

LATEST FOREIGN KEY ERROR

This section provides information about the most recent foreign key constraint error. It is not present if no such error has occurred. The contents include the statement that failed as well as information about the constraint that failed and the referenced and referencing tables.

最近的一次外键错误(Foreign Key Error)

这一章节主要提供一些关于最近的一次外键一致性的相关错误信息。如果没有这样的错误当然不会有显示内容。

LATEST DETECTED DEADLOCK

This section provides information about the most recent deadlock. It is not present if no deadlock has occurred. The contents show which transactions are involved, the statement each was attempting to execute, the locks they have and need, and which transaction InnoDB decided to roll back to break the deadlock. The lock modes reported in this section are explained in Section 14.2.2.3, “InnoDB Lock Modes”.

最近一次死锁

这一章节主要显示一些最近的一次死锁信息。如果死锁没有发生,当然是没有展示信息的。这内容也会显示出一些transaction的信息,那些尝试去执行的语句,和这些语句执行所需要的锁,还有那些Innodb需要回滚来释放死锁的事务信息。这个锁模式的章节会在Section 14.2.2.3, “InnoDB Lock Modes”.这一章节解释。

TRANSACTIONS

If this section reports lock waits, your applications might have lock contention. The output can also help to trace the reasons for transaction deadlocks.

事务

在这一章节会包括那些锁的等待,你的应用可能会出现锁的竞争。这小章节内容可能会帮助你去跟踪到那些发生死锁事务的原因。

FILE I/O

This section provides information about threads that InnoDB uses to perform various types of I/O. The first few of these are dedicated to general InnoDB processing. The contents also display information for pending I/O operations and statistics for I/O performance.

文件的 I/O

这一章节会提供一些关于InnoDB使用了那些线程,那些执行了多样性的I/O信息。开始的一些内容主要包括是,那些普通的Innodb 需要执行的进程信息。这个内容也包含了那些pending I/O 的信息还有关于I/O的性能统计信息。

The number of these threads are controlled by the innodb_read_io_threads and innodb_write_io_threadsparameters. See Section 14.2.14, “InnoDB Startup Options and System Variables”.

这些线程的数量都由,innodb_read_io_threads 和innodb_write_io_threads 参数控制。详看这一章节。 Section 14.2.14, “InnoDB Startup Options and System Variables”.

INSERT BUFFER AND ADAPTIVE HASH INDEX

This section shows the status of the InnoDB insert buffer and adaptive hash index. (See Section 14.2.2.13.5, “Insert Buffering”, and Section 14.2.2.13.6, “Adaptive Hash Indexes”.) The contents include the number of operations performed for each, plus statistics for hash index performance.

插入buffer 和自适应Hash 索引

这一章节主要是描述InnoDB插入buffer的状态和自适应索引的状态。详看,(Section 14.2.2.13.5, “Insert Buffering”, and Section 14.2.2.13.6, “Adaptive Hash Indexes”.)这些内容,包括了对于每一个执行操作的数量,在加上对于Hash 索引性能的统计信息。

LOG

This section displays information about the InnoDB log. The contents include the current log sequence number, how far the log has been flushed to disk, and the position at which InnoDB last took a checkpoint. (SeeSection 14.2.11.3, “InnoDB Checkpoints”.) The section also displays information about pending writes and write performance statistics.

日志

这一章节主要显示了InnoDB的日志信息。这些内容主要包括了当前日志的序列号,还有多久日志才会写入到磁盘,InnoDB执行了检查点的位置。详看,(Section 14.2.11.3, “InnoDB Checkpoints”.)。这一小章节也包括了那些pending writes 和writes 性能的统计信息。

BUFFER POOL AND MEMORY

This section gives you statistics on pages read and written. You can calculate from these numbers how many data file I/O operations your queries currently are doing.

缓冲池和内存

这一章节会提供给你页的读写的统计信息。你可以估算这些值,有多少当前查询需要的IO的操作数量。

For additional information about the operation of the buffer pool, see Section 8.9.1, “The InnoDB Buffer Pool”.

ROW OPERATIONS

This section shows what the main thread is doing, including the number and performance rate for each type of row operation.

行操作

这一章节会显示出主要的进程都在做了什么,主要也包括了那些对于每一个行的操作类型的数量和性能指标。

原创粉丝点击