473,400 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

InnoDB, 4.1.20, INS/DEL/TX -- Why table-level locking?

Just started investigating InnoDB after having used MyISAM tables in
the 4.0.12 version, almost immediately ran into a locking issue with
INSERTs, DELETEs, and transactions.

Given the following table:
CREATE TABLE test1 (
f1 varchar(32) default NULL
)

and a steady stream of INSERTs from a command-line shell:
jc@soyuz:~$ while true; do /usr/local/mysql/bin/mysql -S
/tmp/mysql-4.1.sock -u tester -D jlb -A -N -s -q -e "INSERT INTO test1
VALUES('`date`')"; done

why is it that the following session blocks the INSERTs due to locking?
jc@soyuz:~/tmp$ /usr/local/mysql/bin/mysql -S /tmp/mysql-4.1.sock -u
tester -p -D jlb

mysqlBEGIN ;
Query OK, 0 rows affected (0.00 sec)

mysqlDELETE FROM test1 WHERE f1 LIKE 'asdf;ljkas;fjd;adsfads%' ;
Query OK, 0 rows affected (0.05 sec)

mysqlshow innodb status \G
*************************** 1. row ***************************
Status:
=====================================
060707 9:34:36 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 38 seconds
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 251, signal count 249
Mutex spin waits 343, rounds 2273, OS waits 72
RW-shared spins 156, OS waits 77; RW-excl spins 100, OS waits 95
------------
TRANSACTIONS
------------
Trx id counter 0 10526
Purge done for trx's n:o < 0 7801 undo n:o < 0 0
History list length 0
Total number of lock structs in row lock hash table 11
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0 10525, ACTIVE 7 sec, OS thread id 15 inserting
mysql tables in use 1, locked 1
LOCK WAIT 2 lock struct(s), heap size 320
MySQL thread id 9256, query id 18746 localhost root update
INSERT INTO test1 VALUES('Fri Jul 7 09:34:29 EDT 2006')
------- TRX HAS BEEN WAITING 7 SEC FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 1 page no 13 n bits 336 index `GEN_CLUST_INDEX`
of table `jlb/test1` trx id 0 10525 lock_mode X in
sert intention waiting
Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; 1-byte offs TRUE;
info bits 0
0: len 9; hex 73757072656d756d00; asc supremum ;;

------------------
---TRANSACTION 0 10524, ACTIVE 7 sec, OS thread id 13
11 lock struct(s), heap size 1024
MySQL thread id 9150, query id 18747 localhost root
show innodb status
--------
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: 0
Pending flushes (fsync) log: 0; buffer pool: 0
26 OS file reads, 9848 OS file writes, 9604 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 18.76 writes/s, 18.39 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf for space 0: size 1, free list len 0, seg size 2, is empty
Ibuf for space 0: size 1, free list len 0, seg size 2,
0 inserts, 0 merged recs, 0 merges
Hash table size 415141, used cells 1, node heap has 1 buffer(s)
17.66 hash searches/s, 0.34 non-hash searches/s
---
LOG
---
Log sequence number 0 1673501
Log flushed up to 0 1673501
Last checkpoint at 0 1673501
0 pending log writes, 0 pending chkp writes
9283 log i/o's done, 17.97 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total memory allocated 141111128; in additional pool allocated 1403776
Buffer pool size 6400
Free buffers 6321
Database pages 78
Modified db pages 0
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages read 64, created 14, written 642
0.00 reads/s, 0.05 creates/s, 0.82 writes/s
Buffer pool hit rate 1000 / 1000
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
Main thread id 10, state: waiting for server activity
Number of rows inserted 9168, updated 1062, deleted 8865, read 66649
17.87 inserts/s, 0.00 updates/s, 0.00 deletes/s, 71.42 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================

1 row in set (0.03 sec)

mysql>

Jul 7 '06 #1
0 2288

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: azamka | last post by:
Hi everyone, I am trying to create tables with type innodb. I created a database and all the tables of type ISAM. Now I am at the point of making relations and establish refrential integrity....
0
by: Morten Gulbrandsen | last post by:
Dear MySQL developers, Could some experienced Database developer please take a look at this ? It is supposed to be plain SQL2. How can it be coded under MySQL Especially all referential...
0
by: Morten Gulbrandsen | last post by:
Hi Programmers, after this legal statement ALTER TABLE EMPLOYEE TYPE =3D InnoDB; I get=20 Warnings: 0 =20 and still MySQL claims to have to use Type =3D MyISAM,
3
by: Vanchau Nguyen | last post by:
Hi all, Hoping someone can help us with this strange Innodb problem. At about 5:15 AM 2/2/04 (this morning), our slave server stopped accepting connections. The machine was pingable, but you...
2
by: skidvd | last post by:
Hello: I have just recently converted to using the InnoDB table type so that I can enforce FOREIGN key constraints. I have been using MyISAM tables (accessed via JDBC) successfully for some...
0
by: Mike Chirico | last post by:
Hopefully the following will be useful or interesting: TIP 29: An example of using referential integrity with InnoDB tables. Referential Integrity with InnoDB tables. STEP 1 (First create...
1
by: Beyonder | last post by:
I'm using InnoDB with Mysql and I've used delete to delete over 10 million records, but the InnoDB database is still the same size on the disk (over 100 gigs) is there a way to get Mysql/InnoDB to...
1
by: LRW | last post by:
I'm using mySQL 4.0.20, interfacing it with phpMyAdmin 2.5.6. I usually set tables up with a "default" type, which I believe is myISAM (or whatever that one is.) But I decided to go with InnoDB for...
3
by: siliconmike | last post by:
We have developed a site where users can post blogs. Now, each blog is stored in a separate row, in a table called blog_table. This single table would be the most active one and would grow to...
1
by: Gh! | last post by:
How can I see how much disk space is being occupied by an InnoDB table? Looking into /var/lib/mysql doesn't seem to work anymore for InnoDB tables. Please tell also if there is a way to see how...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.