473,657 Members | 2,515 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

innodb use outside of explicit transactions

Suppose I have an innodb table in 4.0.14 and do:

LOCK TABLE maggie
INSERT INTO maggie values(123, 'simpson');
UNLOCK TABLES

As soon as I issue LOCK TABLE, any transaction in progress is
automatically committed.

By what point is this INSERT guaranteed to be committed to disk
(ie. redo log)?

Is it:

1. before INSERT returns?

2. before UNLOCK TABLES returns?

3. before it is read by any separate transaction?

4. before any separate transaction that read this data is committed?

5. sometime, no guarantee? This would seem to violate transactional
integrity of the new transaction if it had a foreign key reference.

My best guess is (1) since nothing else makes much sense, but I am
having trouble finding any documentation addressing exactly how
table locks interact with innodbs transaction model, aside from a
reference to being able to get a table lock while innodb row locks already
exist on the table.

I do have an explicit reason for wanting to do a lock tables instead of
doing everything in transactions, but I still require some assurances
that things are committed to disk so they can be recovered (cluster
with shared disk to fail over to a secondary node). I have an
innodb table like this:

CREATE TABLE maggie (
maggieid INT NOT NULL,
word VARCHAR(254),
modified TIMESTAMP NOT NULL,

PRIMARY KEY (maggieid)
)

There are multiple writers that can each add or modify a row in the
table.

There are multiple readers, each one keeping a full representation
of the table in memory and polling at intervals for modified columns
based on the timestamp.

They loop:

1. grab new timestamp
2. select from maggie where modified >= old timestamp
3. save new timestamp for the next round

The problem is that if I just do a normal update in the writer,
then there is a race between when the timestamp is updated and the
transaction is committed. If a reader comes in, it won't see
the update since it isn't committed, it won't block on it because of
multiversioning , and will never see it next time around since the
timestamp is too old. I'm considering if I can remove the race by
using LOCK TABLES explicitly in the writer... hence my first
question. I couldn't see any obvious way to do what I want using
only innodb row level locks, no matter what isolation level I used.

Suggestions or pointers at docs?

thanks.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 1716

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

Similar topics

1
3632
by: Marcus | last post by:
Hello, I have 2 questions regarding InnoDB tables: 1. In the MySQL manual, it states that "MySQL begins each client connection with autocommit mode enabled by default. When autocommit is enabled, MySQL does a commit after each SQL statement if that statement did not return an error." Does using BEGIN override this behavior? In other words, with
0
506
by: Marc Slemko | last post by:
Suppose I have an innodb table in 4.0.14 and do: LOCK TABLE maggie INSERT INTO maggie values(123, 'simpson'); UNLOCK TABLES As soon as I issue LOCK TABLE, any transaction in progress is automatically committed. By what point is this INSERT guaranteed to be committed to disk
3
3140
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 could not SSH into the machine. We had to manually reboot the machine, and restart the slave. Looking in the error file we found this:
3
949
by: Andy Tran | last post by:
I built a system using mysql innodb to archive SMS messages but the innodb databases are not keeping up with the number of SMS messages coming in. I'm looking for performance of 200 msgs/sec where 1 msg is 1 database row. I'm running on Red Linux: 2.4.20-8bigmem #1 SMP Thu Mar 13 17:32:29 EST 2003 i686 i686 i386 GNU/Linux The machine has dual CPU and 2G of RAM.
0
435
by: JohnD | last post by:
Hello, I've tried resolving this issue in a SuSE newsgroup, but after trying their suggestions and working on this issue for far too long already, I decided to try this list as it may be a more appropriate discussion area. I've installed and configured MySQL 4.0.18 on a SuSE 9.1 system using the default RPM's that came with the distribution. I created a simple database (one table with InnoDB engine type) and have
5
12897
by: Eddie | last post by:
I have a MySQL-server running Innodb. We have installed ~ 2GB of memory in the server. In spite of this MySQL keeps crashing due to out-of-memory errors. The server is a dual xeon i686 running kernel Linux 2.4.20-8smp redhat stock. Top shows mysql steadily consuming more resourses over a period of 2 hours, up to 1.2 Gb, before it crashes. Any clues?
5
15532
by: steve | last post by:
Hi, Besides transaction capability, is there anything else about innodb tables that makes it superior to myISAM? I really don’t need transactions, but for example, I need superior reliability for index (too many index corruptions in the past). Is innodb better in that area, or any other areas? -- Posted using the http://www.dbforumz.com interface, at author's request
0
2483
by: Rajesh Kapur | last post by:
I have a master slave configuration on linux machines running MySQL 4.0.21. Once every hour, a process deletes about 9000 rows and re-inserts fresh data on the master. The master process completes processing under a minute. The updates arrive on the slave within seconds. However, the slave takes about 15-20 minutes to post the same updates. Both master and slave have InnoDB tables. The master and the slave are almost identical in capacity...
0
2300
by: shakahshakah | last post by:
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:
0
8421
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8325
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8844
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8518
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8621
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7354
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.