Fix oversight in commit 3a36284c53c125389c999de5c6c4710973c4cb82.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Sun, 31 Jan 2021 02:27:47 +0000 (11:27 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Sun, 31 Jan 2021 02:31:25 +0000 (11:31 +0900)
When si_get_snapshot() is called, load balance node has not been
decided yet and we cannot use VALID_BACKEND macro.  Use
VALID_BACKEND_RAW instead.

src/protocol/pool_proto_modules.c

index 92b94f7cdd99c9642e8cf0087e21c10bd58be85a..8789bdc5c0b3afff2dd1ffb5a86ce9bf169643f5 100644 (file)
@@ -4390,7 +4390,10 @@ si_get_snapshot(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend, Node
                        static  char *si_query = "SELECT current_setting('transaction_read_only')";
                        POOL_SELECT_RESULT *res;
 
-                       if (!VALID_BACKEND(i))
+                       /* We cannot use VALID_BACKEND macro here because load balance
+                        * node has not been decided yet.
+                        */
+                       if (!VALID_BACKEND_RAW(i))
                                continue;
 
                        do_query(CONNECTION(backend, i), si_query, &res, MAJOR(backend));