MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:Heikki Tuuri Date:March 20 2002 4:25pm
Subject:Re: skip locks
View as plain text  

the modification should be something like this.

1. Modify the parser to parse SKIP LOCKED.
2. Pass the new 'locking mode' to external_lock or store_lock in
3. Modify row_search_for_mysql in row0sel.c for the new locking mode.
4. Let on line 1735 of lock0lock.c lock_rec_lock_slow return a new code


Heikki Tuuri
Innobase Oy

>Subject: Re: skip locks
>From: Mike Mangino <mmangino@stripped>
>To: Sinisa Milivojevic <sinisa@stripped>
>Date: 20 Mar 2002 10:52:31 -0500
>> >
>> > If nobody has discussed this, I will start reading the source to see
>> > to implement. I've gone through the parser code which seems simple
>> > enough, so all that is left is the locking code, which I will admit is
>> > little daunting. I will probably write back with several questions once
>> > I get into it a little more. Thanks for your input!
>> Hi!
>> It is possible that it corresponds to InnoDB's SELECT with SHARE ...
>> Please take a look at that command and see in which ways it differs in
what you are looking for.
>Thanks for the pointer. Unfortunately, that doesn't do what I am looking
>for. Most enterprise queueing systems are database backed, and use a
>table for storage. Think of an enterprise queue as your standard
>priority fifo. The goal is to allow multiple processes to remove items
>from the queue simultaneously, but not see items before they are
>committed. What this does, is allow for a transactional queueing api to
>be built around a standard table.
>There are two main operations, enqueue and dequeue. Enqueue is easy, it
>is just an insert into the table.
>Dequeue on the other hand, is a little more complicated. You want to get
>the first row ordered by priority that has not been taken by any other
>dequeuer. In the applications I have worked on, we do about 100 to 200
>enqueues and dequeues a second. (So it must be fast!)
>Essentially, a dequeue must select the highest priority row and lock it.
>It must avoid waiting on any locked row. It could be implemented with a
>nowait type option, but that would involve polling. The select statement
>in an ideal world would be
>select * from queue_table order by priority limit 1 for update skip
>That will return the first row eligible for processing.
>I don't see anything that corresponds to that in MySQL or InnoDB. I am
>not afraid of doing the implementation, I just some pushing in the
>direction of where this gets implemented. It looked at first glance like
>I might be able to implement that in the mysql locking, but after a few
>hours of reading code, it looks like it may need to happen in the actual
>handler for the table code. Is there technical documentation on the
>locking mechanisms in MySQL and InnoDB somewhere?
>   __  ___     ___ ____  __
>  /  |/  /_ __/ __/ __ \/ /    Mr. Sinisa Milivojevic <sinisa@stripped>
> / /|_/ / // /\ \/ /_/ / /__   MySQL AB, Fulltime Developer
>/_/  /_/\_, /___/\___\_\___/   Larnaca, Cyprus
>       <___/

skip locksMike Mangino19 Mar
  • Re: skip locksSinisa Milivojevic20 Mar
    • Re: skip locksMike Mangino20 Mar
      • Re: skip locksMichael Widenius21 Mar
Re: skip locksHeikki Tuuri20 Mar