[Postgres-xl-developers] [fix regress]fix wrong pgxc_node init info in setup_connection_information

Jov amutu at amutu.com
Mon Dec 15 00:52:04 PST 2014


When I run the regression test with "make check",there are a lot of tests
failed,because the pgxl need different pgxc_node content from pgxc.I change
the setup_connnection_information by adding node info to proper node like
what's the pgxc_ctl do.
After apply this patch,most of the test cases now pass(but the test hangs
at prepared_xacts,will look later):

============== creating database "regression"         ==============
CREATE DATABASE
ALTER DATABASE
============== running regression test queries        ==============
test tablespace               ... ok
parallel group (18 tests):  txid text oid varchar name char float4 int2
uuid boolean int4 money float8 int8 bit enum rangetypes numeric
     boolean                  ... ok
     char                     ... ok
     name                     ... ok
     varchar                  ... ok
     text                     ... ok
     int2                     ... ok
     int4                     ... ok
     int8                     ... ok
     oid                      ... ok
     float4                   ... ok
     float8                   ... ok
     bit                      ... ok
     numeric                  ... ok
     txid                     ... ok
     uuid                     ... ok
     enum                     ... ok
     money                    ... FAILED
     rangetypes               ... ok
test strings                  ... ok
test numerology               ... ok
parallel group (19 tests):  comments tstypes path reltime polygon lseg time
abstime timetz tinterval macaddr box circle point interval date inet
timestamptz timestamp
     point                    ... ok
     lseg                     ... ok
     box                      ... ok
     path                     ... ok
     polygon                  ... ok
     circle                   ... ok
     date                     ... ok
     time                     ... ok
     timetz                   ... ok
     timestamp                ... ok
     timestamptz              ... ok
     interval                 ... ok
     abstime                  ... ok
     reltime                  ... FAILED
     tinterval                ... ok
     inet                     ... ok
     macaddr                  ... ok
     tstypes                  ... ok
     comments                 ... ok
parallel group (6 tests):  regex geometry type_sanity horology oidjoins
opr_sanity
     geometry                 ... ok
     horology                 ... ok
     regex                    ... ok
     oidjoins                 ... ok
     type_sanity              ... ok
     opr_sanity               ... ok
test insert                   ... ok
test create_function_1        ... ok
test create_type              ... ok
test create_table             ... ok
test create_function_2        ... ok
parallel group (2 tests):  copyselect copy
     copy                     ... ok
     copyselect               ... ok
parallel group (2 tests):  create_operator create_misc
     create_misc              ... ok
     create_operator          ... ok
parallel group (2 tests):  create_view create_index
     create_index             ... FAILED
     create_view              ... ok
parallel group (10 tests):  create_cast create_aggregate typed_table
create_function_3 drop_if_exists vacuum create_table_like constraints
triggers inherit
     create_aggregate         ... ok
     create_function_3        ... ok
     create_cast              ... ok
     constraints              ... ok
     triggers                 ... ok
     inherit                  ... ok
     create_table_like        ... ok
     typed_table              ... ok
     vacuum                   ... ok
     drop_if_exists           ... ok
test sanity_check             ... ok
test errors                   ... ok
test select                   ... ok
parallel group (19 tests):  select_distinct_on select_distinct namespace
btree_index random delete hash_index select_having update case
select_implicit union select_into transactions portals subselect arrays
join aggregates
     select_into              ... ok
     select_distinct          ... ok
     select_distinct_on       ... ok
     select_implicit          ... ok
     select_having            ... ok
     subselect                ... FAILED
     union                    ... ok
     case                     ... ok
     join                     ... FAILED
     aggregates               ... FAILED
     transactions             ... ok
     random                   ... ok
     portals                  ... FAILED
     arrays                   ... FAILED
     btree_index              ... ok
     hash_index               ... ok
     update                   ... ok
     namespace                ... ok
     delete                   ... ok
test prepared_xacts           ...
-----

diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 9e4f0c8..b57cd80 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -931,39 +931,113 @@ static void
 setup_connection_information(void)
 {
        header(_("setting connection information"));
-       /* Datanodes on Coordinator 1*/
+
+       /* -----coordinator 1 ------- */
+       /* node info in Coordinator 1 */
+       psql_command_node("postgres", PGXC_COORD_1, "ALTER NODE %s WITH
(HOST = 'localhost',"
+                                         " type = 'coordinator', PORT =
%d);",
+                                         (char
*)get_node_name(PGXC_COORD_1),
+                                         get_port_number(PGXC_COORD_1));
+       /* Remote Coordinator on Coordinator 1 */
        psql_command_node("postgres", PGXC_COORD_1, "CREATE NODE %s WITH
(HOST = 'localhost',"
-                                         " type = 'datanode', PORT = %d);",
+                                         " type = 'coordinator', PORT =
%d);",
+                                         (char
*)get_node_name(PGXC_COORD_2),
+                                         get_port_number(PGXC_COORD_2));
+       /* Datanodes on Coordinator 1 */
+       psql_command_node("postgres", PGXC_COORD_1, "CREATE NODE %s WITH
(HOST = 'localhost',"
+                                         " type = 'datanode', PORT = %d,
PRIMARY, PREFERRED);",
                                          (char
*)get_node_name(PGXC_DATANODE_1),
                                          get_port_number(PGXC_DATANODE_1));
        psql_command_node("postgres", PGXC_COORD_1, "CREATE NODE %s WITH
(HOST = 'localhost',"
                                          " type = 'datanode', PORT = %d);",
                                          (char
*)get_node_name(PGXC_DATANODE_2),
                                          get_port_number(PGXC_DATANODE_2));
+
+       /* Then reload the connection data */
+       psql_command_node("postgres", PGXC_COORD_1, "SELECT
pgxc_pool_reload();");
+
+       /* -----coordinator 2 ------- */
+
+       /* Remote Coordinator on Coordinator 2 */
+       psql_command_node("postgres", PGXC_COORD_2, "CREATE NODE %s WITH
(HOST = 'localhost',"
+                                         " type = 'coordinator', PORT =
%d);",
+                                         (char
*)get_node_name(PGXC_COORD_1),
+                                         get_port_number(PGXC_COORD_1));
+       /* node info in Coordinator 2 */
+       psql_command_node("postgres", PGXC_COORD_2, "ALTER NODE %s WITH
(HOST = 'localhost',"
+                                         " type = 'coordinator', PORT =
%d);",
+                                         (char
*)get_node_name(PGXC_COORD_2),
+                                         get_port_number(PGXC_COORD_2));
        /* Datanodes on Coordinator 2 */
        psql_command_node("postgres", PGXC_COORD_2, "CREATE NODE %s WITH
(HOST = 'localhost',"
-                                         " type = 'datanode', PORT = %d);",
+                                         " type = 'datanode', PORT = %d,
PRIMARY, PREFERRED);",
                                          (char
*)get_node_name(PGXC_DATANODE_1),
                                          get_port_number(PGXC_DATANODE_1));
        psql_command_node("postgres", PGXC_COORD_2, "CREATE NODE %s WITH
(HOST = 'localhost',"
                                          " type = 'datanode', PORT = %d);",
                                          (char
*)get_node_name(PGXC_DATANODE_2),
                                          get_port_number(PGXC_DATANODE_2));
+       /* Then reload the connection data */
+       psql_command_node("postgres", PGXC_COORD_2, "SELECT
pgxc_pool_reload();");

-       /* Remote Coordinator on Coordinator 1 */
-       psql_command_node("postgres", PGXC_COORD_1, "CREATE NODE %s WITH
(HOST = 'localhost',"
-                                         " type = 'coordinator', PORT =
%d);",
+       /* -----datanode 1 ------- */
+
+       /* Remote Coordinator 1 on Datanode 1 */
+       psql_command_node("postgres", PGXC_COORD_1, "EXECUTE DIRECT ON ( %s
) $$CREATE NODE %s WITH (HOST = 'localhost',"
+                                         " type = 'coordinator', PORT =
%d)$$;",
+                                         (char
*)get_node_name(PGXC_DATANODE_1),
+                                         (char
*)get_node_name(PGXC_COORD_1),
+                                         get_port_number(PGXC_COORD_1));
+       /* Remote Coordinator 2 on Datanode 1 */
+       psql_command_node("postgres", PGXC_COORD_1, "EXECUTE DIRECT ON ( %s
) $$CREATE NODE %s WITH (HOST = 'localhost',"
+                                         " type = 'coordinator', PORT =
%d)$$;",
+                                         (char
*)get_node_name(PGXC_DATANODE_1),
                                          (char
*)get_node_name(PGXC_COORD_2),
                                          get_port_number(PGXC_COORD_2));
-       /* Remote Coordinator on Coordinator 2 */
-       psql_command_node("postgres", PGXC_COORD_2, "CREATE NODE %s WITH
(HOST = 'localhost',"
-                                         " type = 'coordinator', PORT =
%d);",
+       /* node info in Datanode 1 */
+       psql_command_node("postgres", PGXC_COORD_1, "EXECUTE DIRECT ON ( %s
) $$ ALTER NODE %s WITH (HOST = 'localhost',"
+                                         " type = 'datanode', PORT = %d,
PRIMARY, PREFERRED)$$;",
+                                         (char
*)get_node_name(PGXC_DATANODE_1),
+                                         (char
*)get_node_name(PGXC_DATANODE_1),
+                                         get_port_number(PGXC_DATANODE_1));
+       /* Remote Datanode 2 on Datanode 1 */
+       psql_command_node("postgres", PGXC_COORD_1, "EXECUTE DIRECT ON ( %s
) $$CREATE NODE %s WITH (HOST = 'localhost',"
+                                         " type = 'datanode', PORT =
%d)$$;",
+                                         (char
*)get_node_name(PGXC_DATANODE_1),
+                                         (char
*)get_node_name(PGXC_DATANODE_2),
+                                         get_port_number(PGXC_DATANODE_2));
+       psql_command_node("postgres", PGXC_COORD_1, "EXECUTE DIRECT ON ( %s
) $$SELECT pgxc_pool_reload()$$;",
+                                         (char
*)get_node_name(PGXC_DATANODE_1));
+
+       /* -----datanode 2 ------- */
+
+       /* Remote Coordinator 1 on Datanode 2 */
+       psql_command_node("postgres", PGXC_COORD_1, "EXECUTE DIRECT ON ( %s
) $$CREATE NODE %s WITH (HOST = 'localhost',"
+                                         " type = 'coordinator', PORT =
%d)$$;",
+                                         (char
*)get_node_name(PGXC_DATANODE_2),
                                          (char
*)get_node_name(PGXC_COORD_1),
                                          get_port_number(PGXC_COORD_1));
+       /* Remote Coordinator 2 on Datanode 2 */
+       psql_command_node("postgres", PGXC_COORD_1, "EXECUTE DIRECT ON ( %s
) $$CREATE NODE %s WITH (HOST = 'localhost',"
+                                         " type = 'coordinator', PORT =
%d)$$;",
+                                         (char
*)get_node_name(PGXC_DATANODE_2),
+                                         (char
*)get_node_name(PGXC_COORD_2),
+                                         get_port_number(PGXC_COORD_2));
+       /* Remote Datanode 1 on Datanode 2 */
+       psql_command_node("postgres", PGXC_COORD_1, "EXECUTE DIRECT ON ( %s
) $$CREATE NODE %s WITH (HOST = 'localhost',"
+                                         " type = 'datanode', PORT = %d,
PRIMARY, PREFERRED)$$;",
+                                         (char
*)get_node_name(PGXC_DATANODE_2),
+                                         (char
*)get_node_name(PGXC_DATANODE_1),
+                                         get_port_number(PGXC_DATANODE_1));
+       /* node info in Datanode 2 */
+       psql_command_node("postgres", PGXC_COORD_1, "EXECUTE DIRECT ON ( %s
) $$ ALTER NODE %s WITH (HOST = 'localhost',"
+                                         " type = 'datanode', PORT =
%d)$$;",
+                                         (char
*)get_node_name(PGXC_DATANODE_2),
+                                         (char
*)get_node_name(PGXC_DATANODE_2),
+                                         get_port_number(PGXC_DATANODE_2));

-       /* Then reload the connection data */
-       psql_command_node("postgres", PGXC_COORD_1, "SELECT
pgxc_pool_reload();");
-       psql_command_node("postgres", PGXC_COORD_2, "SELECT
pgxc_pool_reload();");
+       psql_command_node("postgres", PGXC_COORD_1, "EXECUTE DIRECT ON ( %s
) $$SELECT pgxc_pool_reload()$$;",
+                                         (char
*)get_node_name(PGXC_DATANODE_2));
 }

Jov
blog: http:amutu.com/blog <http://amutu.com/blog>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.postgres-xl.org/private.cgi/postgres-xl-developers-postgres-xl.org/attachments/20141215/3c4c50a0/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_setup_connection_information.patch
Type: application/octet-stream
Size: 6460 bytes
Desc: not available
URL: <http://lists.postgres-xl.org/private.cgi/postgres-xl-developers-postgres-xl.org/attachments/20141215/3c4c50a0/attachment.obj>


More information about the Postgres-xl-developers mailing list