Skip to content

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

Merged
Technoboy- merged 2 commits into
apache:masterfrom
congbobo184:congbobo184_fix_schema_update_authentication
Oct 19, 2022
Merged

Technoboy- merged 2 commits into
apache:masterfrom
congbobo184:congbobo184_fix_schema_update_authentication

Conversation

@congbobo184

@congbobo184 congbobo184 commented Oct 17, 2022 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes

@nodece

nodece commented Oct 18, 2022

Copy link
Copy Markdown
Member

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

@codecov-commenter

codecov-commenter commented Oct 18, 2022 •

Copy link
Copy Markdown

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
Copy Markdown
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