[
https://issues.apache.org/jira/browse/PHOENIX-5958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17164033#comment-17164033
]
Chinmay Kulkarni commented on PHOENIX-5958:
-------------------------------------------
[~tdsilva] I think the problem is that pre-4.15 clients will not have
"isDerived" in the PColumn i.e. it will be false by default since this was
introduced in 4.15 so [this
check|https://github.com/apache/phoenix/blob/2fcb8541c9dd7317e62239bd208ff4377ba794e2/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/DropColumnMutator.java#L219]
fails and the EXCLUDED_COLUMN link will not be added. We will likely have to
bring back some code from 4.14 to find if the column is derived (something like
[this|https://github.com/apache/phoenix/blob/4.14-HBase-1.3/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L3589-L3590]).
The old logic looks like it relies heavily on the ORDINAL_POSITION of the
column to be correct, however I see that we intentionally ignore Puts that
modify the ORDINAL_POSITION of columns in 4.15+ server (see
[this|https://github.com/apache/phoenix/blob/2fcb8541c9dd7317e62239bd208ff4377ba794e2/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/DropColumnMutator.java#L204-L205])
so that might be a problem. Do you know why we "ignore any puts that modify
the ordinal positions of columns"?
FYI [~yanxinyi]
> Diverged view created via an older client still sees dropped column data
> ------------------------------------------------------------------------
>
> Key: PHOENIX-5958
> URL: https://issues.apache.org/jira/browse/PHOENIX-5958
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 5.0.0, 4.15.0
> Reporter: Chinmay Kulkarni
> Priority: Blocker
> Fix For: 5.1.0, 4.16.0
>
> Attachments: PHOENIX-5958-4.x-v1.patch
>
>
> By "diverged view" I mean creating a view and then dropping one of the
> inherited columns from the view. Steps to reproduce:
> Start a 4.x server and connect with a pre-4.15 (I tried a 4.14.3) client
> {code:sql}
> CREATE TABLE IF NOT EXISTS S.T (A INTEGER PRIMARY KEY, B INTEGER);
> CREATE VIEW IF NOT EXISTS S.V (new_col INTEGER) AS SELECT * FROM S.T;
> UPSERT INTO S.T VALUES(1,2);
> ALTER VIEW S.V DROP COLUMN B;
> SELECT * FROM S.T;
> +----+------+
> | A | B |
> +----+------+
> | 1 | 2 |
> +----+------+
> SELECT * FROM S.V; gives:
> +----+------+----------+
> | B | A | NEW_COL |
> +----+------+----------+
> | 2 | 1 | null |
> +----+------+----------+
> {code}
> Though the column 'B' has been dropped from the view. This is a problem for
> both when phoenix.allow.system.catalog.rollback=true or false. This exact bug
> does not happen for a 4.x client, though PHOENIX-6030 and PHOENIX-6032
> highlight other issues related to this code path for 4.x clients.
> The problem is mostly due to changes introduced by
> [PHOENIX-4893|https://issues.apache.org/jira/browse/PHOENIX-4893]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)