{"action":"created","comment":{"url":"https://api.github.com/repos/greenplum-db/gpdb/pulls/comments/232548961","pull_request_review_id":173768409,"id":232548961,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMjU0ODk2MQ==","diff_hunk":"@@ -0,0 +1,1325 @@\n+#include \"postgres.h\"\n+#include \"fmgr.h\"\n+#include \"funcapi.h\"\n+\n+#include \"access/extprotocol.h\"\n+#include \"access/fileam.h\"\n+#include \"catalog/pg_proc.h\"\n+#include \"commands/tablecmds.h\"\n+#include \"commands/extension.h\"\n+#include \"utils/array.h\"\n+#include \"utils/builtins.h\"\n+#include \"utils/guc.h\"\n+#include \"utils/memutils.h\"\n+#include <inttypes.h>\n+\n+#include \"ossapi.h\"\n+#include \"cdb/cdbvars.h\"\n+\n+#include \"decompress_reader.h\"\n+#include \"compress_writer.h\"\n+\n+#define MAX_DELIMITER_ARRARY_LEN\t4\n+\n+static void list_oss_file(ext_oss_t * myData);\n+static List *list_ossfiles_usesegid(ext_oss_t * myData);\n+\n+static void AsyncSourceClose(void *selfp);\n+static size_t AsyncSourceRead(void *selfp, void *buffer, size_t request_len);\n+static void CreateAsyncOssSource(ext_oss_t * self);\n+static void *AsyncOssSourceMain(void *arg);\n+static void CreateOssSource(ext_oss_t *self);\n+\n+static size_t SourceWrite(void *selfp, void *buffer, size_t request_len);\n+static void WriteSourceClose(void *selfp);\n+static void CreateOssWriteSource(ext_oss_t * self);\n+static void flush_and_switch_to_next_file(ext_oss_t  *myData);\n+static void flush_ossfile(ext_oss_t  *myData);\n+static bool is_oss_protocol(char *protocol);\n+static char *truncate_options(const char *url_with_options);\n+static bool oss_isblank(const char c);\n+static char *find_delimiter(const char *url_with_options);\n+static char *get_opt_oss(const char *url, const char *key);\n+static ext_oss_t *parse_oss_protocol(Relation rel, char *url, bool is_export);\n+static void free_data(ext_oss_t *myData);\n+\n+/* Do the module magic dance */\n+PG_MODULE_MAGIC; \n+PG_FUNCTION_INFO_V1(oss_import);\n+PG_FUNCTION_INFO_V1(oss_export);\n+PG_FUNCTION_INFO_V1(oss_validate_urls);\n+\n+\n+Datum\t\toss_import(PG_FUNCTION_ARGS);\n+Datum\t\toss_export(PG_FUNCTION_ARGS);\n+Datum\t\toss_validate_urls(PG_FUNCTION_ARGS);\n+\n+/*\n+ * Import data into GPDB.\n+ */\n+Datum\n+oss_import(PG_FUNCTION_ARGS)\n+{\n+\text_oss_t  *myData;\n+\tchar\t   *data;\n+\tint\t\t\tdatlen;\n+\tsize_t\t\tnread = 0;\n+\tstatic bool init_env = false;\n+\n+\t/* Must be called via the external table format manager */\n+\tif (!CALLED_AS_EXTPROTOCOL(fcinfo))\n+\t\telog(ERROR, \"extprotocol_import: not called by external protocol manager\");\n+\n+\t/* Get our internal description of the protocol */\n+\tmyData = (ext_oss_t *) EXTPROTOCOL_GET_USER_CTX(fcinfo);\n+\n+\tif (EXTPROTOCOL_IS_LAST_CALL(fcinfo))\n+\t{\n+\t\tif (myData)\n+\t\t{\n+\t\t\tfree_data(myData);\n+\t\t}\n+\n+\t\tPG_RETURN_INT32(0);\n+\t}\n+\n+\tif (myData == NULL)\n+\t{\n+\t\tchar\t   *url_with_options = EXTPROTOCOL_GET_URL(fcinfo);\n+\t\tRelation\trel = EXTPROTOCOL_GET_RELATION(fcinfo);\n+\n+\t\tif (init_env == false)\n+\t\t{\n+\t\t\toss_env_init();\n+\t\t\tinit_env = true;\n+\t\t}\n+\n+\t\tmyData = parse_oss_protocol(rel, url_with_options, false);\n+\t\tif (is_oss_protocol(myData->protocol) == false)\n+\t\t\telog(ERROR, \"internal error: oss_ext called with a different protocol\");\n+\n+\t\tlist_oss_file(myData);\n+\n+\t\toss_next_file(myData);\n+\n+\t\tif (myData->currentfile == NULL)\n+\t\t{\n+\t\t\t;\n+\t\t}\n+\t\telse if (myData->async == true)\n+\t\t{\n+\t\t\tCreateAsyncOssSource(myData);\n+\t\t}\n+\t\telse if (myData->async == false)\n+\t\t{\n+\t\t\tCreateOssSource(myData);\n+\t\t}\n+\n+\t\tEXTPROTOCOL_SET_USER_CTX(fcinfo, myData);","path":"gpAux/extensions/aliyun_oss_ext/oss_ext.c","position":118,"original_position":118,"commit_id":"e9da37013be259fea269f7b11c78b27bcbda244f","original_commit_id":"e9da37013be259fea269f7b11c78b27bcbda244f","user":{"login":"wjzeng","id":10137513,"node_id":"MDQ6VXNlcjEwMTM3NTEz","avatar_url":"https://avatars3.githubusercontent.com/u/10137513?v=4","gravatar_id":"","url":"https://api.github.com/users/wjzeng","html_url":"https://github.com/wjzeng","followers_url":"https://api.github.com/users/wjzeng/followers","following_url":"https://api.github.com/users/wjzeng/following{/other_user}","gists_url":"https://api.github.com/users/wjzeng/gists{/gist_id}","starred_url":"https://api.github.com/users/wjzeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjzeng/subscriptions","organizations_url":"https://api.github.com/users/wjzeng/orgs","repos_url":"https://api.github.com/users/wjzeng/repos","events_url":"https://api.github.com/users/wjzeng/events{/privacy}","received_events_url":"https://api.github.com/users/wjzeng/received_events","type":"User","site_admin":false},"body":"thanks, i will fix that.","created_at":"2018-11-12T06:55:20Z","updated_at":"2018-11-12T06:55:20Z","html_url":"https://github.com/greenplum-db/gpdb/pull/6175#discussion_r232548961","pull_request_url":"https://api.github.com/repos/greenplum-db/gpdb/pulls/6175","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/greenplum-db/gpdb/pulls/comments/232548961"},"html":{"href":"https://github.com/greenplum-db/gpdb/pull/6175#discussion_r232548961"},"pull_request":{"href":"https://api.github.com/repos/greenplum-db/gpdb/pulls/6175"}},"in_reply_to_id":232126084},"pull_request":{"url":"https://api.github.com/repos/greenplum-db/gpdb/pulls/6175","id":229030220,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5MDMwMjIw","html_url":"https://github.com/greenplum-db/gpdb/pull/6175","diff_url":"https://github.com/greenplum-db/gpdb/pull/6175.diff","patch_url":"https://github.com/greenplum-db/gpdb/pull/6175.patch","issue_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/6175","number":6175,"state":"open","locked":false,"title":"[Feature] #6174 oss_ext read or write data from aliyun oss","user":{"login":"wjzeng","id":10137513,"node_id":"MDQ6VXNlcjEwMTM3NTEz","avatar_url":"https://avatars3.githubusercontent.com/u/10137513?v=4","gravatar_id":"","url":"https://api.github.com/users/wjzeng","html_url":"https://github.com/wjzeng","followers_url":"https://api.github.com/users/wjzeng/followers","following_url":"https://api.github.com/users/wjzeng/following{/other_user}","gists_url":"https://api.github.com/users/wjzeng/gists{/gist_id}","starred_url":"https://api.github.com/users/wjzeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjzeng/subscriptions","organizations_url":"https://api.github.com/users/wjzeng/orgs","repos_url":"https://api.github.com/users/wjzeng/repos","events_url":"https://api.github.com/users/wjzeng/events{/privacy}","received_events_url":"https://api.github.com/users/wjzeng/received_events","type":"User","site_admin":false},"body":"HI team\r\n\r\nI want to submit an external table oss_ext, let greenplum user can reads and writes the data on aliyun oss.\r\n\r\noss_ext already open source to aliyun github https://github.com/aliyun/oss_ext\r\n\r\nI will submit to gpdb github soon.\r\n\r\nlooking forward to the team's response.","created_at":"2018-11-07T13:39:17Z","updated_at":"2018-11-12T06:55:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"687d1aecedf2b0326b962c23c329a54b125ab555","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/greenplum-db/gpdb/pulls/6175/commits","review_comments_url":"https://api.github.com/repos/greenplum-db/gpdb/pulls/6175/comments","review_comment_url":"https://api.github.com/repos/greenplum-db/gpdb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/6175/comments","statuses_url":"https://api.github.com/repos/greenplum-db/gpdb/statuses/e9da37013be259fea269f7b11c78b27bcbda244f","head":{"label":"wjzeng:feature_oss_ext_read_or_write_data_from_aliyun_oss_issue6174","ref":"feature_oss_ext_read_or_write_data_from_aliyun_oss_issue6174","sha":"e9da37013be259fea269f7b11c78b27bcbda244f","user":{"login":"wjzeng","id":10137513,"node_id":"MDQ6VXNlcjEwMTM3NTEz","avatar_url":"https://avatars3.githubusercontent.com/u/10137513?v=4","gravatar_id":"","url":"https://api.github.com/users/wjzeng","html_url":"https://github.com/wjzeng","followers_url":"https://api.github.com/users/wjzeng/followers","following_url":"https://api.github.com/users/wjzeng/following{/other_user}","gists_url":"https://api.github.com/users/wjzeng/gists{/gist_id}","starred_url":"https://api.github.com/users/wjzeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjzeng/subscriptions","organizations_url":"https://api.github.com/users/wjzeng/orgs","repos_url":"https://api.github.com/users/wjzeng/repos","events_url":"https://api.github.com/users/wjzeng/events{/privacy}","received_events_url":"https://api.github.com/users/wjzeng/received_events","type":"User","site_admin":false},"repo":{"id":156550183,"node_id":"MDEwOlJlcG9zaXRvcnkxNTY1NTAxODM=","name":"gpdb","full_name":"wjzeng/gpdb","private":false,"owner":{"login":"wjzeng","id":10137513,"node_id":"MDQ6VXNlcjEwMTM3NTEz","avatar_url":"https://avatars3.githubusercontent.com/u/10137513?v=4","gravatar_id":"","url":"https://api.github.com/users/wjzeng","html_url":"https://github.com/wjzeng","followers_url":"https://api.github.com/users/wjzeng/followers","following_url":"https://api.github.com/users/wjzeng/following{/other_user}","gists_url":"https://api.github.com/users/wjzeng/gists{/gist_id}","starred_url":"https://api.github.com/users/wjzeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjzeng/subscriptions","organizations_url":"https://api.github.com/users/wjzeng/orgs","repos_url":"https://api.github.com/users/wjzeng/repos","events_url":"https://api.github.com/users/wjzeng/events{/privacy}","received_events_url":"https://api.github.com/users/wjzeng/received_events","type":"User","site_admin":false},"html_url":"https://github.com/wjzeng/gpdb","description":"Greenplum Database","fork":true,"url":"https://api.github.com/repos/wjzeng/gpdb","forks_url":"https://api.github.com/repos/wjzeng/gpdb/forks","keys_url":"https://api.github.com/repos/wjzeng/gpdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wjzeng/gpdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wjzeng/gpdb/teams","hooks_url":"https://api.github.com/repos/wjzeng/gpdb/hooks","issue_events_url":"https://api.github.com/repos/wjzeng/gpdb/issues/events{/number}","events_url":"https://api.github.com/repos/wjzeng/gpdb/events","assignees_url":"https://api.github.com/repos/wjzeng/gpdb/assignees{/user}","branches_url":"https://api.github.com/repos/wjzeng/gpdb/branches{/branch}","tags_url":"https://api.github.com/repos/wjzeng/gpdb/tags","blobs_url":"https://api.github.com/repos/wjzeng/gpdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wjzeng/gpdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wjzeng/gpdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/wjzeng/gpdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wjzeng/gpdb/statuses/{sha}","languages_url":"https://api.github.com/repos/wjzeng/gpdb/languages","stargazers_url":"https://api.github.com/repos/wjzeng/gpdb/stargazers","contributors_url":"https://api.github.com/repos/wjzeng/gpdb/contributors","subscribers_url":"https://api.github.com/repos/wjzeng/gpdb/subscribers","subscription_url":"https://api.github.com/repos/wjzeng/gpdb/subscription","commits_url":"https://api.github.com/repos/wjzeng/gpdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/wjzeng/gpdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/wjzeng/gpdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/wjzeng/gpdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/wjzeng/gpdb/contents/{+path}","compare_url":"https://api.github.com/repos/wjzeng/gpdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wjzeng/gpdb/merges","archive_url":"https://api.github.com/repos/wjzeng/gpdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wjzeng/gpdb/downloads","issues_url":"https://api.github.com/repos/wjzeng/gpdb/issues{/number}","pulls_url":"https://api.github.com/repos/wjzeng/gpdb/pulls{/number}","milestones_url":"https://api.github.com/repos/wjzeng/gpdb/milestones{/number}","notifications_url":"https://api.github.com/repos/wjzeng/gpdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wjzeng/gpdb/labels{/name}","releases_url":"https://api.github.com/repos/wjzeng/gpdb/releases{/id}","deployments_url":"https://api.github.com/repos/wjzeng/gpdb/deployments","created_at":"2018-11-07T13:25:37Z","updated_at":"2018-11-07T13:26:11Z","pushed_at":"2018-11-08T08:57:48Z","git_url":"git://github.com/wjzeng/gpdb.git","ssh_url":"git@github.com:wjzeng/gpdb.git","clone_url":"https://github.com/wjzeng/gpdb.git","svn_url":"https://github.com/wjzeng/gpdb","homepage":"http://greenplum.org","size":329520,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"greenplum-db:master","ref":"master","sha":"b5078cc71037d37363a1848f48fd40442e4f67bb","user":{"login":"greenplum-db","id":14097842,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MDk3ODQy","avatar_url":"https://avatars2.githubusercontent.com/u/14097842?v=4","gravatar_id":"","url":"https://api.github.com/users/greenplum-db","html_url":"https://github.com/greenplum-db","followers_url":"https://api.github.com/users/greenplum-db/followers","following_url":"https://api.github.com/users/greenplum-db/following{/other_user}","gists_url":"https://api.github.com/users/greenplum-db/gists{/gist_id}","starred_url":"https://api.github.com/users/greenplum-db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greenplum-db/subscriptions","organizations_url":"https://api.github.com/users/greenplum-db/orgs","repos_url":"https://api.github.com/users/greenplum-db/repos","events_url":"https://api.github.com/users/greenplum-db/events{/privacy}","received_events_url":"https://api.github.com/users/greenplum-db/received_events","type":"Organization","site_admin":false},"repo":{"id":44781140,"node_id":"MDEwOlJlcG9zaXRvcnk0NDc4MTE0MA==","name":"gpdb","full_name":"greenplum-db/gpdb","private":false,"owner":{"login":"greenplum-db","id":14097842,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MDk3ODQy","avatar_url":"https://avatars2.githubusercontent.com/u/14097842?v=4","gravatar_id":"","url":"https://api.github.com/users/greenplum-db","html_url":"https://github.com/greenplum-db","followers_url":"https://api.github.com/users/greenplum-db/followers","following_url":"https://api.github.com/users/greenplum-db/following{/other_user}","gists_url":"https://api.github.com/users/greenplum-db/gists{/gist_id}","starred_url":"https://api.github.com/users/greenplum-db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greenplum-db/subscriptions","organizations_url":"https://api.github.com/users/greenplum-db/orgs","repos_url":"https://api.github.com/users/greenplum-db/repos","events_url":"https://api.github.com/users/greenplum-db/events{/privacy}","received_events_url":"https://api.github.com/users/greenplum-db/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/greenplum-db/gpdb","description":"Greenplum Database","fork":false,"url":"https://api.github.com/repos/greenplum-db/gpdb","forks_url":"https://api.github.com/repos/greenplum-db/gpdb/forks","keys_url":"https://api.github.com/repos/greenplum-db/gpdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/greenplum-db/gpdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/greenplum-db/gpdb/teams","hooks_url":"https://api.github.com/repos/greenplum-db/gpdb/hooks","issue_events_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/events{/number}","events_url":"https://api.github.com/repos/greenplum-db/gpdb/events","assignees_url":"https://api.github.com/repos/greenplum-db/gpdb/assignees{/user}","branches_url":"https://api.github.com/repos/greenplum-db/gpdb/branches{/branch}","tags_url":"https://api.github.com/repos/greenplum-db/gpdb/tags","blobs_url":"https://api.github.com/repos/greenplum-db/gpdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/greenplum-db/gpdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/greenplum-db/gpdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/greenplum-db/gpdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/greenplum-db/gpdb/statuses/{sha}","languages_url":"https://api.github.com/repos/greenplum-db/gpdb/languages","stargazers_url":"https://api.github.com/repos/greenplum-db/gpdb/stargazers","contributors_url":"https://api.github.com/repos/greenplum-db/gpdb/contributors","subscribers_url":"https://api.github.com/repos/greenplum-db/gpdb/subscribers","subscription_url":"https://api.github.com/repos/greenplum-db/gpdb/subscription","commits_url":"https://api.github.com/repos/greenplum-db/gpdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/greenplum-db/gpdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/greenplum-db/gpdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/greenplum-db/gpdb/contents/{+path}","compare_url":"https://api.github.com/repos/greenplum-db/gpdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/greenplum-db/gpdb/merges","archive_url":"https://api.github.com/repos/greenplum-db/gpdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/greenplum-db/gpdb/downloads","issues_url":"https://api.github.com/repos/greenplum-db/gpdb/issues{/number}","pulls_url":"https://api.github.com/repos/greenplum-db/gpdb/pulls{/number}","milestones_url":"https://api.github.com/repos/greenplum-db/gpdb/milestones{/number}","notifications_url":"https://api.github.com/repos/greenplum-db/gpdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/greenplum-db/gpdb/labels{/name}","releases_url":"https://api.github.com/repos/greenplum-db/gpdb/releases{/id}","deployments_url":"https://api.github.com/repos/greenplum-db/gpdb/deployments","created_at":"2015-10-23T00:25:17Z","updated_at":"2018-11-12T04:52:36Z","pushed_at":"2018-11-12T06:40:31Z","git_url":"git://github.com/greenplum-db/gpdb.git","ssh_url":"git@github.com:greenplum-db/gpdb.git","clone_url":"https://github.com/greenplum-db/gpdb.git","svn_url":"https://github.com/greenplum-db/gpdb","homepage":"http://greenplum.org","size":330936,"stargazers_count":2791,"watchers_count":2791,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":845,"mirror_url":null,"archived":false,"open_issues_count":242,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":845,"open_issues":242,"watchers":2791,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/greenplum-db/gpdb/pulls/6175"},"html":{"href":"https://github.com/greenplum-db/gpdb/pull/6175"},"issue":{"href":"https://api.github.com/repos/greenplum-db/gpdb/issues/6175"},"comments":{"href":"https://api.github.com/repos/greenplum-db/gpdb/issues/6175/comments"},"review_comments":{"href":"https://api.github.com/repos/greenplum-db/gpdb/pulls/6175/comments"},"review_comment":{"href":"https://api.github.com/repos/greenplum-db/gpdb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/greenplum-db/gpdb/pulls/6175/commits"},"statuses":{"href":"https://api.github.com/repos/greenplum-db/gpdb/statuses/e9da37013be259fea269f7b11c78b27bcbda244f"}},"author_association":"NONE"}}
{"actor":{"display_login":"wjzeng"}}