You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hawq.apache.org by paul-guo- <gi...@git.apache.org> on 2016/08/04 11:54:32 UTC

[GitHub] incubator-hawq pull request #835: HAWQ-980. hawq does not handle guc value w...

GitHub user paul-guo- opened a pull request:

    https://github.com/apache/incubator-hawq/pull/835

    HAWQ-980. hawq does not handle guc value with space properly

    This patch includes pg's code change for split_opts (they call pg_split_opts now).

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/paul-guo-/incubator-hawq test

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-hawq/pull/835.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #835
    
----
commit 8217a5c593c91e080105522e36f6361f850b15a7
Author: Paul Guo <pa...@gmail.com>
Date:   2016-08-04T11:51:11Z

    HAWQ-980. hawq does not handle guc value with space properly

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request #835: HAWQ-980. hawq does not handle guc value w...

Posted by ictmalili <gi...@git.apache.org>.
Github user ictmalili commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/835#discussion_r73816040
  
    --- Diff: src/backend/utils/misc/guc.c ---
    @@ -12216,7 +12216,36 @@ ProcessGUCArray(ArrayType *array, GucSource source)
     		 * GPSQL needs to dispatch the database/user config to segments.
     		 */
     		if (Gp_role == GP_ROLE_DISPATCH)
    -			appendStringInfo(&MyProcPort->override_options, "-c %s=%s ", name, value);
    +		{
    +			unsigned int	 j, start, size;
    +			char			*temp;
    +
    +			size = 256;
    +			temp = guc_malloc(ERROR, size + 8);
    +
    +			j = 0;
    +			for (start = 0; start < strlen(value); ++start)
    +			{
    +				if (j == size)
    +				{
    --- End diff --
    
    I think this part of code has kind of duplication with the code segment in executormgr.c?? Shall we extract this out?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq issue #835: HAWQ-980. hawq does not handle guc value with spa...

Posted by ictmalili <gi...@git.apache.org>.
Github user ictmalili commented on the issue:

    https://github.com/apache/incubator-hawq/pull/835
  
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request #835: HAWQ-980. hawq does not handle guc value w...

Posted by paul-guo- <gi...@git.apache.org>.
Github user paul-guo- commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/835#discussion_r73841829
  
    --- Diff: src/backend/cdb/executormgr.c ---
    @@ -864,29 +864,42 @@ addOneOption(PQExpBufferData *buffer, struct config_generic * guc)
     			{
     				struct config_string *sguc = (struct config_string *) guc;
     				const char *str = *sguc->variable;
    -				int			j,
    -							start,
    -							end;
    -				char		temp[1024];
    +				unsigned int	 j, start, size;
    +				char			*temp;
     
    -				end = strlen(str);
    +				size = 256;
    +				temp = malloc(size + 8);
    +				if (temp == NULL)
    +					ereport(ERROR,
    +							(errcode(ERRCODE_OUT_OF_MEMORY),
    +							 errmsg("out of memory")));
     
     				j = 0;
    -				for (start = 0; start < end; ++start)
    +				for (start = 0; start < strlen(str); ++start)
     				{
    -					if (str[start] == ' ')
    -						continue;
    +					if (j == size)
    +					{
    +						size *= 2;
    +						temp = realloc(temp, size + 8);
    +						if (temp == NULL)
    --- End diff --
    
    Yes. Need to take care of.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq issue #835: HAWQ-980. hawq does not handle guc value with spa...

Posted by wengyanqing <gi...@git.apache.org>.
Github user wengyanqing commented on the issue:

    https://github.com/apache/incubator-hawq/pull/835
  
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request #835: HAWQ-980. hawq does not handle guc value w...

Posted by wengyanqing <gi...@git.apache.org>.
Github user wengyanqing commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/835#discussion_r73815359
  
    --- Diff: src/backend/utils/misc/guc.c ---
    @@ -12216,7 +12216,36 @@ ProcessGUCArray(ArrayType *array, GucSource source)
     		 * GPSQL needs to dispatch the database/user config to segments.
     		 */
     		if (Gp_role == GP_ROLE_DISPATCH)
    -			appendStringInfo(&MyProcPort->override_options, "-c %s=%s ", name, value);
    +		{
    --- End diff --
    
    It's better to make a function to handle this common logic which process the special char. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request #835: HAWQ-980. hawq does not handle guc value w...

Posted by paul-guo- <gi...@git.apache.org>.
Github user paul-guo- closed the pull request at:

    https://github.com/apache/incubator-hawq/pull/835


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request #835: HAWQ-980. hawq does not handle guc value w...

Posted by paul-guo- <gi...@git.apache.org>.
Github user paul-guo- commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/835#discussion_r73841782
  
    --- Diff: src/backend/cdb/executormgr.c ---
    @@ -864,29 +864,42 @@ addOneOption(PQExpBufferData *buffer, struct config_generic * guc)
     			{
     				struct config_string *sguc = (struct config_string *) guc;
     				const char *str = *sguc->variable;
    -				int			j,
    -							start,
    -							end;
    -				char		temp[1024];
    +				unsigned int	 j, start, size;
    +				char			*temp;
     
    -				end = strlen(str);
    +				size = 256;
    --- End diff --
    
    256 does not have special meaning. It is just a rough initial size so that realloc() is seldom called.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq issue #835: HAWQ-980. hawq does not handle guc value with spa...

Posted by paul-guo- <gi...@git.apache.org>.
Github user paul-guo- commented on the issue:

    https://github.com/apache/incubator-hawq/pull/835
  
    @ictmalili @zhangh43 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request #835: HAWQ-980. hawq does not handle guc value w...

Posted by ictmalili <gi...@git.apache.org>.
Github user ictmalili commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/835#discussion_r73815114
  
    --- Diff: src/backend/cdb/executormgr.c ---
    @@ -864,29 +864,42 @@ addOneOption(PQExpBufferData *buffer, struct config_generic * guc)
     			{
     				struct config_string *sguc = (struct config_string *) guc;
     				const char *str = *sguc->variable;
    -				int			j,
    -							start,
    -							end;
    -				char		temp[1024];
    +				unsigned int	 j, start, size;
    +				char			*temp;
     
    -				end = strlen(str);
    +				size = 256;
    --- End diff --
    
    Shall we extract 256 as a macro? I think it's magic number here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq issue #835: HAWQ-980. hawq does not handle guc value with spa...

Posted by paul-guo- <gi...@git.apache.org>.
Github user paul-guo- commented on the issue:

    https://github.com/apache/incubator-hawq/pull/835
  
    @wengyanqing 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq pull request #835: HAWQ-980. hawq does not handle guc value w...

Posted by ictmalili <gi...@git.apache.org>.
Github user ictmalili commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/835#discussion_r73815574
  
    --- Diff: src/backend/cdb/executormgr.c ---
    @@ -864,29 +864,42 @@ addOneOption(PQExpBufferData *buffer, struct config_generic * guc)
     			{
     				struct config_string *sguc = (struct config_string *) guc;
     				const char *str = *sguc->variable;
    -				int			j,
    -							start,
    -							end;
    -				char		temp[1024];
    +				unsigned int	 j, start, size;
    +				char			*temp;
     
    -				end = strlen(str);
    +				size = 256;
    +				temp = malloc(size + 8);
    +				if (temp == NULL)
    +					ereport(ERROR,
    +							(errcode(ERRCODE_OUT_OF_MEMORY),
    +							 errmsg("out of memory")));
     
     				j = 0;
    -				for (start = 0; start < end; ++start)
    +				for (start = 0; start < strlen(str); ++start)
     				{
    -					if (str[start] == ' ')
    -						continue;
    +					if (j == size)
    +					{
    +						size *= 2;
    +						temp = realloc(temp, size + 8);
    +						if (temp == NULL)
    --- End diff --
    
    What if realloc fail? Will the memory leak?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---