Drupal érdekesség - locking system


Vannak a Drupalnak amolyan rejtett dolgai, az ember ritkán találkozik velük, sőt, esetleg nem is tudjuk, hogy létezik. Na egy ilyet szedek elő, bevallom, én is ma találkoztam vele először. Ez pedig a locking system, magyarul talán zárolási rendszer a randa szó rá, de becézhetjük szemafornak is.

De mit is csinál ez? Vannak a drupalban olyan folyamatok, amikből nem árt, hogyha nem indul el ugyanazon paraméterekkel kettő. Tipikusan ilyen drupal folyamat a cron, illetve a batch.

Biztosan találkoztál már olyannal a naplóban, hogy "Attempting to re-run cron while it is already running.", magyarul ilyesmi, hogy a "Cron futása nem lehetséges, mert már fut".

Ilyenkor az történik, hogy a hogy amikor elindul egy cron folyamat, egy zárolási rekord keletkezik a semaphore táblában. Ez a lock_acquire($name) függvány hívására történik. Amikor cron futás közben újabb cron indul, történik egy ellenőrzés, hogy a 'cron' nevű zárolás létezik-e már, és ha igen, akkor nem indul el az újabb cron, illetve akkor keletkezik a naplóban az emlegetett bejegyzés.

A lock státuszát mi is lekérdezhetjük: lock_may_be_available('cron').

Amikor az első cron véget ért, akkor történik a zárolás feloldása a lock_release('cron') függvény hívásával.

Mire jó ez még a gyakorlatban?
Nem néztem meg, de például a views is igen valószínű, hogy ez alapján zárolja a nézetek szerkesztési felületét. Ilyenkor van az, hogy "A nézet nem szerkeszthető, mert egy másik felhasználó zárolta", vagy valami ilyesmi..

Van egy éppen aktuális téma a drupal.hu-n, a kolléga egy másik adatbázist írna drupal felületen keresztül. Nos, én bizony preventív nem biztos, hogy szívesen hagynám, hogy egyszerre többen ugyanazt a rekordot szerkesszék. Tehát a szerkesztő form generálása során csinálnék egy lock_acquire("mylock_$recordid"); -t, a form beküldése után pedig lock_release("mylock_$recordid").

És aminek a kapcsán én találkoztam ma a locking system-el, az a boost modul. Észrevettem, hogy ha kell, ha nem, törlődnek a boost által létrehozott oldalak minden cron futáskor. Ennek az oka pedig a locking system "nem ismerete" volt. A modul fejlesztője egy egészen más vonalon oldotta meg a dolgot, ami sok esetben nem működik.
Az eset másik tanulsága: Hogy sokféleképpen meg lehet oldani egy feladatot, de ha azt nem "drupalosan" teszed, akkor bizony érhetnek meglepetések.


That capability and kindness

That capability and kindness in controlling almost everything was excellent. I’m not sure what I would have done if I had not encountered such a stuff like this.Naturally I’ll offer you a website link on your web blog. Thanks for sharing. http://khelomcx.com/free-trial-commodity-tips

Hey, I think your blog might

Hey, I think your blog might be having browser compatibility issues.
When I look at your blog in Opera, it looks fine but when opening in Internet Explorer, it has some overlapping.
I just wanted to give you a quick heads up!
Other then that, wonderful blog!

Here is my blog - pharmacy technician ce free

Hello there! This is my first

Hello there! This is my first visit to your blog! We are a collection of volunteers and starting a new project in a community
in the same niche. Your blog provided us valuable information to work on. You have done a wonderful job!

my web blog cialis on line

Undeniably consider that that

Undeniably consider that that you stated. Your favourite reason appeared to be at the net
the easiest factor to take into accout of. I say to you, I certainly get irked at the same time as
people consider concerns that they plainly do not realize
about. You managed to hit the nail upon the top and also defined out the whole thing with no need side-effects , folks can take a signal.
Will probably be back to get more. Thanks

Here is my website omnicare pharmacy jobs

You really make it seem so

You really make it seem so easy with your presentation but I find this matter to
be actually one thing that I think I'd by no means understand.
It seems too complex and very large for me. I'm taking a look forward
to your subsequent put up, I'll try to get the hold of it!

my page; how to take prednisone

I’m not that much oof a

I’m not that much oof a online reader to be honest but your sites really nice, keep it up!
I'll go ahead and bookmark your website to come back in thee future.
Many thanks

My website; canadian pharmacy

Admiring the time and effort

Admiring the time and effort you put into your website
and detailed information you offer. It's good to come across a blog every once
in a while that isn't the same old rehashed information. Excellent
read! I've bookmarked your site and I'm adding
your RSS feeds to my Google account.

My webpage; canadian pharmacy

Its like you read my mind!

Its like you read my mind! You appear to know a lot about this,
like you wrote the book in it or something. I think that you could do with a few pics to drive the message home
a little bit, but other than that, this is fantastic blog. A
fantastic read. I'll definitely be back.

my blog post; www.canadianpharmacymeds.com

Wow, tis paragrqph is

Wow, tis paragrqph is pleasant, my sister iis analyzing such things, so I
am going to tell her.

Here is my web-site :: canadian pharmacies shipping to usa

Your mode off describing the

Your mode off describing the wholpe thing in this post is really good, every one can simply understand it, Thanks a

Also visit my homepage :: www.canadianpharmacymeds.com

Thanks , I have just been

Thanks , I have just been looking for information about this topic for ages and
yours is the greatest I have found out till now.
However, what about the conclusion? Are you certain in regards to the

My web-site ... prednisone

It is in point of fact a

It is in point of fact a great and helpful piece of information. I
am happy that you just shared this useful information with us.
Please stay us informed like this. Thanks for sharing.

Feel free to surf to my web page :: prednisone

I believe what you said made

I believe what you said made a ton of sense. But, think on this, what if you typed a catchier title?
I mean, I don't wish to tell you how to run your blog, but suppose you added a post title to maybe
grab folk's attention? I mean Szántó Gábor Drupal oldala - Drupal érdekesség - locking system is kinda boring.
You ought to glance at Yahoo's home page and watch how they write news
titles to get people to click. You might add a related video or a
related pic or two to get people interested about what you've got to say.
In my opinion, it would bring your posts a little livelier.

Look at my web-site ... prednisone

You actually make it seem so

You actually make it seem so easy along with your presentation however I to find this matter to be
actually something which I feel I'd never understand.

It kind of feels too complicated and extremely large for me.
I'm taking a look ahead on your subsequent submit, I will attempt to get the grasp of it!

my blog post ... tinidazole

Truly when someone doesn't be

Truly when someone doesn't be aware of after that its up to other people that they will assist, so here
it occurs.

Excellent pieces. Keep

Excellent pieces. Keep writing such kind of information on your site.

Im really impressed by your blog.
Hey there, You have performed a fantastic job. I'll definitely
digg it and in my view recommend to my friends. I am confident they will be benefited from this web site.

Here is my homepage :: drug lookup

I think that is among the

I think that is among the such a lot significant information for me.

And i'm glad reading your article. But wanna remark on some
normal issues, The site taste is great, the articles is in reality nice :
D. Just right process, cheers

Also visit my web page: drugs online

Hey there excellent blog!

Hey there excellent blog! Does running a blog similar
to this take a large amount of work? I have virtually no knowledge of programming however I was hoping to start my own blog in the near future.
Anyhow, should you have any ideas or tips for
new blog owners please share. I understand this is off topic nevertheless I just had to ask.

Appreciate it!

Hey! I just wanted to ask if

Hey! I just wanted to ask if you ever have any issues with hackers?
My last blog (wordpress) was hacked and I ended up losing many
months of hard work due to no data backup. Do you have any methods to stop hackers?

Feel free to visit my site; cialis generic buy online

Appreciate the

Appreciate the recommendation. Let me try it out.

Look at my web blog - price cialis 10mg

WOW just what I was searching

WOW just what I was searching for. Came here by searching
for canada rx

my site :: Cialis 20mg prix en pharmacie

It's going to be end of mine

It's going to be end of mine day, but before
finish I am reading this fantastic post to increase my experience.

It's really a cool and

It's really a cool and helpful piece of info. I'm satisfied that
you just shared this helpful information with us. Please keep us
up to date like this. Thanks for sharing.

Here is my blog cialis without prescription

Excellent weblog here!

Excellent weblog here! Additionally your website quite a
bit up very fast! What web host are you the use of?
Can I am getting your affiliate hyperlink to your host?

I desire my site loaded up as fast as yours lol

Here is my site Canadian cialis 100

Hi there, I enjoy reading all

Hi there, I enjoy reading all of your article. I wanted to write a little comment to support you.

Feel free to visit my weblog; dyson dc24

Hello friends, its fantastic

Hello friends, its fantastic post concerning tutoringand
fully explained, keep it up all the time.

Here is my web-site dyson vacuum

I love your blog.. very nice

I love your blog.. very nice colors & theme. Did you
design this website yourself or did you hire someone
to do it for you? Plz respond as I'm looking to construct my own blog and would like to know where
u got this from. thanks

Feel free to surf to my website ... dyson dc24

Hello! This post couldn't be

Hello! This post couldn't be written any better!
Reading through this post reminds me of my previous room mate!
He always kept talking about this. I will forward this write-up to
him. Pretty sure he will have a good read. Many thanks for sharing!

my site - dyson dc24

We are a group of volunteers

We are a group of volunteers and starting a new scheme in our community.
Your website provided us with valuable information to work
on. You've done an impressive job and our entire community will be grateful to you.

my blog post freeman dyson

First off I would like to say

First off I would like to say awesome blog! I had a quick question which I'd like to ask if you do not mind.

I was curious to find out how you center yourself and clear your thoughts before writing.
I have had trouble clearing my mind in getting my ideas out there.
I truly do take pleasure in writing however it just seems like the first 10 to 15 minutes tend to be
wasted simply just trying to figure out how to begin. Any suggestions or hints?

my web site: drugs online

Hello There. I found your

Hello There. I found your blog using msn. This is an extremely well written article.
I'll be sure to bookmark it and come back to read
more of your useful information. Thanks for the
post. I'll definitely return.

Feel free to surf to my blog :: prescription medicines

I'm not sure where you're

I'm not sure where you're getting your info, but great
topic. I needs to spend some time learning more or understanding more.
Thanks for fantastic information I was looking for this
information for my mission.

Also visit my web site ... buy cialis canada online

Its such as you read my

Its such as you read my thoughts! You seem to know a lot about this,
such as you wrote the ebook in it or something. I think
that you just can do with a few p.c. to drive the message house a bit,
however other than that, that is magnificent blog.

A fantastic read. I will definitely be back.

Here is my web site: how to buy cialis online from canada

What's up, this weekend is

What's up, this weekend is fastidious for me, since this time i
am reading this fantastic informative piece of writing
here at my home.

Look at my weblog cialis over the counter

Wе are a group of νolunterѕ

Wе are a group of νolunterѕ annd stɑrtіng a new scheme in our community.
Your website offered uss with heelpful info to work on.
You hwve performed an impressiѵе taѕk and ouг entire grroup will рrobablky be thankful to you.

Heгe іs my ρage :: swiss knives

This page definitely has all

This page definitely has all the information and facts
I wanted concerning this subject and didn't know who to ask.

Here is my site: cialis canada pharmacy

What's up, everything is

What's up, everything is going nicely here and ofcourse every one is sharing data, that's genuinely excellent,
keep up writing.

Take a look at my web page :: cialis online canada

For newest news you have to

For newest news you have to pay a quick visit the web and on world-wide-web I
found this web page as a most excellent website for
most recent updates.

Feel free to surf to my blog :: generic cialis from canada

When I initially commented I

When I initially commented I appear to have clicked the -Notify me when new comments are
added- checkbox and now whenever a comment is added I get four emails with the exact same comment.
Perhaps there is an easy method you can remove me from that
service? Kudos!

Very good article. I will be

Very good article. I will be facing many of these issues as well..

My web blog cialis coupons pharmacy

I simply could not go away

I simply could not go away your website before suggesting that I extremely loved the standard information a person supply on your visitors?
Is gonna be back frequently to inspect new posts

Look at my web-site; cialis pharmacy price

There are several famous

There are several famous outboard motor brands, such as Yamaha Outboard Motor, Suzuki Marine, Honda Marine and Mercury Marine. They are all hot sellers outboard engines around the world. Among them, Yamaha, Suzuki and Honda are all made in Japan. They are welcomed by the people Worldwide.

According to the engine type, the Yamaha Outboard Motors have 4 stroke and 2 stroke type. The 4-stroke engine tends to be more sophisticated than a 2-stroke option as ignition process is split into several different cycles. So the Yamaha 4 Stroke Outboard is more popular than the 2 stroke.

The Yamaha Outboard Engine has strong horsepower and beautiful outer, you will like it when you give a glance at. So Yamaha 150 Outboard is your first choice.

When you consider buying an outboard motor, Suzuki Marine and Honda Marine are also in your list. Both of them are in fashionable design and have power horsepower.

If you have a boat you can buy a Suzuki Outboard Motor to fit on it, with which you can go to the deep sea for fun and fishing, and you fish more fishes with and outboard engine.

Yamaha Outboard Sale brand new and good condition outboard motors and you can get promotion prices and enjoy free delivery.

Király a leírás, egy apró

Király a leírás, egy apró pontosítást tennék hozzá:

A lock_acquire ami megpróbál zárolni, és ha sikerül akkor true, ha nem akkor false értékkel tér vissza. Fontos tudni, hogy 1 azaz egy atomi(megszakíthatatlan) műveletnek kell lennia a szemafor művletnek, különben nem ér egy fabadkát sem az egész rendszered. Ha először ellenőrzöd, majd lefoglalod, de utána nem ellenőrzöd, hogy sikeres volt-e a foglalás ugyan ott vagy ahol a part szakad. Lásd a cron megvalósítását:


Javasolnám a lock_may_be_available() függvény használatának kerülését. Látható módon az available-t senki nem hívja a lock rendszeren kívülről:


Az atomi művelet résszel

Az atomi művelet résszel egyetéretek, az is érthető, hogy a core-ban nincsen használva, de egy legitim példa:

Neki csak arra van szüksége, hogy lekérdezze, hogy fut-e a cron, de ha nem, nem fogja a szemafort bekapcsolni.

Boostnál a folyamat:

Adott egy boost_flush_cache(), és adott egy változó, amivel azt állítjuk, hogy a cron futásakor töröljük-e a boost cache-t, vagy nem. A cron folyamata során a _flush_cache hook meghívódik, és ezért a boost-nak ellenőriznie kell, hogy épp van-e bekapcsolt cron szemafor.

Viszont, hogyha cache_clear_all során hívjuk meg a és lock_aquire-t használunk a cron ellenőrzésre, akkor minden flush_cache-kor lefoglalunk egy cron lockot, és ráadásul sehol nem oldjuk fel.


A mező tartalma nem nyilvános.
  • Internal paths in double quotes, written as "internal:node/99", for example, are replaced with the appropriate absolute URL or relative path.
  • Engedélyezett HTML elemek: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <del> <img>
  • A webcímek és email címek automatikusan linkekké alakulnak.
  • A sorokat és bekezdéseket a rendszer automatikusan felismeri.
  • Engedélyezett HTML elemek: <a> <blockquote> <br> <cite> <code> <dd> <del> <div> <dl> <dt> <em> <li> <ol> <p> <span> <strong> <ul>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <mysql>, <php>, <python>, <ruby>, <sql>. The supported tag styles are: <foo>, [foo].
  • Minden email cím át lesz alakítva ember által olvasható módon, vagy (ha a JavaScript engedélyezett) ki lesz cserélve kattintható, de biztonságos hivatkozásra.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.