Since BG Perl Workshop 2010 I have read about Gearman and a few weeks back I decided to incorporate it in few of my projects. While developing with Gearman is interesting and fun job I found some things that I really missed in the server. While testing Gearman I started a client which added a lot of calls to a function which was not still registered. The problem was that some of the arguments to that function would insert wrong information into DB so I wanted to simply remove all calls to the function before connecting the worker for that function.
However, currently in Gearman server there are no commands that allow that functionality. The only way to do this is to restart gearmand.

So I decided to look at the code and see if I can add what I want. At first it seemed very easy to implement what I wanted so I started :)

It looked very very easy to implement rmfunc and zerofunc in the server, so I decided to contribute back my changes to the gearman project.

However, not everything is as easy as it seamed :) 1st Eric and Brian requested a test case which was to be in C with their test API. This was quite a challenge and I’m still not done with it :(

The 2nd thing seemed to be more complicated, but for me it was easier so I started with it. The problem was that, while it is no problem to remove functions which are executed as background jobs, its quite interesting when you try to remove function which has connected clients requesting it. When you remove currently requested function, there is no code that will notify connected clients that the function is no longer available, nor there is connection error sent to those clients. This breaks gearman communication in a lot of different ways.

So what I’m trying to achieve is add the functionality required to interrupt client communication with the server and send the proper error messages to the client. For me this is no easy job, but it seams that it is easier then the test cases.

Comments are closed.

Posted by HackMan
Dated: 14th March 2010
Filled Under: Gearman, Technology