[Pgpool-hackers] backend weighting calculation is wrong

Jeff Davis pgpool at j-davis.com
Mon Sep 25 22:37:14 UTC 2006


On Mon, 2006-09-25 at 14:24 +0900, Yoshiyuki Asaba wrote:
> From: Jeff Davis <pgpool at j-davis.com>
> Subject: [Pgpool-hackers] backend weighting calculation is wrong
> Date: Wed, 13 Sep 2006 16:57:26 -0700
> 
> > This algorithm does not look correct. For instance, if you have backends
> > with weights 1.0 and 2.0, the former will only receive 1/4 of the
> > queries. I tested this using replication mode with load balancing and
> > verified the inconsistency.
> 
> I confirmed the problem. It's a bug.
> 
> 
> > I have attached a short patch. I am not an expert in random number
> > handling, so someone else should review my code.
> 
> I review and modify your patch. Could you test the attached patch?
> 

Thank you, it works great.

So that I can learn how to write code that fits with your code, can you
tell me how I could have improved my patch? I don't understand why you
introduced the variables "j" and "alive_backends". Does my patch fail in
some scenario?

Regards,
	Jeff Davis




More information about the Pgpool-hackers mailing list