rubenada opened a new pull request, #6870:
URL: https://github.com/apache/hive/pull/6870

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: 
https://cwiki.apache.org/confluence/display/Hive/HowToContribute
     2. Ensure that you have created an issue on the Hive project JIRA: 
https://issues.apache.org/jira/projects/HIVE/summary
     3. Ensure you have added or run the appropriate tests for your PR: 
     4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., 
'[WIP]HIVE-XXXXX:  Your PR title ...'.
     5. Be sure to keep the PR description updated to reflect all changes.
     6. Please write your PR title to summarize what this PR proposes.
     7. If possible, provide a concise example to reproduce the issue for a 
faster review.
   
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section 
is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster 
reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class 
hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other 
DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   The Kafka storage handler passes table properties under `kafka.consumer.*` 
and `kafka.producer.*` straight through to the Kafka client. Some Kafka client 
properties take a class name as their value, and the client loads and 
instantiates that class in the JVM that builds the client. Which classes a Hive 
service loads is a deployment decision, so these properties belong in the site 
configuration an operator controls, not in per-table DDL that any user able to 
create or alter a table can set.
   
   This change collects them in one list and refuses them as table properties:
   - `sasl.login.class, sasl.login.callback.handler.class, 
sasl.client.callback.handler.class, ssl.engine.factory.class, 
security.providers` (single class name, ConfigDef.Type.CLASS)
   - `interceptor.classes, metric.reporters, partition.assignment.strategy, 
partitioner.class` (class-name list, ConfigDef.Type.LIST)
   -  any property starting with `config.providers.`, matched by prefix since 
the name in the middle is user-chosen.
   
   An operator who needs one of these can still set it under the usual prefix 
in hive-site.xml and will need to opt-in with
   `-Dhive.kafka.client.class.name.properties.allowed=true`. The opt-in does 
not re-enable these as table properties.
   
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   Reject class-loading client properties set as table properties.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as 
the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes 
- provide the console output, description, screenshot and/or a reproducible 
example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to 
the released Hive versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   The Kafka storage handler no longer accepts the following Kafka client 
properties as table properties (potentially with the `kafka.consumer.` or 
`kafka.producer.` prefix):
   - sasl.login.class
   - sasl.login.callback.handler.class
   - sasl.client.callback.handler.class
   - ssl.engine.factory.class
   - security.providers
   - interceptor.classes
   - metric.reporters
   - partition.assignment.strategy
   - partitioner.class
   - any property starting with config.providers.
   
   After upgrading:
   - `CREATE TABLE` or `ALTER TABLE` on a Kafka table that sets any of these 
properties fails with `Refused table property <name>`. Queries or unrelated 
ALTER TABLE statements on an existing Kafka table that has one of these 
properties fail. To fix the table, remove the property with `ALTER TABLE 
<table> UNSET TBLPROPERTIES ('<name>')`.
   - If one of these properties is set in `hive-site.xml` under the 
`kafka.consumer.` or `kafka.producer. prefix`, it is rejected unless the JVM is 
started with `-Dhive.kafka.client.class.name.properties.allowed=true`. Set the 
flag on HiveServer2 and on every JVM that runs Kafka table tasks. The flag only 
covers hive-site.xml. It never allows these properties as table properties.
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some 
test cases that check the changes thoroughly including negative and positive 
cases if possible.
   If it was tested in a way different from regular unit tests, please clarify 
how you tested step by step, ideally copy and paste-able, so that other 
reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why 
it was difficult to add.
   -->
   New unit tests added.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to