[pgpool-hackers: 2915] Re: Pgpool-II 3.8: allow to specify load balance weight ratio for load balance parameters

Tatsuo Ishii ishii at sraoss.co.jp
Mon Aug 6 14:43:36 JST 2018


Hi Peng,

There are some trailing spaces in the patch.

/home/t-ishii/load_balance_ratio_v2.diff:99: trailing whitespace.
			For example, if you set 
/home/t-ishii/load_balance_ratio_v2.diff:249: trailing whitespace.
			For example, if you set 
warning: 2 lines add whitespace errors.

Besides this, the patch looks good to me. Please fix the typo above and commit/push.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

> Ishii-san,
> 
> I fixed the whitespace and compiler warnings.
> Also I improved the documentation.
> 
> Could you check the new patch?
> 
> On Tue, 31 Jul 2018 09:21:01 +0900 (JST)
> Tatsuo Ishii <ishii at sraoss.co.jp> wrote:
> 
>> Thank you for the patch!
>> 
>> I have looked into the patch and here are some feedbacks.
>> 
>> 1) git apply makes complainings.
>> 
>> t-ishii at localhost: git apply ~/load_balance_ratio_v1.diff 
>> /home/t-ishii/load_balance_ratio_v1.diff:101: trailing whitespace.
>> 			<xref linkend="guc-database-redirect-preference-list">, when multiple database 
>> /home/t-ishii/load_balance_ratio_v1.diff:142: trailing whitespace.
>>          node for a particular database connection at a specified load balance ratio. 
>> /home/t-ishii/load_balance_ratio_v1.diff:237: trailing whitespace.
>> 			<xref linkend="guc-database-redirect-preference-list">, when multiple database 
>> /home/t-ishii/load_balance_ratio_v1.diff:324: trailing whitespace.
>> 			/* 
>> warning: 4 lines add whitespace errors.
>> 
>> 2) Compiler warnings.
>> 
>> In file included from protocol/child.c:60:0:
>> protocol/child.c: In function ‘select_load_balancing_node’:
>> protocol/child.c:1743:18: warning: too many arguments for format [-Wformat-extra-args]
>>         errdetail("app_name: %s index is %d dbnode is %s", app_name, index_app,
>>                   ^
>> ../src/include/utils/elog.h:195:14: note: in definition of macro ‘ereport_domain’
>>     errfinish rest; \
>>               ^
>> protocol/child.c:1741:5: note: in expansion of macro ‘ereport’
>>      ereport(DEBUG1,
>>      ^
>> protocol/child.c:1794:7: warning: ‘no_load_balance_node_id’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>>     if (i == no_load_balance_node_id)
>>        ^
>> 
>> 3) Subtle comment typos.
>> 
>> 		 * If the wight is bigger than random rate then send to suggested_node_id.
>> 		 * If the wight is less than random rate then choose load balance node from other nodes.
>> 
>> "wight" should be "weight", perhaps?
>> 
>> Best regards,
>> --
>> Tatsuo Ishii
>> SRA OSS, Inc. Japan
>> English: http://www.sraoss.co.jp/index_en.php
>> Japanese:http://www.sraoss.co.jp
>> 
>> From: Bo Peng <pengbo at sraoss.co.jp>
>> Subject: [pgpool-hackers: 2897] Re: Pgpool-II 3.8: allow to specify load balance weight ratio for load balance parameters
>> Date: Mon, 30 Jul 2018 11:49:12 +0900
>> Message-ID: <20180730114912.41c0cb8237871fb5a62b8d46 at sraoss.co.jp>
>> 
>> > Hi,
>> > 
>> > I added a new feature to allow to specify load balance weight ratio for 
>> > database_redirect_preference_list and app_name_redirect_preference_list 
>> > parameters. Attached is the first patch.
>> > 
>> > You can specify the list of "database-name:node id(ratio)" pairs to 
>> > send SELECT queries to a particular backend node for a particular 
>> > database connection at a specified load balance ratio. 
>> > This load balance ratio specifies a value between 0 and 1, 
>> > and the default is 1.0. 
>> > 
>> > For example, by specifying "test:1(0.5)", 
>> > Pgpool-II will redirect 50% SELECT queries to the backend node of ID 1 
>> > for the connection to "test" database. And the other 50% SELECT queries
>> > will be sent to other backend nodes.
>> > 
>> > Example: 
>> > 
>> > If you spacify like below:
>> > 
>> >    database_redirect_preference_list = 'postgres:primary,mydb[01]:1(0.3),mydb2:standby'
>> > 
>> > It means,
>> > 
>> > - Route all SELECT queries on postgres database to the primary backend node.
>> > 
>> > - Route 30% SELECT queries on mydb0 or on mydb1 databases to backend node of ID. 
>> >   The other 70% SELECT queries will be sent to other backend nodes.
>> > 
>> > - Route all SELECT queries on mydb2 database to standby backend nodes. 
>> > 
>> > 
>> > The notion of app_name_redirect_preference_list is same as the database_redirect_preference_list. 
>> > 
>> > 
>> > On Thu, 14 Dec 2017 14:08:03 +0900 (JST)
>> > Tatsuo Ishii <ishii at sraoss.co.jp> wrote:
>> > 
>> >> > Currently we can specify load balance condition by using,
>> >> > database_redirect_preference_list, and
>> >> > app_name_redirect_preference_list like:
>> >> > 
>> >> > postgres:primary
>> >> > 
>> >> > This means, if connected database is postgres, every SELECTs will be
>> >> > redirected to primary.
>> >> > 
>> >> > It would be nice if we could specify load balance ratio like:
>> >> > 
>> >> > postgres:primary(0.3)
>> >> > 
>> >> > which redirects 30% of SELECTs to primary (that is, other 70% of
>> >> > SELECTs will be redirected to the load balance node). If the primary
>> >> > node is also the load balance node, 100% of SELCTs will be redirected
>> >> > to the primary.
>> >> > 
>> >> > Other example is:
>> >> > 
>> >> > postgres:primary(0.0)
>> >> > 
>> >> > which never redirects SELECTs to the primary. This is useful if user
>> >> > never wants to redirect SELECTs on the primary. Actually we cannot do
>> >> > this for now if a primary node changes time to time.
>> >> 
>> >> Sorry I was wrong. This is possible today too by
>> >> "postgres:standby". What we cannot do today is
>> >> "postgres:primary(0.3)".
>> >> 
>> >> > postgres:mydb[0-4]:1(0.3)
>> >> > 
>> >> > which redirects 30% of SELECTs to node 1 (that is, other 70% of
>> >> > SELECTs will be redirected to the load balance node). If node 1 is
>> >> > also the load balance node, 100% of SELCTs will be redirected to node
>> >> > 1.
>> >> > 
>> >> > I suppose the new specification overrides the current "weight"
>> >> > parameters for each node.
>> >> > 
>> >> > Comments and suggestions are welcome.
>> >> > --
>> >> > Tatsuo Ishii
>> >> > SRA OSS, Inc. Japan
>> >> > English: http://www.sraoss.co.jp/index_en.php
>> >> > Japanese:http://www.sraoss.co.jp
>> >> _______________________________________________
>> >> pgpool-hackers mailing list
>> >> pgpool-hackers at pgpool.net
>> >> http://www.pgpool.net/mailman/listinfo/pgpool-hackers
>> >> 
>> > 
>> > 
>> > -- 
>> > Bo Peng <pengbo at sraoss.co.jp>
>> > SRA OSS, Inc. Japan
> 
> 
> -- 
> Bo Peng <pengbo at sraoss.co.jp>
> SRA OSS, Inc. Japan


More information about the pgpool-hackers mailing list