phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chinmay Kulkarni (Jira)" <j...@apache.org>
Subject [jira] [Updated] (PHOENIX-6030) When phoenix.allow.system.catalog.rollback=true, a view still sees data for columns that were dropped from its parent view
Date Mon, 20 Jul 2020 20:31:00 GMT

     [ https://issues.apache.org/jira/browse/PHOENIX-6030?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Chinmay Kulkarni updated PHOENIX-6030:
--------------------------------------
    Description: 
Start a 4.x server with phoenix.allow.system.catalog.rollback=true, phoenix.system.catalog.splittable=false.
Connect to it from a 4.x client with phoenix.allow.system.catalog.rollback=true. Run the following
from the 4.x client:

{code:sql}
CREATE TABLE IF NOT EXISTS T (A INTEGER PRIMARY KEY, B INTEGER, C VARCHAR, D INTEGER);
CREATE VIEW IF NOT EXISTS V (VA INTEGER, VB INTEGER) AS SELECT * FROM T WHERE B=200;
UPSERT INTO V(A,B,C,D,VA,VB) VALUES (2, 200, 'def', -20, 91, 101);

SELECT * FROM T;
+----+------+------+------+
| A  |  B   |  C   |  D   |
+----+------+------+------+
| 2  | 200  | def  | -20  |
+----+------+------+------+

SELECT * FROM V;
+----+------+------+------+-----+------+
| A  |  B   |  C   |  D   | VA  |  VB  |
+----+------+------+------+-----+------+
| 2  | 200  | def  | -20  | 91  | 101  |
+----+------+------+------+-----+------+
-- as expected
-- below view can be either a tenant-specific view or a global view, as long as its parent
is V.
CREATE VIEW V_t001 AS SELECT * FROM V;
ALTER VIEW V DROP COLUMN VA;

SELECT * FROM V;
+----+------+------+------+------+
| A  |  B   |  C   |  D   |  VB  |
+----+------+------+------+------+
| 2  | 200  | def  | -20  | 101  |
+----+------+------+------+------+

-- We shouldn't see VA below since it was dropped from the parent
SELECT * FROM V_T001;
+----+------+------+------+-----+------+
| A  |  B   |  C   |  D   | VA  |  VB  |
+----+------+------+------+-----+------+
| 2  | 200  | def  | -20  | 91  | 101  |
+----+------+------+------+-----+------+
{code}

If rollback is enabled, we prevent adding/dropping a column to/from a table that has child
views (see [this|https://github.com/apache/phoenix/blob/2fcb8541c9dd7317e62239bd208ff4377ba794e2/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L2602-L2615]).
However, we don't prevent adding/dropping columns to/from a view that has child views (see
[here|https://github.com/apache/phoenix/blob/2fcb8541c9dd7317e62239bd208ff4377ba794e2/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L2591]).
Either we should also prevent column mutations in case of views that have children or make
sure that dropped columns don't show up when querying a child view.

> When phoenix.allow.system.catalog.rollback=true, a view still sees data for columns that
were dropped from its parent view
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-6030
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6030
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 5.0.0, 4.15.0
>            Reporter: Chinmay Kulkarni
>            Priority: Blocker
>             Fix For: 4.16.0
>
>
> Start a 4.x server with phoenix.allow.system.catalog.rollback=true, phoenix.system.catalog.splittable=false.
Connect to it from a 4.x client with phoenix.allow.system.catalog.rollback=true. Run the following
from the 4.x client:
> {code:sql}
> CREATE TABLE IF NOT EXISTS T (A INTEGER PRIMARY KEY, B INTEGER, C VARCHAR, D INTEGER);
> CREATE VIEW IF NOT EXISTS V (VA INTEGER, VB INTEGER) AS SELECT * FROM T WHERE B=200;
> UPSERT INTO V(A,B,C,D,VA,VB) VALUES (2, 200, 'def', -20, 91, 101);
> SELECT * FROM T;
> +----+------+------+------+
> | A  |  B   |  C   |  D   |
> +----+------+------+------+
> | 2  | 200  | def  | -20  |
> +----+------+------+------+
> SELECT * FROM V;
> +----+------+------+------+-----+------+
> | A  |  B   |  C   |  D   | VA  |  VB  |
> +----+------+------+------+-----+------+
> | 2  | 200  | def  | -20  | 91  | 101  |
> +----+------+------+------+-----+------+
> -- as expected
> -- below view can be either a tenant-specific view or a global view, as long as its parent
is V.
> CREATE VIEW V_t001 AS SELECT * FROM V;
> ALTER VIEW V DROP COLUMN VA;
> SELECT * FROM V;
> +----+------+------+------+------+
> | A  |  B   |  C   |  D   |  VB  |
> +----+------+------+------+------+
> | 2  | 200  | def  | -20  | 101  |
> +----+------+------+------+------+
> -- We shouldn't see VA below since it was dropped from the parent
> SELECT * FROM V_T001;
> +----+------+------+------+-----+------+
> | A  |  B   |  C   |  D   | VA  |  VB  |
> +----+------+------+------+-----+------+
> | 2  | 200  | def  | -20  | 91  | 101  |
> +----+------+------+------+-----+------+
> {code}
> If rollback is enabled, we prevent adding/dropping a column to/from a table that has
child views (see [this|https://github.com/apache/phoenix/blob/2fcb8541c9dd7317e62239bd208ff4377ba794e2/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L2602-L2615]).
However, we don't prevent adding/dropping columns to/from a view that has child views (see
[here|https://github.com/apache/phoenix/blob/2fcb8541c9dd7317e62239bd208ff4377ba794e2/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L2591]).
Either we should also prevent column mutations in case of views that have children or make
sure that dropped columns don't show up when querying a child view.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message