{"action":"created","issue":{"url":"https://api.github.com/repos/2ndQuadrant/bdr/issues/64","labels_url":"https://api.github.com/repos/2ndQuadrant/bdr/issues/64/labels{/name}","comments_url":"https://api.github.com/repos/2ndQuadrant/bdr/issues/64/comments","events_url":"https://api.github.com/repos/2ndQuadrant/bdr/issues/64/events","html_url":"https://github.com/2ndQuadrant/bdr/issues/64","id":72222918,"number":64,"title":"CREATE SEQUENCE followed by OWNER TO hangs","user":{"login":"agx","id":2052773,"avatar_url":"https://avatars.githubusercontent.com/u/2052773?v=3","gravatar_id":"","url":"https://api.github.com/users/agx","html_url":"https://github.com/agx","followers_url":"https://api.github.com/users/agx/followers","following_url":"https://api.github.com/users/agx/following{/other_user}","gists_url":"https://api.github.com/users/agx/gists{/gist_id}","starred_url":"https://api.github.com/users/agx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agx/subscriptions","organizations_url":"https://api.github.com/users/agx/orgs","repos_url":"https://api.github.com/users/agx/repos","events_url":"https://api.github.com/users/agx/events{/privacy}","received_events_url":"https://api.github.com/users/agx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-04-30T17:09:57Z","updated_at":"2015-05-04T16:11:04Z","closed_at":null,"body":"Hi,\r\nI'm currently trying trying to import the Foreman database into bdr. After dumping it and changing the sequence type to bdr like (for all table):\r\n\r\n```\r\nCREATE TABLE bug_architectures (\r\n    id integer NOT NULL,\r\n    name character varying(255) DEFAULT NULL::character varying NOT NULL,\r\n    created_at timestamp without time zone NOT NULL,\r\n    updated_at timestamp without time zone NOT NULL,\r\n    hosts_count integer DEFAULT 0,\r\n    hostgroups_count integer DEFAULT 0\r\n);\r\nALTER TABLE bug_architectures OWNER TO foreman;\r\n\r\n\r\nCREATE SEQUENCE bug_architectures_id_seq\r\n    USING bdr;\r\nALTER TABLE bug_architectures_id_seq OWNER TO foreman;\r\nALTER SEQUENCE bug_architectures_id_seq OWNED BY architectures.id;\r\n```\r\n\r\nI can reproducibly hang a 'psql test3 < dump.sql' on the first OWNER change of the first sequene. If I cancel that one it proceeds and hangs at the next one. _But_ if I take out all OWNER changes and move them to a separate script and apply them after some seconds everything is fine. In  the hang case I see:\r\n\r\n```\r\npostgres=# select * from pg_stat_activity WHERE datname='test3';\r\n datid | datname | pid  | usesysid | usename  |              application_name              |  client_addr  | client_hostname | client_port |         backend_start         |          xact_start           |\r\n+query_start          |         state_change          | waiting | state  | backend_xid | backend_xmin |                                             query\r\n-------+---------+------+----------+----------+--------------------------------------------+---------------+-----------------+-------------+-------------------------------+-------------------------------+-------\r\n+------------------------+-------------------------------+---------+--------+-------------+--------------+------------------------------------------------------------------------------------------------\r\n 22389 | test3   | 6193 |       10 | postgres | bdr (6143134531729040619,1,22389,): perdb  |               |                 |             | 2015-04-30 14:59:18.87812+02  | 2015-04-30 15:07:16.661488+02 | 2015-0\r\n+4-30 15:09:42.720388+02 | 2015-04-30 15:09:42.720389+02 | t       | active |             |         5836 | start_elections\r\n 22389 | test3   | 6783 |       10 | postgres | psql                                       |               |                 |          -1 | 2015-04-30 15:09:41.789485+02 | 2015-04-30 15:09:42.730681+02 | 2015-0\r\n+4-30 15:09:42.730681+02 | 2015-04-30 15:09:42.730684+02 | f       | active |        5836 |         5836 | ALTER TABLE bug_architectures_id_seq OWNER TO foreman;\r\n 22389 | test3   | 6210 |       10 | postgres | bdr (6143134531729040619,1,22389,): apply  |               |                 |             | 2015-04-30 14:59:34.140134+02 | 2015-04-30 14:59:34.139366+02 | 2015-0\r\n+4-30 14:59:34.139366+02 | 2015-04-30 15:09:42.745072+02 | t       | active |             |              | bdr_apply: BEGIN origin(source, orig_lsn, timestamp): 0/4ED17F0, 2015-04-30 15:09:42.725165+02\r\n 22389 | test3   | 6209 |       10 | postgres | bdr (6143123558799401289,1,22356,):receive | 10.205.55.104 |                 |       49077 | 2015-04-30 14:59:34.140409+02 |                               |\r\n+| 2015-04-30 14:59:34.145833+02 | f       | idle   |             |              |\r\n(4 rows)\r\n```\r\n\r\non the first node that runs the import and on the second:\r\n\r\n```\r\ntest3=# select * from pg_stat_activity where datname='test3';\r\n datid | datname |  pid  | usesysid | usename  |             application_name              | client_addr | client_hostname | client_port |         backend_start         |          xact_start           |\r\n+query_start          |         state_change          | waiting | state  | backend_xid | backend_xmin |                                             query\r\n-------+---------+-------+----------+----------+-------------------------------------------+-------------+-----------------+-------------+-------------------------------+-------------------------------+---------\r\n+----------------------+-------------------------------+---------+--------+-------------+--------------+------------------------------------------------------------------------------------------------\r\n 22356 | test3   | 31464 |       10 | postgres | psql                                      |             |                 |          -1 | 2015-04-30 14:58:43.522683+02 | 2015-04-30 15:11:44.429621+02 | 2015-04-\r\n+30 15:11:44.429621+02 | 2015-04-30 15:11:44.429627+02 | f       | active |             |        14887 | select * from pg_stat_activity where datname='test3';\r\n 22356 | test3   | 31742 |       10 | postgres | bdr (6143123558799401289,1,22356,): perdb |             |                 |             | 2015-04-30 15:04:15.50573+02  |                               | 2015-04-\r\n+30 15:09:42.740142+02 | 2015-04-30 15:09:42.740492+02 | f       | idle   |             |              | get_chunk\r\n 22356 | test3   | 31506 |       10 | postgres | bdr (6143123558799401289,1,22356,): apply |             |                 |             | 2015-04-30 14:59:34.127722+02 |                               | 2015-04-\r\n+30 14:59:34.126665+02 | 2015-04-30 15:09:42.722663+02 | f       | idle   |             |              | bdr_apply: BEGIN origin(source, orig_lsn, timestamp): 0/4B6C090, 2015-04-30 15:09:42.713372+02\r\n(3 rows)\r\n```\r\n\r\nI'm currently using these packages:\r\n\r\npostgresql-bdr94-2ndquadrant-redhat-1.0-2.noarch\r\npostgresql-bdr94-9.4.1_bdr2-1_2ndQuadrant.el6.x86_64\r\npostgresql-bdr94-bdr-0.9.0-1_2ndQuadrant.el6.x86_64\r\npostgresql-bdr94-contrib-9.4.1_bdr2-1_2ndQuadrant.el6.x86_64\r\npostgresql-bdr94-libs-9.4.1_bdr2-1_2ndQuadrant.el6.x86_64\r\npostgresql-bdr94-server-9.4.1_bdr2-1_2ndQuadrant.el6.x86_64\r\n\r\nAnything I can provide to debug this further?"},"comment":{"url":"https://api.github.com/repos/2ndQuadrant/bdr/issues/comments/98768832","html_url":"https://github.com/2ndQuadrant/bdr/issues/64#issuecomment-98768832","issue_url":"https://api.github.com/repos/2ndQuadrant/bdr/issues/64","id":98768832,"user":{"login":"agx","id":2052773,"avatar_url":"https://avatars.githubusercontent.com/u/2052773?v=3","gravatar_id":"","url":"https://api.github.com/users/agx","html_url":"https://github.com/agx","followers_url":"https://api.github.com/users/agx/followers","following_url":"https://api.github.com/users/agx/following{/other_user}","gists_url":"https://api.github.com/users/agx/gists{/gist_id}","starred_url":"https://api.github.com/users/agx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agx/subscriptions","organizations_url":"https://api.github.com/users/agx/orgs","repos_url":"https://api.github.com/users/agx/repos","events_url":"https://api.github.com/users/agx/events{/privacy}","received_events_url":"https://api.github.com/users/agx/received_events","type":"User","site_admin":false},"created_at":"2015-05-04T16:11:04Z","updated_at":"2015-05-04T16:11:04Z","body":"On Thu, Apr 30, 2015 at 12:41:13PM -0700, Alvaro Herrera wrote:\n> The catalog bdr.bdr_queued_commands should contain the commands as they are sent to the remote servers for replication. Can you eyeball the contents and see if anything is amiss?  If there's a bug in DDL deparsing, it would probably show up as something that has a different effect in the remote servers, or even as an invalid command.\n\nHere you go:\n\n```\ntest10=# select * from bdr.bdr_queued_commands;\n    lsn    |           queued_at           | perpetrator |   command_tag    |                                                                                                                                                                                       command                                                                                                                                                                                       \n-----------+-------------------------------+-------------+------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n 0/6648000 | 2015-05-04 17:57:55.552915+02 | postgres    | CREATE EXTENSION | CREATE EXTENSION  bdr SCHEMA pg_catalog\n 0/6674730 | 2015-05-04 17:58:31.56918+02  | postgres    | SELECT           | SELECT bdr.bdr_connections_changed()\n 0/6690E20 | 2015-05-04 17:59:50.775841+02 | postgres    | COMMENT          | COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'\n 0/6691088 | 2015-05-04 17:59:50.783485+02 | postgres    | CREATE TABLE     | CREATE  TABLE  public.bug_architectures (id pg_catalog.int4  NOT NULL , name pg_catalog.\"varchar\"(255) DEFAULT NULL::character varying NOT NULL COLLATE pg_catalog.\"default\", created_at pg_catalog.\"timestamp\"  NOT NULL , updated_at pg_catalog.\"timestamp\"  NOT NULL , hosts_count pg_catalog.int4 DEFAULT 0  , hostgroups_count pg_catalog.int4 DEFAULT 0  )  WITH (oids=OFF)  \n 0/6691088 | 2015-05-04 17:59:50.783485+02 | postgres    | CREATE TRIGGER   | CREATE  TRIGGER truncate_trigger AFTER TRUNCATE ON public.bug_architectures   FOR EACH STATEMENT  EXECUTE PROCEDURE bdr.queue_truncate()\n 0/6694770 | 2015-05-04 17:59:51.025175+02 | postgres    | ALTER TABLE      | ALTER TABLE  public.bug_architectures OWNER TO foreman\n 0/6698890 | 2015-05-04 17:59:51.483309+02 | postgres    | CREATE SEQUENCE  | CREATE  SEQUENCE public.bug_architectures_id_seq CACHE 1 NO CYCLE INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 RESTART 1 USING bdr\n(7 rows)\n```\n\nI can't spot anything obviously wrong here. Let me know if I can provide\nfurther info.\nCheers,\n -- Guido\n"}}