{"action":"created","issue":{"url":"https://api.github.com/repos/postgres-x2/postgres-x2/issues/255","labels_url":"https://api.github.com/repos/postgres-x2/postgres-x2/issues/255/labels{/name}","comments_url":"https://api.github.com/repos/postgres-x2/postgres-x2/issues/255/comments","events_url":"https://api.github.com/repos/postgres-x2/postgres-x2/issues/255/events","html_url":"https://github.com/postgres-x2/postgres-x2/issues/255","id":91982192,"number":255,"title":"Cross-node updated data resulted in inconsistent data","user":{"login":"osdba","id":982355,"avatar_url":"https://avatars.githubusercontent.com/u/982355?v=3","gravatar_id":"","url":"https://api.github.com/users/osdba","html_url":"https://github.com/osdba","followers_url":"https://api.github.com/users/osdba/followers","following_url":"https://api.github.com/users/osdba/following{/other_user}","gists_url":"https://api.github.com/users/osdba/gists{/gist_id}","starred_url":"https://api.github.com/users/osdba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osdba/subscriptions","organizations_url":"https://api.github.com/users/osdba/orgs","repos_url":"https://api.github.com/users/osdba/repos","events_url":"https://api.github.com/users/osdba/events{/privacy}","received_events_url":"https://api.github.com/users/osdba/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-30T04:58:50Z","updated_at":"2015-07-01T07:54:46Z","closed_at":null,"body":"### Environment：\r\n\r\n* pgxc version: 1.2.1\r\n* One gtm\r\n* Three Datanodes:dn1,dn2,dn3\r\n* Three Coordinate nodes: cd1,cd2,cd3\r\n\r\n### Create test table\r\n\r\n```\r\ncreate table test02(id int primary key, x int);\r\ninsert into test02  select id as id1, id as id2 from (select generate_series(1,20) as id) t;\r\n```\r\n\r\n### Test\r\n\r\n**Note**:  id = 6 row in dn1 node, id=7 row in dn2 node, then begin update two data cross node  cd1 and cd2. \r\n\r\nIn cd1 node：\r\n\r\n```\r\nbegin;\r\nupdate test02 set x=16 where id=6;\r\n```\r\n\r\nin cd2：\r\n\r\n```\r\nbegin;\r\nupdate test02 set x=27 where id=7;\r\n```\r\n\r\ngoto cd1 node：\r\n\r\n```\r\nupdate test02 set x=17 where id=7;\r\n```\r\nyou can see aboved update statement blocked.\r\n\r\ngoto cd2 node：\r\n\r\n```\r\nupdate test02 set x=16 where id=6;\r\n```\r\n\r\nStrange things happened: above update not block. then you execute \"commit\", blocked statement in cd1 node not blocking.\r\n\r\ngoto cd1 node execute 'commit'.\r\n\r\nthen you query data in test02, you can see **two row data** that id=6:\r\n\r\n```\r\npostgres=# select * from test02;\r\n id | x\r\n----+----\r\n ...\r\n ...\r\n 18 | 18\r\n 19 | 19\r\n  6 | 16\r\n  6 | 16\r\n(21 rows)\r\n\r\npostgres=# select * from test02 where x=16;\r\n id | x\r\n----+----\r\n  6 | 16\r\n  6 | 16\r\n 16 | 16\r\n(3 rows)\r\n```\r\n**why can see two row(id=6), id is primary key?**\r\n\r\nbut if you query data using distributed key, you can see only on row:\r\n\r\n```\r\npostgres=# select * from test02 where id=6;\r\n id | x\r\n----+----\r\n  6 | 16\r\n(1 row)\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/postgres-x2/postgres-x2/issues/comments/117516329","html_url":"https://github.com/postgres-x2/postgres-x2/issues/255#issuecomment-117516329","issue_url":"https://api.github.com/repos/postgres-x2/postgres-x2/issues/255","id":117516329,"user":{"login":"Jasonysli","id":9444459,"avatar_url":"https://avatars.githubusercontent.com/u/9444459?v=3","gravatar_id":"","url":"https://api.github.com/users/Jasonysli","html_url":"https://github.com/Jasonysli","followers_url":"https://api.github.com/users/Jasonysli/followers","following_url":"https://api.github.com/users/Jasonysli/following{/other_user}","gists_url":"https://api.github.com/users/Jasonysli/gists{/gist_id}","starred_url":"https://api.github.com/users/Jasonysli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jasonysli/subscriptions","organizations_url":"https://api.github.com/users/Jasonysli/orgs","repos_url":"https://api.github.com/users/Jasonysli/repos","events_url":"https://api.github.com/users/Jasonysli/events{/privacy}","received_events_url":"https://api.github.com/users/Jasonysli/received_events","type":"User","site_admin":false},"created_at":"2015-07-01T07:54:46Z","updated_at":"2015-07-01T07:54:46Z","body":"I use the master code to do the same test, but I got two transactions blocked in step 2. The issue looks cauesed by uncorrect locator, which mean the unblock was sent to a wrong node, so the statement was not blocked.This kind of lock management was the same as PG original."}}