You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hawq.apache.org by sansanichfb <gi...@git.apache.org> on 2016/10/12 22:08:13 UTC

[GitHub] incubator-hawq pull request #959: HAWQ-1084. Fixed memory allocation for tab...

GitHub user sansanichfb opened a pull request:

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

    HAWQ-1084. Fixed memory allocation for table printing.

    

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

    $ git pull https://github.com/sansanichfb/incubator-hawq HAWQ-1084

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

    https://github.com/apache/incubator-hawq/pull/959.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 #959
    
----

----


---
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 #959: HAWQ-1084. Fixed memory allocation for table prin...

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

    https://github.com/apache/incubator-hawq/pull/959
  
    +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 #959: HAWQ-1084. Fixed memory allocation for tab...

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

    https://github.com/apache/incubator-hawq/pull/959#discussion_r83109712
  
    --- Diff: src/bin/psql/describe.c ---
    @@ -4316,10 +4316,10 @@ describePxfTable(const char *profile, const char *pattern, bool verbose)
     		if (verbose)
     		{
     			sourcefieldtype = PQgetvalue(res, i, 4);
    -			total_fields = PQgetvalue(res, i, 5);
    +			total_fields = atoi(PQgetvalue(res, i, 5));
    --- End diff --
    
    Why was an OOM being thrown without `atoi`?


---
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 #959: HAWQ-1084. Fixed memory allocation for tab...

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

    https://github.com/apache/incubator-hawq/pull/959#discussion_r83110356
  
    --- Diff: src/bin/psql/describe.c ---
    @@ -4316,10 +4316,10 @@ describePxfTable(const char *profile, const char *pattern, bool verbose)
     		if (verbose)
     		{
     			sourcefieldtype = PQgetvalue(res, i, 4);
    -			total_fields = PQgetvalue(res, i, 5);
    +			total_fields = atoi(PQgetvalue(res, i, 5));
    --- End diff --
    
    PQgetvalue returns char* and if you assign it directly to int variable, it will be just some random int value. When this value happened to be positive, it would just allocate enormous chunk of memory but in case of negative value(mostly when you just started psql, so heap is small) it would fail with oom.


---
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 #959: HAWQ-1084. Fixed memory allocation for tab...

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

    https://github.com/apache/incubator-hawq/pull/959#discussion_r83110560
  
    --- Diff: src/bin/psql/describe.c ---
    @@ -4316,10 +4316,10 @@ describePxfTable(const char *profile, const char *pattern, bool verbose)
     		if (verbose)
     		{
     			sourcefieldtype = PQgetvalue(res, i, 4);
    -			total_fields = PQgetvalue(res, i, 5);
    +			total_fields = atoi(PQgetvalue(res, i, 5));
    --- End diff --
    
    Ah, good catch


---
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 #959: HAWQ-1084. Fixed memory allocation for tab...

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

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


---
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 #959: HAWQ-1084. Fixed memory allocation for tab...

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

    https://github.com/apache/incubator-hawq/pull/959#discussion_r83113822
  
    --- Diff: src/bin/psql/describe.c ---
    @@ -4316,10 +4316,10 @@ describePxfTable(const char *profile, const char *pattern, bool verbose)
     		if (verbose)
     		{
     			sourcefieldtype = PQgetvalue(res, i, 4);
    -			total_fields = PQgetvalue(res, i, 5);
    +			total_fields = atoi(PQgetvalue(res, i, 5));
    --- End diff --
    
    No, atoi() doesn't guarantee a positive value, it just takes char, assumes it's a int value and converts it to int value. The SQL `SELECT t.path, t.itemname, t.fieldname, t.fieldtype, sourcefieldtype, COUNT() OVER(PARTITION BY path, itemname) as total_fields FROM pxf_get_item_fields('Hive', '*') t` guarantees that total_fields will be >=0. I would say we could fix function pg_local_calloc so it should take only positive value.


---
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.
---