Give a different treatment to brin test case.
authorPavan Deolasee <pavan.deolasee@gmail.com>
Mon, 16 Jul 2018 07:45:15 +0000 (13:15 +0530)
committerPavan Deolasee <pavan.deolasee@gmail.com>
Mon, 16 Jul 2018 07:45:15 +0000 (13:15 +0530)
Since function invokations are not automatically sent down to the remote node,
brin_summarize_range() doesn't report the correct result. Instead we now use
EXECUTE DIRECT mechanism to execute the function on the remote node and get the
result back. The expected output is adjusted acoordingly. Also move
xc_create_function test case at the beginning to ensure the function to query
remote node is available for this test case.

src/test/regress/expected/brin.out
src/test/regress/parallel_schedule
src/test/regress/serial_schedule
src/test/regress/sql/brin.sql

index 13233c238c0db5604fe655f014a9eba780909e54..f256be7b866ec7d056284f2d61b7645aedf673b9 100644 (file)
@@ -460,26 +460,44 @@ BEGIN
 END;
 $$;
 -- summarize one range
-SELECT brin_summarize_range('brin_summarize_idx', 0);
- brin_summarize_range 
-----------------------
-                    0
-(1 row)
-
+DO $D$
+DECLARE
+       str varchar;
+       node_name varchar;
+       result integer;
+BEGIN
+    node_name = get_xc_node_name(1);
+       str = 'execute direct on (' || node_name || ') $$ ' || 'SELECT brin_summarize_range(''brin_summarize_idx'', 0)' || ' $$'  ;
+       execute str into result;
+       raise notice '%', result;
+END $D$ language plpgsql;
+NOTICE:  0
 -- nothing: already summarized
-SELECT brin_summarize_range('brin_summarize_idx', 1);
- brin_summarize_range 
-----------------------
-                    0
-(1 row)
-
+DO $D$
+DECLARE
+       str varchar;
+       node_name varchar;
+       result integer;
+BEGIN
+    node_name = get_xc_node_name(1);
+       str = 'execute direct on (' || node_name || ') $$ ' || 'SELECT brin_summarize_range(''brin_summarize_idx'', 1)' || ' $$'  ;
+       execute str into result;
+       raise notice '%', result;
+END $D$ language plpgsql;
+NOTICE:  0
 -- summarize one range
-SELECT brin_summarize_range('brin_summarize_idx', 2);
- brin_summarize_range 
-----------------------
-                    1
-(1 row)
-
+DO $D$
+DECLARE
+       str varchar;
+       node_name varchar;
+       result integer;
+BEGIN
+    node_name = get_xc_node_name(1);
+       str = 'execute direct on (' || node_name || ') $$ ' || 'SELECT brin_summarize_range(''brin_summarize_idx'', 2)' || ' $$'  ;
+       execute str into result;
+       raise notice '%', result;
+END $D$ language plpgsql;
+NOTICE:  1
 -- nothing: page doesn't exist in table
 SELECT brin_summarize_range('brin_summarize_idx', 4294967295);
  brin_summarize_range 
index 1bcbf3b5ef3f9310f0b97a097b16b82193cdeee5..ed7efb35fb982a89e235cedae31c82600e9f107b 100644 (file)
@@ -41,6 +41,8 @@ test: create_function_1
 test: create_type
 test: create_table
 test: create_function_2
+# This creates functions used by tests xc_misc, xc_FQS and xc_FQS_join
+test: xc_create_function
 
 # ----------
 # Load huge amounts of data
@@ -135,8 +137,6 @@ test: stats
 # ----------
 # Postgres-XC additional tests
 # ----------
-# This creates functions used by tests xc_misc, xc_FQS and xc_FQS_join
-test: xc_create_function
 # Those ones can be run in parallel
 test: xc_groupby xc_distkey xc_having xc_temp xc_remote xc_FQS xc_FQS_join xc_copy xc_for_update xc_alter_table xc_sequence xc_misc
 
index cf0be621ac8c0b977e298c4b49afeb305f1af747..c0156d8584e539e052f23a9a624e1631b842bad3 100644 (file)
@@ -58,6 +58,7 @@ test: create_function_1
 test: create_type
 test: create_table
 test: create_function_2
+test: xc_create_function
 test: copy
 test: copyselect
 test: copydml
@@ -179,7 +180,6 @@ test: with
 test: xml
 test: event_trigger
 test: stats
-test: xc_create_function
 test: xc_groupby
 test: xc_distkey
 test: xc_having
index 2a32a89e47013e8dc3aabdb35fe7770a7dad4bc7..b4c2e6d25a2e55092ab0d8243deafe36fa15f4e4 100644 (file)
@@ -447,11 +447,41 @@ END;
 $$;
 
 -- summarize one range
-SELECT brin_summarize_range('brin_summarize_idx', 0);
+DO $D$
+DECLARE
+       str varchar;
+       node_name varchar;
+       result integer;
+BEGIN
+    node_name = get_xc_node_name(1);
+       str = 'execute direct on (' || node_name || ') $$ ' || 'SELECT brin_summarize_range(''brin_summarize_idx'', 0)' || ' $$'  ;
+       execute str into result;
+       raise notice '%', result;
+END $D$ language plpgsql;
 -- nothing: already summarized
-SELECT brin_summarize_range('brin_summarize_idx', 1);
+DO $D$
+DECLARE
+       str varchar;
+       node_name varchar;
+       result integer;
+BEGIN
+    node_name = get_xc_node_name(1);
+       str = 'execute direct on (' || node_name || ') $$ ' || 'SELECT brin_summarize_range(''brin_summarize_idx'', 1)' || ' $$'  ;
+       execute str into result;
+       raise notice '%', result;
+END $D$ language plpgsql;
 -- summarize one range
-SELECT brin_summarize_range('brin_summarize_idx', 2);
+DO $D$
+DECLARE
+       str varchar;
+       node_name varchar;
+       result integer;
+BEGIN
+    node_name = get_xc_node_name(1);
+       str = 'execute direct on (' || node_name || ') $$ ' || 'SELECT brin_summarize_range(''brin_summarize_idx'', 2)' || ' $$'  ;
+       execute str into result;
+       raise notice '%', result;
+END $D$ language plpgsql;
 -- nothing: page doesn't exist in table
 SELECT brin_summarize_range('brin_summarize_idx', 4294967295);
 -- invalid block number values