{"action":"created","comment":{"url":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments/37095840","id":37095840,"diff_hunk":"@@ -220,6 +225,118 @@ public void loadSchema(Reader reader, Database db, DdlProceduresToLoad whichProc\n         m_classMatcher.clear();\n     }\n \n+    private void createConflictExportTableDDL(StringBuilder sb, VoltXMLElement node, String tableName) {\n+\n+        sb.append(\"CREATE TABLE \" + tableName + \" (\");\n+        for (VoltXMLElement subnode : node.children) {\n+            // Indexes and constraints are not needed for export table\n+            if (subnode.name.equals(\"columns\")) {\n+                // Insert additional columns to DR conflicts table first\n+                for (String column : ADDITIONAL_COLUMNS) {\n+                    sb.append(column);\n+                    if (column.startsWith(\"TABLE_NAME\")) {\n+                        sb.append(\"(\" + node.attributes.get(\"name\").length() + \" BYTES\" + \")\");\n+                    }\n+                    sb.append(\", \");\n+                }\n+                // Then duplicate all columns of the original table\n+                int columnIdx = 0;\n+                for (VoltXMLElement columnNode : subnode.children) {\n+                    sb.append(columnNode.attributes.get(\"name\") + \" \" + columnNode.attributes.get(\"valuetype\"));\n+                    if (columnNode.attributes.get(\"nullable\").equals(\"false\")) {\n+                        sb.append(\" NOT NULL\");\n+                    }\n+                    columnIdx++;\n+                    if (columnIdx != subnode.children.size()) {\n+                        sb.append(\", \");\n+                    }\n+                }\n+            }\n+        }\n+        sb.append(\");\\n\");\n+        if (node.attributes.containsKey(\"partitioncolumn\")) {\n+            sb.append(\"PARTITION TABLE \" + tableName + \" ON COLUMN \" + node.attributes.get(\"partitioncolumn\") + \";\\n\");\n+        }\n+        sb.append(\"EXPORT TABLE \" + tableName + \" TO STREAM \" + CatalogUtil.DR_CONFLICTS_TABLE_EXPORT_GROUP + \";\\n\");\n+    }\n+\n+    // Generate DDL to create or drop the DR conflict table\n+    // TODO:When DR table supports dynamic schema change, we need also change the schema of conflict table,\n+    //       maybe dropping the old one and recreating a new one is the easiest way.\n+    private String generateDdlForDRConflictsTable(Database currentDB, Database previousDBIfAny) {\n+        VoltXMLElement xmlRoot = m_schema;\n+        StringBuilder sb = new StringBuilder();\n+        for (VoltXMLElement node : xmlRoot.children) {\n+            if (node.name.equals(\"table\")\n+                    && node.attributes.containsKey(\"drTable\") && node.attributes.get(\"drTable\").equalsIgnoreCase(\"ENABLE\")) {\n+                boolean tableAlreadyExist = false;\n+                String drConflictExportTableName = CatalogUtil.DR_CONFLICTS_TABLE_PREFIX + node.attributes.get(\"name\");\n+                // Does the conflict export table already existed?\n+                if (previousDBIfAny != null) {\n+                    tableAlreadyExist = previousDBIfAny.getTables().get(drConflictExportTableName) != null;\n+                } else {\n+                    for (VoltXMLElement element : xmlRoot.children) {\n+                        if (element.name.equals(\"table\")\n+                                && element.attributes.containsKey(\"export\")\n+                                && element.attributes.get(\"name\").equals(drConflictExportTableName)) {\n+                            tableAlreadyExist = true;","path":"src/frontend/org/voltdb/compiler/DDLCompiler.java","position":108,"original_position":108,"commit_id":"6d79c9e80071defb1ffc53b48d10ccce051c448a","original_commit_id":"6d79c9e80071defb1ffc53b48d10ccce051c448a","user":{"login":"afrogers","id":4966215,"avatar_url":"https://avatars.githubusercontent.com/u/4966215?v=3","gravatar_id":"","url":"https://api.github.com/users/afrogers","html_url":"https://github.com/afrogers","followers_url":"https://api.github.com/users/afrogers/followers","following_url":"https://api.github.com/users/afrogers/following{/other_user}","gists_url":"https://api.github.com/users/afrogers/gists{/gist_id}","starred_url":"https://api.github.com/users/afrogers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afrogers/subscriptions","organizations_url":"https://api.github.com/users/afrogers/orgs","repos_url":"https://api.github.com/users/afrogers/repos","events_url":"https://api.github.com/users/afrogers/events{/privacy}","received_events_url":"https://api.github.com/users/afrogers/received_events","type":"User","site_admin":false},"body":"break here","created_at":"2015-08-14T16:59:19Z","updated_at":"2015-08-14T16:59:19Z","html_url":"https://github.com/VoltDB/voltdb/pull/2695#discussion_r37095840","pull_request_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/2695","_links":{"self":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments/37095840"},"html":{"href":"https://github.com/VoltDB/voltdb/pull/2695#discussion_r37095840"},"pull_request":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/2695"}}},"pull_request":{"url":"https://api.github.com/repos/VoltDB/voltdb/pulls/2695","id":42359457,"html_url":"https://github.com/VoltDB/voltdb/pull/2695","diff_url":"https://github.com/VoltDB/voltdb/pull/2695.diff","patch_url":"https://github.com/VoltDB/voltdb/pull/2695.patch","issue_url":"https://api.github.com/repos/VoltDB/voltdb/issues/2695","number":2695,"state":"open","locked":false,"title":"Eng 8780 export conflicts","user":{"login":"luyangco","id":919119,"avatar_url":"https://avatars.githubusercontent.com/u/919119?v=3","gravatar_id":"","url":"https://api.github.com/users/luyangco","html_url":"https://github.com/luyangco","followers_url":"https://api.github.com/users/luyangco/followers","following_url":"https://api.github.com/users/luyangco/following{/other_user}","gists_url":"https://api.github.com/users/luyangco/gists{/gist_id}","starred_url":"https://api.github.com/users/luyangco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luyangco/subscriptions","organizations_url":"https://api.github.com/users/luyangco/orgs","repos_url":"https://api.github.com/users/luyangco/repos","events_url":"https://api.github.com/users/luyangco/events{/privacy}","received_events_url":"https://api.github.com/users/luyangco/received_events","type":"User","site_admin":false},"body":"Generate export table for every DR table when A/A DR is enabled, the export table contains all columns of its correspondent DR table, plus four additional columns for logging DR conflicts purpose.","created_at":"2015-08-13T14:52:28Z","updated_at":"2015-08-14T16:59:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a636f7ef9a37289f97ac532913a73213598083a","assignee":{"login":"afrogers","id":4966215,"avatar_url":"https://avatars.githubusercontent.com/u/4966215?v=3","gravatar_id":"","url":"https://api.github.com/users/afrogers","html_url":"https://github.com/afrogers","followers_url":"https://api.github.com/users/afrogers/followers","following_url":"https://api.github.com/users/afrogers/following{/other_user}","gists_url":"https://api.github.com/users/afrogers/gists{/gist_id}","starred_url":"https://api.github.com/users/afrogers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afrogers/subscriptions","organizations_url":"https://api.github.com/users/afrogers/orgs","repos_url":"https://api.github.com/users/afrogers/repos","events_url":"https://api.github.com/users/afrogers/events{/privacy}","received_events_url":"https://api.github.com/users/afrogers/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/2695/commits","review_comments_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/2695/comments","review_comment_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/VoltDB/voltdb/issues/2695/comments","statuses_url":"https://api.github.com/repos/VoltDB/voltdb/statuses/6d79c9e80071defb1ffc53b48d10ccce051c448a","head":{"label":"VoltDB:ENG-8780-export-conflicts","ref":"ENG-8780-export-conflicts","sha":"6d79c9e80071defb1ffc53b48d10ccce051c448a","user":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"repo":{"id":2445970,"name":"voltdb","full_name":"VoltDB/voltdb","owner":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VoltDB/voltdb","description":"VoltDB","fork":false,"url":"https://api.github.com/repos/VoltDB/voltdb","forks_url":"https://api.github.com/repos/VoltDB/voltdb/forks","keys_url":"https://api.github.com/repos/VoltDB/voltdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VoltDB/voltdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VoltDB/voltdb/teams","hooks_url":"https://api.github.com/repos/VoltDB/voltdb/hooks","issue_events_url":"https://api.github.com/repos/VoltDB/voltdb/issues/events{/number}","events_url":"https://api.github.com/repos/VoltDB/voltdb/events","assignees_url":"https://api.github.com/repos/VoltDB/voltdb/assignees{/user}","branches_url":"https://api.github.com/repos/VoltDB/voltdb/branches{/branch}","tags_url":"https://api.github.com/repos/VoltDB/voltdb/tags","blobs_url":"https://api.github.com/repos/VoltDB/voltdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VoltDB/voltdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VoltDB/voltdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/VoltDB/voltdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VoltDB/voltdb/statuses/{sha}","languages_url":"https://api.github.com/repos/VoltDB/voltdb/languages","stargazers_url":"https://api.github.com/repos/VoltDB/voltdb/stargazers","contributors_url":"https://api.github.com/repos/VoltDB/voltdb/contributors","subscribers_url":"https://api.github.com/repos/VoltDB/voltdb/subscribers","subscription_url":"https://api.github.com/repos/VoltDB/voltdb/subscription","commits_url":"https://api.github.com/repos/VoltDB/voltdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/VoltDB/voltdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/VoltDB/voltdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/VoltDB/voltdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/VoltDB/voltdb/contents/{+path}","compare_url":"https://api.github.com/repos/VoltDB/voltdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VoltDB/voltdb/merges","archive_url":"https://api.github.com/repos/VoltDB/voltdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VoltDB/voltdb/downloads","issues_url":"https://api.github.com/repos/VoltDB/voltdb/issues{/number}","pulls_url":"https://api.github.com/repos/VoltDB/voltdb/pulls{/number}","milestones_url":"https://api.github.com/repos/VoltDB/voltdb/milestones{/number}","notifications_url":"https://api.github.com/repos/VoltDB/voltdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VoltDB/voltdb/labels{/name}","releases_url":"https://api.github.com/repos/VoltDB/voltdb/releases{/id}","created_at":"2011-09-23T18:46:12Z","updated_at":"2015-08-11T08:33:37Z","pushed_at":"2015-08-14T16:45:51Z","git_url":"git://github.com/VoltDB/voltdb.git","ssh_url":"git@github.com:VoltDB/voltdb.git","clone_url":"https://github.com/VoltDB/voltdb.git","svn_url":"https://github.com/VoltDB/voltdb","homepage":"http://community.voltdb.com/","size":880147,"stargazers_count":612,"watchers_count":612,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":180,"mirror_url":null,"open_issues_count":33,"forks":180,"open_issues":33,"watchers":612,"default_branch":"master"}},"base":{"label":"VoltDB:master","ref":"master","sha":"35afe12affe1a1e35e95e6a02d7264fef722849d","user":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"repo":{"id":2445970,"name":"voltdb","full_name":"VoltDB/voltdb","owner":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VoltDB/voltdb","description":"VoltDB","fork":false,"url":"https://api.github.com/repos/VoltDB/voltdb","forks_url":"https://api.github.com/repos/VoltDB/voltdb/forks","keys_url":"https://api.github.com/repos/VoltDB/voltdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VoltDB/voltdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VoltDB/voltdb/teams","hooks_url":"https://api.github.com/repos/VoltDB/voltdb/hooks","issue_events_url":"https://api.github.com/repos/VoltDB/voltdb/issues/events{/number}","events_url":"https://api.github.com/repos/VoltDB/voltdb/events","assignees_url":"https://api.github.com/repos/VoltDB/voltdb/assignees{/user}","branches_url":"https://api.github.com/repos/VoltDB/voltdb/branches{/branch}","tags_url":"https://api.github.com/repos/VoltDB/voltdb/tags","blobs_url":"https://api.github.com/repos/VoltDB/voltdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VoltDB/voltdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VoltDB/voltdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/VoltDB/voltdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VoltDB/voltdb/statuses/{sha}","languages_url":"https://api.github.com/repos/VoltDB/voltdb/languages","stargazers_url":"https://api.github.com/repos/VoltDB/voltdb/stargazers","contributors_url":"https://api.github.com/repos/VoltDB/voltdb/contributors","subscribers_url":"https://api.github.com/repos/VoltDB/voltdb/subscribers","subscription_url":"https://api.github.com/repos/VoltDB/voltdb/subscription","commits_url":"https://api.github.com/repos/VoltDB/voltdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/VoltDB/voltdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/VoltDB/voltdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/VoltDB/voltdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/VoltDB/voltdb/contents/{+path}","compare_url":"https://api.github.com/repos/VoltDB/voltdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VoltDB/voltdb/merges","archive_url":"https://api.github.com/repos/VoltDB/voltdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VoltDB/voltdb/downloads","issues_url":"https://api.github.com/repos/VoltDB/voltdb/issues{/number}","pulls_url":"https://api.github.com/repos/VoltDB/voltdb/pulls{/number}","milestones_url":"https://api.github.com/repos/VoltDB/voltdb/milestones{/number}","notifications_url":"https://api.github.com/repos/VoltDB/voltdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VoltDB/voltdb/labels{/name}","releases_url":"https://api.github.com/repos/VoltDB/voltdb/releases{/id}","created_at":"2011-09-23T18:46:12Z","updated_at":"2015-08-11T08:33:37Z","pushed_at":"2015-08-14T16:45:51Z","git_url":"git://github.com/VoltDB/voltdb.git","ssh_url":"git@github.com:VoltDB/voltdb.git","clone_url":"https://github.com/VoltDB/voltdb.git","svn_url":"https://github.com/VoltDB/voltdb","homepage":"http://community.voltdb.com/","size":880147,"stargazers_count":612,"watchers_count":612,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":180,"mirror_url":null,"open_issues_count":33,"forks":180,"open_issues":33,"watchers":612,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/2695"},"html":{"href":"https://github.com/VoltDB/voltdb/pull/2695"},"issue":{"href":"https://api.github.com/repos/VoltDB/voltdb/issues/2695"},"comments":{"href":"https://api.github.com/repos/VoltDB/voltdb/issues/2695/comments"},"review_comments":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/2695/comments"},"review_comment":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/2695/commits"},"statuses":{"href":"https://api.github.com/repos/VoltDB/voltdb/statuses/6d79c9e80071defb1ffc53b48d10ccce051c448a"}}}}