{"action":"created","issue":{"url":"https://api.github.com/repos/postgres-x2/postgres-x2/issues/266","labels_url":"https://api.github.com/repos/postgres-x2/postgres-x2/issues/266/labels{/name}","comments_url":"https://api.github.com/repos/postgres-x2/postgres-x2/issues/266/comments","events_url":"https://api.github.com/repos/postgres-x2/postgres-x2/issues/266/events","html_url":"https://github.com/postgres-x2/postgres-x2/issues/266","id":97394120,"number":266,"title":"data inconsistent under concurrent update","user":{"login":"249159658","id":11515965,"avatar_url":"https://avatars.githubusercontent.com/u/11515965?v=3","gravatar_id":"","url":"https://api.github.com/users/249159658","html_url":"https://github.com/249159658","followers_url":"https://api.github.com/users/249159658/followers","following_url":"https://api.github.com/users/249159658/following{/other_user}","gists_url":"https://api.github.com/users/249159658/gists{/gist_id}","starred_url":"https://api.github.com/users/249159658/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/249159658/subscriptions","organizations_url":"https://api.github.com/users/249159658/orgs","repos_url":"https://api.github.com/users/249159658/repos","events_url":"https://api.github.com/users/249159658/events{/privacy}","received_events_url":"https://api.github.com/users/249159658/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/postgres-x2/postgres-x2/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/postgres-x2/postgres-x2/labels/duplicate","name":"duplicate","color":"cccccc"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/postgres-x2/postgres-x2/milestones/8","html_url":"https://github.com/postgres-x2/postgres-x2/milestones/1.2.2","labels_url":"https://api.github.com/repos/postgres-x2/postgres-x2/milestones/8/labels","id":1139244,"number":8,"title":"1.2.2","description":"","creator":{"login":"koichi-szk","id":985469,"avatar_url":"https://avatars.githubusercontent.com/u/985469?v=3","gravatar_id":"","url":"https://api.github.com/users/koichi-szk","html_url":"https://github.com/koichi-szk","followers_url":"https://api.github.com/users/koichi-szk/followers","following_url":"https://api.github.com/users/koichi-szk/following{/other_user}","gists_url":"https://api.github.com/users/koichi-szk/gists{/gist_id}","starred_url":"https://api.github.com/users/koichi-szk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koichi-szk/subscriptions","organizations_url":"https://api.github.com/users/koichi-szk/orgs","repos_url":"https://api.github.com/users/koichi-szk/repos","events_url":"https://api.github.com/users/koichi-szk/events{/privacy}","received_events_url":"https://api.github.com/users/koichi-szk/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":21,"state":"open","created_at":"2015-05-29T05:58:20Z","updated_at":"2015-08-03T09:16:03Z","due_on":"2015-08-30T15:00:00Z","closed_at":null},"comments":28,"created_at":"2015-07-27T06:08:48Z","updated_at":"2015-08-05T04:33:17Z","closed_at":null,"body":"host: centos 6.5\r\n1 GTM,1 coordinator,4 datanode configured in one host.\r\n\r\npostgres=# select * from pgxc_node;\r\n  node_name  | node_type | node_port | node_host | nodeis_primary | nodeis_preferre\r\nd |   node_id   \r\n-------------+-----------+-----------+-----------+----------------+----------------\r\n--+-------------\r\n coordinator | C         |      5432 | localhost | f              | f              \r\n  |  1416591337\r\n datanode1   | D         |      5433 | 127.0.0.1 | f              | f              \r\n  |   888802358\r\n datanode2   | D         |      5434 | 127.0.0.1 | f              | f              \r\n  |  -905831925\r\n datanode3   | D         |      5435 | 127.0.0.1 | f              | f              \r\n  | -1894792127\r\n datanode4   | D         |      5436 | 127.0.0.1 | f              | f              \r\n  | -1307323892\r\n(5 rows)\r\n\r\npostgres=# \\d+ test\r\n                         Table \"public.test\"\r\n Column |  Type   | Modifiers | Storage | Stats target | Description \r\n--------+---------+-----------+---------+--------------+-------------\r\n a      | integer |           | plain   |              | \r\n b      | integer |           | plain   |              | \r\n c      | integer |           | plain   |              | \r\nIndexes:\r\n    \"test_a_key\" UNIQUE CONSTRAINT, btree (a)\r\nHas OIDs: no\r\nDistribute By: HASH(a)\r\nLocation Nodes: ALL DATANODES\r\n\r\npostgres=# select * from test;\r\n a |   b    |   c    \r\n---+--------+--------\r\n 1 | 130000 | 260000\r\n(1 row)\r\n\r\nWhile 20 concurrent update running, select return 2 records,see below:\r\npostgres=# select xmin,xmax,* from test ;\r\n  xmin  |  xmax  | a |   b    |   c    \r\n--------+--------+---+--------+--------\r\n 126209 | 126213 | 1 | 114208 | 228416\r\n 126206 | 126214 | 1 | 114210 | 228420\r\n(2 rows)\r\n\r\neach update is :\r\nupdate test set b=b+1,c=c+2 where a = 1;\r\nupdate test set b=b+1,c=c+2 where a = 1;\r\nupdate test set b=b+1,c=c+2 where a = 1;\r\nupdate test set b=b+1,c=c+2 where a = 1;\r\nupdate test set b=b+1,c=c+2 where a = 1;\r\n..........\r\nrepeat 10000  times.\r\n\r\nupdate command:\r\n./bin/psql -U pgxl -d postgres < test.sql > log1 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log2 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log3 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log4 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log5 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log6 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log7 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log8 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log9 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log10 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log11 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log12 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log13 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log14 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log15 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log16 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log17 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log18 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log19 &\r\n./bin/psql -U pgxl -d postgres < test.sql > log20 &\r\n\r\nmy questoin is: why a unique key return 2 records?\r\n"},"comment":{"url":"https://api.github.com/repos/postgres-x2/postgres-x2/issues/comments/127842333","html_url":"https://github.com/postgres-x2/postgres-x2/issues/266#issuecomment-127842333","issue_url":"https://api.github.com/repos/postgres-x2/postgres-x2/issues/266","id":127842333,"user":{"login":"koichi-szk","id":985469,"avatar_url":"https://avatars.githubusercontent.com/u/985469?v=3","gravatar_id":"","url":"https://api.github.com/users/koichi-szk","html_url":"https://github.com/koichi-szk","followers_url":"https://api.github.com/users/koichi-szk/followers","following_url":"https://api.github.com/users/koichi-szk/following{/other_user}","gists_url":"https://api.github.com/users/koichi-szk/gists{/gist_id}","starred_url":"https://api.github.com/users/koichi-szk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koichi-szk/subscriptions","organizations_url":"https://api.github.com/users/koichi-szk/orgs","repos_url":"https://api.github.com/users/koichi-szk/repos","events_url":"https://api.github.com/users/koichi-szk/events{/privacy}","received_events_url":"https://api.github.com/users/koichi-szk/received_events","type":"User","site_admin":false},"created_at":"2015-08-05T04:33:17Z","updated_at":"2015-08-05T04:33:17Z","body":"The test with the latest fix patch worked well.    The fix should go to all the relevant branches, master, REL1_2_STABLE and REL1_1_STABLE.\r\n"}}