hawq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From foyzur <...@git.apache.org>
Subject [GitHub] incubator-hawq pull request: HAWQ-621. Fixing tuple descriptor lea...
Date Fri, 01 Apr 2016 17:20:13 GMT
GitHub user foyzur opened a pull request:

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

    HAWQ-621. Fixing tuple descriptor leak in split_rows during an ALTER TABLE SPLIT PARTITION.


    During split_rows, we may create new tuple table slot inside reconstructMatchingTupleSlot()
if the descriptor of the new target relation does not match the source relation. We then cache
this slot inside the target relation's ri_resultSlot. This process pins the tuple descriptor
of the new target relation. However, at the end of split_rows, when we are finished with this
"cached" tuple table slot, we don't free them. This results in a WARNING that we leaked a
tuple descriptor.
    
    
    Solution:
    -----------
    
    Following the call path of split_rows, the method split_rows() is only called from 
    
    ```
    split_rows(Relation, Relation, Relation) : void
    	ATPExecPartSplit(Relation *, AlterPartitionCmd *) : void
    		ATExecCmd(List * *, AlteredTableInfo *, Relation *, AlterTableCmd *) : void
    			ATPExecPartAlter(List * *, AlteredTableInfo *, Relation, AlterPartitionCmd *) : void
    			ATRewriteCatalogs(List * *) : void
    ```
    
    By the time we call split_rows, we know precisely the two relation where we will be inserting
into. We create ResultRelInfo for both of these relations (the two target relations) at the
beginning of split_rows(), called rria, and rrib. Both of these ResultRelInfo only have lifespan
of the containing method split_rows(). We use the ri_resultSlot of these two rria and rrib
to cache the TupleTableSlot inside reconstructMatchingTupleSlot() where we create additional
TupleTableSlot using the tuple descriptors of the two target relations, therefore pinning
these two target relation's TupleDesc. As the rria and rrib only live during split_rows()
and only used for all the tuples in ONE CALL of split_rows(), we can easily drop the additional
TupleTableSlot ri_resultSlot of both rria and rrib, and that will also unpin underlying TupleDesc.

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

    $ git pull https://github.com/foyzur/incubator-hawq tupledesc

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

    https://github.com/apache/incubator-hawq/pull/549.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 #549
    
----
commit 88085577d226efb60b4c1e8ecdec6187816c8f1e
Author: Foyzur Rahman <foyzur@gmail.com>
Date:   2016-03-22T01:11:13Z

    HAWQ-621. Fixing tuple descriptor leak in split_rows during an ALTER TABLE SPLIT PARTITION.

----


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

Mime
View raw message