[pgpool-hackers: 3878] Proposal: Remove special SQL comments of /*NO LOAD BALANCE*/

Takuma Hoshiai hoshiai.takuma at nttcom.co.jp
Tue Apr 20 16:43:43 JST 2021


Hi,

I create a patch about remove special SQL comments of
/*NO LOAD BALANCE*/ on V4.3 .

Pgpool can prevent load balancing by special SQL comments(
/*NO LOAD BALANCE*/), regardless of allow_sql_comments parameter.
But, Currrently, primary_routing_query_pattern_list paramter can
do same things. This special sql comments often mislead the users,
so this feature remove on this patch.

Best Regards,

-- 
Takuma Hoshiai <hoshiai.takuma at nttcom.co.jp>
-------------- next part --------------
 src/context/pool_query_context.c                   | 18 ------------------
 src/test/regression/tests/009.sql_comments/test.sh |  4 ++--
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/src/context/pool_query_context.c b/src/context/pool_query_context.c
index 6635369..d099e13 100644
--- a/src/context/pool_query_context.c
+++ b/src/context/pool_query_context.c
@@ -443,24 +443,6 @@ pool_where_to_send(POOL_QUERY_CONTEXT * query_context, char *query, Node *node)
 	pool_clear_node_to_be_sent(query_context);
 
 	/*
-	 * If there is "NO LOAD BALANCE" comment, we send only to main node.
-	 */
-	if (!strncasecmp(query, NO_LOAD_BALANCE, NO_LOAD_BALANCE_COMMENT_SZ))
-	{
-		pool_set_node_to_be_sent(query_context,
-								 MAIN_REPLICA ? PRIMARY_NODE_ID : REAL_MAIN_NODE_ID);
-		for (i = 0; i < NUM_BACKENDS; i++)
-		{
-			if (query_context->where_to_send[i])
-			{
-				query_context->virtual_main_node_id = i;
-				break;
-			}
-		}
-		return;
-	}
-
-	/*
 	 * In raw mode, we send only to main node. Simple enough.
 	 */
 	if (RAW_MODE)
diff --git a/src/test/regression/tests/009.sql_comments/test.sh b/src/test/regression/tests/009.sql_comments/test.sh
index 5eec45d..9af8bd0 100755
--- a/src/test/regression/tests/009.sql_comments/test.sh
+++ b/src/test/regression/tests/009.sql_comments/test.sh
@@ -65,10 +65,10 @@ $PSQL -c "/* comment */SELECT 'case5'" test
 
 test `getnode "case5"` -eq 1 || ok=ng
 
-# should be redirect to node 0
+# should be redirect to node 1. this comment is old feature.
 $PSQL -c "/*No LOAD BALANCE*/SELECT 'case6'" test
 
-test `getnode "case6"` -eq 0 || ok=ng
+test `getnode "case6"` -eq 1 || ok=ng
 
 
 ./shutdownall


More information about the pgpool-hackers mailing list