[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-05 Thread Impala Public Jenkins (Code Review)
Impala Public Jenkins has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/11358 )

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..


Patch Set 9:

Build Successful

https://jenkins.impala.io/job/gerrit-code-review-checks/601/ : Initial code 
review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun 
to run full precommit tests.


--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 9
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 
Gerrit-Comment-Date: Thu, 06 Sep 2018 03:12:25 +
Gerrit-HasComments: No


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-05 Thread Impala Public Jenkins (Code Review)
Impala Public Jenkins has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/11358 )

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..


Patch Set 8:

Build Successful

https://jenkins.impala.io/job/gerrit-code-review-checks/600/ : Initial code 
review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun 
to run full precommit tests.


--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 8
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 
Gerrit-Comment-Date: Thu, 06 Sep 2018 03:07:45 +
Gerrit-HasComments: No


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-05 Thread Todd Lipcon (Code Review)
Todd Lipcon has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/11358 )

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..

IMPALA-7510. Support principals/privileges with LocalCatalog

This enables support for Sentry authorization when LocalCatalog is
enabled. The design is detailed in a change to the comment on
CatalogdMetaProvider, but to recap it briefly here:

At a high level, this patch takes the approach of duplicating the "v1"
catalog flow for PRINCIPAL and PRIVILEGE catalog objects. Namely, the catalog
daemon publishes complete objects into the statestore topic, and the
impalad fully replicates them locally.

I took this approach rather than trying to do fine-grained caching and
invalidation for the following reasons:

- The PRINCIPAL and PRIVILEGE metadata is typically many orders of magnitude
  smaller than table metadata. So, the benefit of fine-grained caching
  and eviction is not as great.

- The PRINCIPAL and PRIVILEGE catalog objects are fairly tightly intertwined
  with relationships between them and backwards mappings maintained from
  groups back to principals. This logic is implemented by the
  AuthorizationPolicy class. Implementing similar mapping in a
  fine-grained caching approach would be a reasonable amount of work.

- This bit of code is under some current flux as others are working on
  implementing more fine grained permissioning. Thus, trying to
  duplicate the logic in a "fetch-on-demand" implementation might turn
  out to be chasing somewhat of a moving target.

In order to take this approach, the patch is organized as follows:

- refactored some of the role/principal removal logic from ImpaladCatalog
  into AuthorizationPolicy. This makes it easier to perform the similar
  "subscribe" with less duplicate cdoe.

- changed catalogd to publish PRINCIPAL and PRIVILEGE objects to v2
  catalogs in addition to v1.

- passed through LocalCatalog.getAuthPolicy to CatalogdMetaProvider, and
  added an AuthorizationPolicy member there. This member is maintained
  when we see PRINCIPAL and PRIVILEGE objects come via the catalog
  updates.

- had to implement LocalCatalog.isReady() to ensure that we don't allow
  user access until the first topic update has been consumed.

- additionally had to copy some other code from ImpaladCatalog to
  protect against various races -- we need a CatalogDeltaLog as well as
  careful sequencing of the order in which the objects apply.

With this patch and the following one to enable UDF support, I was able
to run the tests in tests/authorization successfully with LocalCatalog
enabled.

Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Reviewed-on: http://gerrit.cloudera.org:8080/11358
Reviewed-by: Todd Lipcon 
Tested-by: Todd Lipcon 
---
M fe/src/main/java/org/apache/impala/catalog/AuthorizationPolicy.java
M fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java
M fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java
M fe/src/main/java/org/apache/impala/catalog/PrincipalPrivilege.java
M fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/DirectMetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java
M fe/src/main/java/org/apache/impala/catalog/local/MetaProvider.java
M tests/common/custom_cluster_test_suite.py
9 files changed, 272 insertions(+), 67 deletions(-)

Approvals:
  Todd Lipcon: Looks good to me, approved; Verified

--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 10
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-05 Thread Todd Lipcon (Code Review)
Todd Lipcon has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/11358 )

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..


Patch Set 9:

Skipping a jenkins re-verify since it was only whitespace/comment change 
edited. Forwarding +2.


--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 9
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 
Gerrit-Comment-Date: Thu, 06 Sep 2018 02:39:05 +
Gerrit-HasComments: No


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-05 Thread Todd Lipcon (Code Review)
Todd Lipcon has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/11358 )

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..


Patch Set 9: Verified+1 Code-Review+2

(2 comments)

http://gerrit.cloudera.org:8080/#/c/11358/7/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
File fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java:

http://gerrit.cloudera.org:8080/#/c/11358/7/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java@270
PS7, Line 270:   @Override
> nit: extra line here and below
Done


http://gerrit.cloudera.org:8080/#/c/11358/7/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java@783
PS7, Line 783: ype.PR
> nit: order
Done



--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 9
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 
Gerrit-Comment-Date: Thu, 06 Sep 2018 02:38:33 +
Gerrit-HasComments: Yes


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-05 Thread Todd Lipcon (Code Review)
Hello Bharath Vissapragada, Fredy Wijaya, Impala Public Jenkins, Vuk Ercegovac,

I'd like you to reexamine a change. Please visit

http://gerrit.cloudera.org:8080/11358

to look at the new patch set (#9).

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..

IMPALA-7510. Support principals/privileges with LocalCatalog

This enables support for Sentry authorization when LocalCatalog is
enabled. The design is detailed in a change to the comment on
CatalogdMetaProvider, but to recap it briefly here:

At a high level, this patch takes the approach of duplicating the "v1"
catalog flow for PRINCIPAL and PRIVILEGE catalog objects. Namely, the catalog
daemon publishes complete objects into the statestore topic, and the
impalad fully replicates them locally.

I took this approach rather than trying to do fine-grained caching and
invalidation for the following reasons:

- The PRINCIPAL and PRIVILEGE metadata is typically many orders of magnitude
  smaller than table metadata. So, the benefit of fine-grained caching
  and eviction is not as great.

- The PRINCIPAL and PRIVILEGE catalog objects are fairly tightly intertwined
  with relationships between them and backwards mappings maintained from
  groups back to principals. This logic is implemented by the
  AuthorizationPolicy class. Implementing similar mapping in a
  fine-grained caching approach would be a reasonable amount of work.

- This bit of code is under some current flux as others are working on
  implementing more fine grained permissioning. Thus, trying to
  duplicate the logic in a "fetch-on-demand" implementation might turn
  out to be chasing somewhat of a moving target.

In order to take this approach, the patch is organized as follows:

- refactored some of the role/principal removal logic from ImpaladCatalog
  into AuthorizationPolicy. This makes it easier to perform the similar
  "subscribe" with less duplicate cdoe.

- changed catalogd to publish PRINCIPAL and PRIVILEGE objects to v2
  catalogs in addition to v1.

- passed through LocalCatalog.getAuthPolicy to CatalogdMetaProvider, and
  added an AuthorizationPolicy member there. This member is maintained
  when we see PRINCIPAL and PRIVILEGE objects come via the catalog
  updates.

- had to implement LocalCatalog.isReady() to ensure that we don't allow
  user access until the first topic update has been consumed.

- additionally had to copy some other code from ImpaladCatalog to
  protect against various races -- we need a CatalogDeltaLog as well as
  careful sequencing of the order in which the objects apply.

With this patch and the following one to enable UDF support, I was able
to run the tests in tests/authorization successfully with LocalCatalog
enabled.

Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
---
M fe/src/main/java/org/apache/impala/catalog/AuthorizationPolicy.java
M fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java
M fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java
M fe/src/main/java/org/apache/impala/catalog/PrincipalPrivilege.java
M fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/DirectMetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java
M fe/src/main/java/org/apache/impala/catalog/local/MetaProvider.java
M tests/common/custom_cluster_test_suite.py
9 files changed, 272 insertions(+), 67 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/58/11358/9
--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 9
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-05 Thread Todd Lipcon (Code Review)
Hello Bharath Vissapragada, Fredy Wijaya, Impala Public Jenkins, Vuk Ercegovac,

I'd like you to reexamine a change. Please visit

http://gerrit.cloudera.org:8080/11358

to look at the new patch set (#8).

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..

IMPALA-7510. Support principals/privileges with LocalCatalog

This enables support for Sentry authorization when LocalCatalog is
enabled. The design is detailed in a change to the comment on
CatalogdMetaProvider, but to recap it briefly here:

At a high level, this patch takes the approach of duplicating the "v1"
catalog flow for PRINCIPAL and PRIVILEGE catalog objects. Namely, the catalog
daemon publishes complete objects into the statestore topic, and the
impalad fully replicates them locally.

I took this approach rather than trying to do fine-grained caching and
invalidation for the following reasons:

- The PRINCIPAL and PRIVILEGE metadata is typically many orders of magnitude
  smaller than table metadata. So, the benefit of fine-grained caching
  and eviction is not as great.

- The PRINCIPAL and PRIVILEGE catalog objects are fairly tightly intertwined
  with relationships between them and backwards mappings maintained from
  groups back to principals. This logic is implemented by the
  AuthorizationPolicy class. Implementing similar mapping in a
  fine-grained caching approach would be a reasonable amount of work.

- This bit of code is under some current flux as others are working on
  implementing more fine grained permissioning. Thus, trying to
  duplicate the logic in a "fetch-on-demand" implementation might turn
  out to be chasing somewhat of a moving target.

In order to take this approach, the patch is organized as follows:

- refactored some of the role/principal removal logic from ImpaladCatalog
  into AuthorizationPolicy. This makes it easier to perform the similar
  "subscribe" with less duplicate cdoe.

- changed catalogd to publish PRINCIPAL and PRIVILEGE objects to v2
  catalogs in addition to v1.

- passed through LocalCatalog.getAuthPolicy to CatalogdMetaProvider, and
  added an AuthorizationPolicy member there. This member is maintained
  when we see PRINCIPAL and PRIVILEGE objects come via the catalog
  updates.

- had to implement LocalCatalog.isReady() to ensure that we don't allow
  user access until the first topic update has been consumed.

- additionally had to copy some other code from ImpaladCatalog to
  protect against various races -- we need a CatalogDeltaLog as well as
  careful sequencing of the order in which the objects apply.

With this patch and the following one to enable UDF support, I was able
to run the tests in tests/authorization successfully with LocalCatalog
enabled.

Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
---
M fe/src/main/java/org/apache/impala/catalog/AuthorizationPolicy.java
M fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java
M fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java
M fe/src/main/java/org/apache/impala/catalog/PrincipalPrivilege.java
M fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/DirectMetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java
M fe/src/main/java/org/apache/impala/catalog/local/MetaProvider.java
M tests/common/custom_cluster_test_suite.py
9 files changed, 274 insertions(+), 67 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/58/11358/8
--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 8
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-05 Thread Impala Public Jenkins (Code Review)
Impala Public Jenkins has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/11358 )

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..


Patch Set 7: Verified+1


--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 7
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 
Gerrit-Comment-Date: Thu, 06 Sep 2018 02:26:03 +
Gerrit-HasComments: No


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-05 Thread Vuk Ercegovac (Code Review)
Vuk Ercegovac has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/11358 )

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..


Patch Set 7: Code-Review+2

(3 comments)

http://gerrit.cloudera.org:8080/#/c/11358/7/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
File fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java:

http://gerrit.cloudera.org:8080/#/c/11358/7/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java@270
PS7, Line 270:
nit: extra line here and below


http://gerrit.cloudera.org:8080/#/c/11358/7/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java@783
PS7, Line 783: oreder
nit: order


http://gerrit.cloudera.org:8080/#/c/11358/6/fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java
File fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java:

http://gerrit.cloudera.org:8080/#/c/11358/6/fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java@214
PS6, Line 214: // here.
> It might be sufficient (or at least better) to do a sleeping loop checking
makes sense to defer it



--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 7
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 
Gerrit-Comment-Date: Wed, 05 Sep 2018 23:55:30 +
Gerrit-HasComments: Yes


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-05 Thread Impala Public Jenkins (Code Review)
Impala Public Jenkins has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/11358 )

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..


Patch Set 7:

Build Successful

https://jenkins.impala.io/job/gerrit-code-review-checks/593/ : Initial code 
review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun 
to run full precommit tests.


--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 7
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 
Gerrit-Comment-Date: Wed, 05 Sep 2018 23:28:02 +
Gerrit-HasComments: No


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-05 Thread Impala Public Jenkins (Code Review)
Impala Public Jenkins has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/11358 )

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..


Patch Set 7:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/3119/ 
DRY_RUN=true


--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 7
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 
Gerrit-Comment-Date: Wed, 05 Sep 2018 22:53:10 +
Gerrit-HasComments: No


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-05 Thread Todd Lipcon (Code Review)
Hello Bharath Vissapragada, Fredy Wijaya, Impala Public Jenkins, Vuk Ercegovac,

I'd like you to reexamine a change. Please visit

http://gerrit.cloudera.org:8080/11358

to look at the new patch set (#7).

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..

IMPALA-7510. Support principals/privileges with LocalCatalog

This enables support for Sentry authorization when LocalCatalog is
enabled. The design is detailed in a change to the comment on
CatalogdMetaProvider, but to recap it briefly here:

At a high level, this patch takes the approach of duplicating the "v1"
catalog flow for PRINCIPAL and PRIVILEGE catalog objects. Namely, the catalog
daemon publishes complete objects into the statestore topic, and the
impalad fully replicates them locally.

I took this approach rather than trying to do fine-grained caching and
invalidation for the following reasons:

- The PRINCIPAL and PRIVILEGE metadata is typically many orders of magnitude
  smaller than table metadata. So, the benefit of fine-grained caching
  and eviction is not as great.

- The PRINCIPAL and PRIVILEGE catalog objects are fairly tightly intertwined
  with relationships between them and backwards mappings maintained from
  groups back to principals. This logic is implemented by the
  AuthorizationPolicy class. Implementing similar mapping in a
  fine-grained caching approach would be a reasonable amount of work.

- This bit of code is under some current flux as others are working on
  implementing more fine grained permissioning. Thus, trying to
  duplicate the logic in a "fetch-on-demand" implementation might turn
  out to be chasing somewhat of a moving target.

In order to take this approach, the patch is organized as follows:

- refactored some of the role/principal removal logic from ImpaladCatalog
  into AuthorizationPolicy. This makes it easier to perform the similar
  "subscribe" with less duplicate cdoe.

- changed catalogd to publish PRINCIPAL and PRIVILEGE objects to v2
  catalogs in addition to v1.

- passed through LocalCatalog.getAuthPolicy to CatalogdMetaProvider, and
  added an AuthorizationPolicy member there. This member is maintained
  when we see PRINCIPAL and PRIVILEGE objects come via the catalog
  updates.

- had to implement LocalCatalog.isReady() to ensure that we don't allow
  user access until the first topic update has been consumed.

- additionally had to copy some other code from ImpaladCatalog to
  protect against various races -- we need a CatalogDeltaLog as well as
  careful sequencing of the order in which the objects apply.

With this patch and the following one to enable UDF support, I was able
to run the tests in tests/authorization successfully with LocalCatalog
enabled.

Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
---
M fe/src/main/java/org/apache/impala/catalog/AuthorizationPolicy.java
M fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java
M fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java
M fe/src/main/java/org/apache/impala/catalog/PrincipalPrivilege.java
M fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/DirectMetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java
M fe/src/main/java/org/apache/impala/catalog/local/MetaProvider.java
M tests/common/custom_cluster_test_suite.py
9 files changed, 274 insertions(+), 67 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/58/11358/7
--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 7
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-05 Thread Todd Lipcon (Code Review)
Todd Lipcon has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/11358 )

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..


Patch Set 6:

(5 comments)

http://gerrit.cloudera.org:8080/#/c/11358/3/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
File fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java:

http://gerrit.cloudera.org:8080/#/c/11358/3/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java@738
PS3, Line 738:
> I read this as a bug originally until I saw that newCatalogVersion may be u
changed to using a boxed Long which starts as null, and added a comment. lmk if 
it's better


http://gerrit.cloudera.org:8080/#/c/11358/6/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
File fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java:

http://gerrit.cloudera.org:8080/#/c/11358/6/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java@235
PS6, Line 235: retried via
> nit: pushed from
I wonder where my wires got crossed there...


http://gerrit.cloudera.org:8080/#/c/11358/6/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java@750
PS6, Line 750: sequencer
> since its specific to auth, pls call this authSequencer or something like t
Done


http://gerrit.cloudera.org:8080/#/c/11358/6/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java@862
PS6, Line 862:   LOG.error("Error adding privilege: ", e);
> For the case that we got here via a direct ddl, wouldn't the caller want to
yea I found this surprising as well. The weird thing is that in that case it 
would have succeeded but not be reflected in the local impalad. I'll add a TODO 
here that this error handling is suspicious, but not sure how to fix it (and 
it's pre-existing)


http://gerrit.cloudera.org:8080/#/c/11358/6/fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java
File fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java:

http://gerrit.cloudera.org:8080/#/c/11358/6/fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java@214
PS6, Line 214: // here.
> is isReady sufficient here? from catalogmetaprovider, its ready when its ad
It might be sufficient (or at least better) to do a sleeping loop checking 
isReady but would rather defer to a separate patch since it's unrelated (I have 
a JIRA for waiting properly at startup)



--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 6
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 
Gerrit-Comment-Date: Wed, 05 Sep 2018 22:30:22 +
Gerrit-HasComments: Yes


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-05 Thread Vuk Ercegovac (Code Review)
Vuk Ercegovac has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/11358 )

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..


Patch Set 6:

(5 comments)

http://gerrit.cloudera.org:8080/#/c/11358/3/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
File fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java:

http://gerrit.cloudera.org:8080/#/c/11358/3/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java@738
PS3, Line 738:
I read this as a bug originally until I saw that newCatalogVersion may be 
updated on L782. Perhaps use two variables for clarity, such as 
currentCatalogVersion and nextCatalogVersion?


http://gerrit.cloudera.org:8080/#/c/11358/6/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
File fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java:

http://gerrit.cloudera.org:8080/#/c/11358/6/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java@235
PS6, Line 235: retried via
nit: pushed from


http://gerrit.cloudera.org:8080/#/c/11358/6/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java@750
PS6, Line 750: sequencer
since its specific to auth, pls call this authSequencer or something like this.


http://gerrit.cloudera.org:8080/#/c/11358/6/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java@862
PS6, Line 862:   LOG.error("Error adding privilege: ", e);
For the case that we got here via a direct ddl, wouldn't the caller want to 
know that the 'add' didn't succeed? Separate from this change, but error 
propagation is not the clearest with this path (same goes for existing 
ImpaladCatalog).


http://gerrit.cloudera.org:8080/#/c/11358/6/fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java
File fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java:

http://gerrit.cloudera.org:8080/#/c/11358/6/fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java@214
PS6, Line 214: // here.
is isReady sufficient here? from catalogmetaprovider, its ready when its 
advanced past the initial version.



--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 6
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 
Gerrit-Comment-Date: Wed, 05 Sep 2018 19:12:28 +
Gerrit-HasComments: Yes


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-04 Thread Impala Public Jenkins (Code Review)
Impala Public Jenkins has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/11358 )

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..


Patch Set 4:

Build Successful

https://jenkins.impala.io/job/gerrit-code-review-checks/575/ : Initial code 
review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun 
to run full precommit tests.


--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 4
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 
Gerrit-Comment-Date: Tue, 04 Sep 2018 23:56:33 +
Gerrit-HasComments: No


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-09-04 Thread Todd Lipcon (Code Review)
Hello Bharath Vissapragada, Fredy Wijaya, Impala Public Jenkins, Vuk Ercegovac,

I'd like you to reexamine a change. Please visit

http://gerrit.cloudera.org:8080/11358

to look at the new patch set (#4).

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..

IMPALA-7510. Support principals/privileges with LocalCatalog

This enables support for Sentry authorization when LocalCatalog is
enabled. The design is detailed in a change to the comment on
CatalogdMetaProvider, but to recap it briefly here:

At a high level, this patch takes the approach of duplicating the "v1"
catalog flow for PRINCIPAL and PRIVILEGE catalog objects. Namely, the catalog
daemon publishes complete objects into the statestore topic, and the
impalad fully replicates them locally.

I took this approach rather than trying to do fine-grained caching and
invalidation for the following reasons:

- The PRINCIPAL and PRIVILEGE metadata is typically many orders of magnitude
  smaller than table metadata. So, the benefit of fine-grained caching
  and eviction is not as great.

- The PRINCIPAL and PRIVILEGE catalog objects are fairly tightly intertwined
  with relationships between them and backwards mappings maintained from
  groups back to principals. This logic is implemented by the
  AuthorizationPolicy class. Implementing similar mapping in a
  fine-grained caching approach would be a reasonable amount of work.

- This bit of code is under some current flux as others are working on
  implementing more fine grained permissioning. Thus, trying to
  duplicate the logic in a "fetch-on-demand" implementation might turn
  out to be chasing somewhat of a moving target.

In order to take this approach, the patch is organized as follows:

- refactored some of the role/principal removal logic from ImpaladCatalog
  into AuthorizationPolicy. This makes it easier to perform the similar
  "subscribe" with less duplicate cdoe.

- changed catalogd to publish PRINCIPAL and PRIVILEGE objects to v2
  catalogs in addition to v1.

- passed through LocalCatalog.getAuthPolicy to CatalogdMetaProvider, and
  added an AuthorizationPolicy member there. This member is maintained
  when we see PRINCIPAL and PRIVILEGE objects come via the catalog
  updates.

- had to implement LocalCatalog.isReady() to ensure that we don't allow
  user access until the first topic update has been consumed.

- additionally had to copy some other code from ImpaladCatalog to
  protect against various races -- we need a CatalogDeltaLog as well as
  careful sequencing of the order in which the objects apply.

With this patch and the following one to enable UDF support, I was able
to run the tests in tests/authorization successfully with LocalCatalog
enabled.

Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
---
M fe/src/main/java/org/apache/impala/catalog/AuthorizationPolicy.java
M fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java
M fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java
M fe/src/main/java/org/apache/impala/catalog/PrincipalPrivilege.java
M fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/DirectMetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java
M fe/src/main/java/org/apache/impala/catalog/local/MetaProvider.java
M tests/common/custom_cluster_test_suite.py
9 files changed, 266 insertions(+), 67 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/58/11358/4
--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 4
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-08-31 Thread Impala Public Jenkins (Code Review)
Impala Public Jenkins has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/11358 )

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..


Patch Set 3:

Build Successful

https://jenkins.impala.io/job/gerrit-code-review-checks/561/ : Initial code 
review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun 
to run full precommit tests.


--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 3
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 
Gerrit-Comment-Date: Sat, 01 Sep 2018 01:41:14 +
Gerrit-HasComments: No


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-08-31 Thread Todd Lipcon (Code Review)
Hello Bharath Vissapragada, Fredy Wijaya, Impala Public Jenkins, Vuk Ercegovac,

I'd like you to reexamine a change. Please visit

http://gerrit.cloudera.org:8080/11358

to look at the new patch set (#3).

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..

IMPALA-7510. Support principals/privileges with LocalCatalog

This enables support for Sentry authorization when LocalCatalog is
enabled. The design is detailed in a change to the comment on
CatalogdMetaProvider, but to recap it briefly here:

At a high level, this patch takes the approach of duplicating the "v1"
catalog flow for PRINCIPAL and PRIVILEGE catalog objects. Namely, the catalog
daemon publishes complete objects into the statestore topic, and the
impalad fully replicates them locally.

I took this approach rather than trying to do fine-grained caching and
invalidation for the following reasons:

- The PRINCIPAL and PRIVILEGE metadata is typically many orders of magnitude
  smaller than table metadata. So, the benefit of fine-grained caching
  and eviction is not as great.

- The PRINCIPAL and PRIVILEGE catalog objects are fairly tightly intertwined
  with relationships between them and backwards mappings maintained from
  groups back to principals. This logic is implemented by the
  AuthorizationPolicy class. Implementing similar mapping in a
  fine-grained caching approach would be a reasonable amount of work.

- This bit of code is under some current flux as others are working on
  implementing more fine grained permissioning. Thus, trying to
  duplicate the logic in a "fetch-on-demand" implementation might turn
  out to be chasing somewhat of a moving target.

In order to take this approach, the patch is organized as follows:

- refactored some of the role/principal removal logic from ImpaladCatalog
  into AuthorizationPolicy. This makes it easier to perform the similar
  "subscribe" with less duplicate cdoe.

- changed catalogd to publish PRINCIPAL and PRIVILEGE objects to v2
  catalogs in addition to v1.

- passed through LocalCatalog.getAuthPolicy to CatalogdMetaProvider, and
  added an AuthorizationPolicy member there. This member is maintained
  when we see PRINCIPAL and PRIVILEGE objects come via the catalog
  updates.

- had to implement LocalCatalog.isReady() to ensure that we don't allow
  user access until the first topic update has been consumed.

- additionally had to copy some other code from ImpaladCatalog to
  protect against various races -- we need a CatalogDeltaLog as well as
  careful sequencing of the order in which the objects apply.

With this patch and the following one to enable UDF support, I was able
to run the tests in tests/authorization successfully with LocalCatalog
enabled.

Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
---
M fe/src/main/java/org/apache/impala/catalog/AuthorizationPolicy.java
M fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java
M fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java
M fe/src/main/java/org/apache/impala/catalog/PrincipalPrivilege.java
M fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/DirectMetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java
M fe/src/main/java/org/apache/impala/catalog/local/MetaProvider.java
M tests/common/custom_cluster_test_suite.py
9 files changed, 265 insertions(+), 68 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/58/11358/3
--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 3
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Fredy Wijaya 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Todd Lipcon 
Gerrit-Reviewer: Vuk Ercegovac 


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-08-30 Thread Impala Public Jenkins (Code Review)
Impala Public Jenkins has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/11358 )

Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..


Patch Set 1:

Build Successful

https://jenkins.impala.io/job/gerrit-code-review-checks/535/ : Initial code 
review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun 
to run full precommit tests.


--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 1
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Impala Public Jenkins 
Gerrit-Reviewer: Vuk Ercegovac 
Gerrit-Comment-Date: Thu, 30 Aug 2018 08:43:53 +
Gerrit-HasComments: No


[Impala-ASF-CR] IMPALA-7510. Support principals/privileges with LocalCatalog

2018-08-30 Thread Todd Lipcon (Code Review)
Hello Bharath Vissapragada, Vuk Ercegovac,

I'd like you to do a code review. Please visit

http://gerrit.cloudera.org:8080/11358

to review the following change.


Change subject: IMPALA-7510. Support principals/privileges with LocalCatalog
..

IMPALA-7510. Support principals/privileges with LocalCatalog

This enables support for Sentry authorization when LocalCatalog is
enabled. The design is detailed in a change to the comment on
CatalogdMetaProvider, but to recap it briefly here:

At a high level, this patch takes the approach of duplicating the "v1"
catalog flow for PRINCIPAL and PRIVILEGE catalog objects. Namely, the catalog
daemon publishes complete objects into the statestore topic, and the
impalad fully replicates them locally.

I took this approach rather than trying to do fine-grained caching and
invalidation for the following reasons:

- The PRINCIPAL and PRIVILEGE metadata is typically many orders of magnitude
  smaller than table metadata. So, the benefit of fine-grained caching
  and eviction is not as great.

- The PRINCIPAL and PRIVILEGE catalog objects are fairly tightly intertwined
  with relationships between them and backwards mappings maintained from
  groups back to principals. This logic is implemented by the
  AuthorizationPolicy class. Implementing similar mapping in a
  fine-grained caching approach would be a reasonable amount of work.

- This bit of code is under some current flux as others are working on
  implementing more fine grained permissioning. Thus, trying to
  duplicate the logic in a "fetch-on-demand" implementation might turn
  out to be chasing somewhat of a moving target.

In order to take this approach, the patch is organized as follows:

- refactored some of the role/principal removal logic from ImpaladCatalog
  into AuthorizationPolicy. This makes it easier to perform the similar
  "subscribe" with less duplicate cdoe.

- changed catalogd to publish PRINCIPAL and PRIVILEGE objects to v2
  catalogs in addition to v1.

- passed through LocalCatalog.getAuthPolicy to CatalogdMetaProvider, and
  added an AuthorizationPolicy member there. This member is maintained
  when we see PRINCIPAL and PRIVILEGE objects come via the catalog
  updates.

- had to implement LocalCatalog.isReady() to ensure that we don't allow
  user access until the first topic update has been consumed.

- additionally had to copy some other code from ImpaladCatalog to
  protect against various races -- we need a CatalogDeltaLog as well as
  careful sequencing of the order in which the objects apply.

With this patch and the following one to enable UDF support, I was able
to run the tests in tests/authorization successfully with LocalCatalog
enabled.

Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
---
M fe/src/main/java/org/apache/impala/catalog/AuthorizationPolicy.java
M fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java
M fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java
M fe/src/main/java/org/apache/impala/catalog/PrincipalPrivilege.java
M fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/DirectMetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java
M fe/src/main/java/org/apache/impala/catalog/local/MetaProvider.java
M tests/common/custom_cluster_test_suite.py
9 files changed, 266 insertions(+), 67 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/58/11358/1
--
To view, visit http://gerrit.cloudera.org:8080/11358
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iccce5aabdb6afe466fdaeae0fb3700c66e658558
Gerrit-Change-Number: 11358
Gerrit-PatchSet: 1
Gerrit-Owner: Todd Lipcon 
Gerrit-Reviewer: Bharath Vissapragada 
Gerrit-Reviewer: Vuk Ercegovac