Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve][schema] Change update schema auth from tenant to produce #18074

Conversation

congbobo184
Copy link
Contributor

@congbobo184 congbobo184 commented Oct 17, 2022

discuss: https://lists.apache.org/thread/0ts6josxxq4gt3qw2toxf9jd77d7s6kj

Motivation

Now, we have two authentications for updating the schema

  1. producer and consumer can update the schema using TopicOperation
    produce or consume when open autoUpdateSchema
  2. pulsar admin uses Tenant authentication

This will produce problems when using different authentications to
update the schema.

Modification

  1. admin use produce permission to update the schema
  2. enable autoUpdataSchema, the client can use produce permission to update the schema automatically. When no schema in the topic, consume permission also can first update the schema automatically first

Documentation

  • doc-not-needed

Matching PR in the forked repository

PR in forked repository:

assertThrows(PulsarAdminException.class, () -> adminWithoutPermission.schemas().createSchema(topicName, si));
adminWithAdminPermission.schemas().createSchema(topicName, si);
assertThrows(PulsarAdminException.class, () -> adminWithConsumePermission.schemas().getSchemaInfo(topicName));
adminWithProducePermission.schemas().createSchema(topicName, si);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the old test, and then append a new test.

});
});
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this reusable, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

@nodece
Copy link
Member

nodece commented Oct 18, 2022

This PR also should sync to branch-2.9 and branch-2.10.

@codecov-commenter
Copy link

codecov-commenter commented Oct 18, 2022

Codecov Report

Merging #18074 (e7b6bdd) into master (6c65ca0) will increase coverage by 17.56%.
The diff coverage is 80.64%.

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #18074       +/-   ##
=============================================
+ Coverage     34.91%   52.47%   +17.56%     
- Complexity     5707     7284     +1577     
=============================================
  Files           607      393      -214     
  Lines         53396    43419     -9977     
  Branches       5712     4465     -1247     
=============================================
+ Hits          18644    22786     +4142     
+ Misses        32119    18139    -13980     
+ Partials       2633     2494      -139     
Flag Coverage Δ
unittests 52.47% <80.64%> (+17.56%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../service/SystemTopicBasedTopicPoliciesService.java 61.07% <0.00%> (+9.48%) ⬆️
.../pulsar/broker/stats/BrokerOperabilityMetrics.java 100.00% <ø> (+7.35%) ⬆️
.../org/apache/pulsar/broker/admin/v2/Namespaces.java 57.46% <50.00%> (+49.43%) ⬆️
...apache/pulsar/proxy/server/DirectProxyHandler.java 63.63% <50.00%> (ø)
...broker/delayed/InMemoryDelayedDeliveryTracker.java 65.00% <75.00%> (+65.00%) ⬆️
.../org/apache/pulsar/broker/admin/AdminResource.java 66.51% <93.33%> (+34.03%) ⬆️
...pulsar/broker/admin/impl/PersistentTopicsBase.java 52.60% <100.00%> (+41.20%) ⬆️
.../pulsar/broker/admin/impl/SchemasResourceBase.java 89.89% <100.00%> (+44.44%) ⬆️
...rg/apache/pulsar/broker/service/BrokerService.java 59.35% <100.00%> (+11.35%) ⬆️
...g/apache/pulsar/compaction/CompactedTopicImpl.java 81.42% <100.00%> (+70.71%) ⬆️
... and 395 more

@codelipenghui
Copy link
Contributor

@congbobo184 Could you please help cherry-pick this PR to branch-2.10 and branch-2.9? It will help users who want to create topics by Admin API, but the tenant admin is required before upgrading to 2.11.0.

@congbobo184 congbobo184 added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Nov 23, 2022
congbobo184 added a commit that referenced this pull request Nov 23, 2022
congbobo184 added a commit that referenced this pull request Nov 26, 2022
liangyepianzhou pushed a commit that referenced this pull request Dec 13, 2022
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jan 10, 2023
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants