<br><br>
<div><span class="gmail_quote">2008/7/25, Ulf Wiger <<a href="mailto:ulf@wiger.net">ulf@wiger.net</a>>:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">As far as I know there are no docs on the locker implementation<br>in mnesia, but I do recall some tricky bugs in this area. For<br>
one thing, the locker also handles the deadlock prevention<br>logic, so it must keep track of dependencies to some extent.<br><br>You can read the code and try to form your own opinion,<br>but before you start trying to extend this part of mnesia,<br>
possibly introducing deadlock bugs in your application,<br>you should carefully measure the performance of the<br>existing locking solutions: record locks, sticky locks<br>and table locks. You should also write a wrapper and see<br>
if it gives you the kind of performance improvement you're<br>after. If it doesn't, you may be able to come up with some<br>really nifty extension of mnesia_locker through deep<br>meditation over the code. The next challenge, after ensuring<br>
that it's stable, would then be to try to get it accepted as<br>an official extension to mnesia - otherwise, you'll be stuck<br>maintaining your own mnesia patches, and that's no fun<br>(been there, done that).<br>
<br>Table locks can be surprisingly efficient, esp if you don't<br>mix record and table locks too much. I'd advice some<br>experimentation down that alley first.</blockquote>
<div> </div>
<div>Thanks! I'll do some experiement first .</div><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">BR,<br>Ulf W<br><br>BR,<br>Ulf W<br><br>2008/7/24 devdoer bird <<a href="mailto:devdoer2@gmail.com">devdoer2@gmail.com</a>>:<br>
><br>><br>><br>> 2008/7/24, Ulf Wiger <<a href="mailto:ulf@wiger.net">ulf@wiger.net</a>>:<br>>><br>>> If you are to gain any performance compared to a wrapper, or using<br>>> only table locks, you must do brain surgery on mnesia_locker. I<br>
>> strongly advise against that. The relationship between record locks<br>>> and table locks is quite intricate.<br>><br>><br>> Yes.I want to gain some performance to lock part of the table.<br>> What's the intricate part of the locking system design?Can you give any docs<br>
> about the design of the mensia table-lock and record lock?<br>>><br>>> BR,<br>>> Ulf W<br>>><br>>> 2008/7/24, devdoer bird <<a href="mailto:devdoer2@gmail.com">devdoer2@gmail.com</a>>:<br>
>> > The example I give is not good.,but I just need hack the mnesia lock :(.<br>>> ><br>>> > I want to lock part of the table and which part is controled by the<br>>> > record's<br>
>> > key's value range .Currently mnesia only support record lock and table<br>>> > lock.<br>>> ><br>>> ><br>>> > 2008/7/24, Ulf Wiger <<a href="mailto:ulf@wiger.net">ulf@wiger.net</a>>:<br>
>> >><br>>> >> I don't think you should hack mnesia for that. A simple wrapper<br>>> >> function will do nicely.<br>>> >><br>>> >> BR,<br>>> >> Ulf W<br>
>> >><br>>> >> 2008/7/23, devdoer bird <<a href="mailto:devdoer2@gmail.com">devdoer2@gmail.com</a>>:<br>>> >> > HI:<br>>> >> ><br>>> >> > I want to extend mnesia 's lock to add this function<br>
>> >> > "mnesia:lock(LockItem,LockType,ConditionFun)" .<br>>> >> ><br>>> >> > This function works in this way: If a table 's record passes the<br>>> >> > ConditionFun test,the the record is locked.<br>
>> >> ><br>>> >> > Eg.<br>>> >> > I have a user table with the record: -record(user,{name,age}).<br>>> >> ><br>>> >> > I want to lock the user's whose name begines with 'a' ,I can code<br>
>> >> > using<br>>> >> my<br>>> >> > customized " mnesia:lock(LockItem,LockType,ConditionFun)"<br>>> >> ><br>>> >> > like this:<br>>> >> ><br>
>> >> > ConditionFun=fun(U)-><br>>> >> > if<br>>> >> > U#<a href="http://user.name">user.name</a>=='a' -> true;<br>>> >> > true->false<br>
>> >> > end<br>>> >> > end<br>>> >> > mnesia:lock(user,write,ConditionFun).<br>>> >> ><br>>> >> > that is I want to lock part of the table.<br>
>> >> ><br>>> >> > Have anyone done this before? How shall I extend the mensia lock? Any<br>>> >> > information will be helpful, I 'm quite unfamiliar with mnesia lock<br>
>> >> > system.<br>>> >> ><br>>> >><br>>> ><br>><br>><br></blockquote></div><br>