[ 
https://issues.apache.org/jira/browse/HAWQ-360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15122856#comment-15122856
 ] 

ASF GitHub Bot commented on HAWQ-360:
-------------------------------------

GitHub user realdawn opened a pull request:

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

    HAWQ-360. Fixed Data loss when alter partition table by add two column in 
one time.

    When executing the sql "alter table part_1 add column p int default 3,add 
column q int default 4;" , the executing process has tow phases. 
    Phase 1:
    create a pg_tmp_1 table
    create pg_temp_1's aoseg table
    copy every column in origin table with adding a column p to pg_temp_1 table
    update its aoseg table
    
    Phase 2:
    create a pg_temp_2 table
    create its pg_temp_2's aoseg table
    copy every column in pg_temp_1 with adding a column q to pg_temp_2 table.
    update its aoseg table
    
    However, with using previous code, by the 3rd step in phase2 it use 
ActiveSnapshot, which means it can't get the latest aoseg table of pg_temp_1.  
As a result, it cause data loss.
    So I modify it by using SnapshotSelf.

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

    $ git pull https://github.com/realdawn/incubator-hawq HAWQ-360

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

    https://github.com/apache/incubator-hawq/pull/304.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 #304
    
----
commit 2404fb5daf11dc2bdc50271daf7f99e8e824c572
Author: doli <d...@pivotal.io>
Date:   2016-01-29T02:50:17Z

    HAWQ-360. Fixed Data loss when alter partition table by add two column in 
one time.

----


> Data loss when alter partition table by add two column in one time.
> -------------------------------------------------------------------
>
>                 Key: HAWQ-360
>                 URL: https://issues.apache.org/jira/browse/HAWQ-360
>             Project: Apache HAWQ
>          Issue Type: Bug
>          Components: DDL
>            Reporter: Dong Li
>            Assignee: Ming LI
>             Fix For: 2.0.0
>
>
> {code}
> CREATE TABLE part_1 (a int, b int, c int)
> WITH (appendonly=true, compresslevel=5)
> partition by range (a)
> (
>      partition b start (1) end (50) every (1)
> );
> insert into part_1 values(1,1,1);
> select * from part_1;
>  a | b | c
> ---+---+---
>  1 | 1 | 1
> (1 row)
> alter table part_1 add column p int default 3,add column q int default 4;
> select * from part_1;
>  a | b | c | p | q
> ---+---+---+---+---
> (0 rows)
> {code}
> When I check hdfs file, I find the size of new hdfs files is 0, which means 
> the data loss when alter the table and create new file for it.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to