You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "AnonHxy (via GitHub)" <gi...@apache.org> on 2023/08/29 02:32:22 UTC

[GitHub] [pulsar] AnonHxy commented on a diff in pull request #21078: [fix] [broker] remove bundle-data in local metadata store.

AnonHxy commented on code in PR #21078:
URL: https://github.com/apache/pulsar/pull/21078#discussion_r1308129685


##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/resources/NamespaceResources.java:
##########
@@ -49,16 +49,18 @@ public class NamespaceResources extends BaseResources<Policies> {
     private final IsolationPolicyResources isolationPolicies;
     private final PartitionedTopicResources partitionedTopicResources;
     private final MetadataStore configurationStore;
+    private final MetadataStore localStore;
 
     public static final String POLICIES_READONLY_FLAG_PATH = "/admin/flags/policies-readonly";
     private static final String NAMESPACE_BASE_PATH = "/namespace";
     private static final String BUNDLE_DATA_BASE_PATH = "/loadbalance/bundle-data";
 
-    public NamespaceResources(MetadataStore configurationStore, int operationTimeoutSec) {
+    public NamespaceResources(MetadataStore localStore, MetadataStore configurationStore, int operationTimeoutSec) {

Review Comment:
   How about creating a separate class naming `BundleResources` to handle the bundle-date creating and deleting.  The reason is that:
   
   1. `NamespaceResources` will be null if `configurationMetadataStore != null` is false, so there is a chance to throw NPE when  call `NamespaceResources.deleteBundleDataAsync(..)` or `NamespaceResources.deleteBundleDataTenantAsync(...)`:
   
   https://github.com/apache/pulsar/blob/d099ac4fa2f217b9c5f0a5e660c83048e829c5d7/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/resources/PulsarResources.java#L60-L64
   
   2. `NamespaceResources#BUNDLE_DATA_BASE_PATH` and `ModularLoadManagerImpl#BUNDLE_DATA_PATH` are duplicated.  `BundleResources` could unify them. WDYT



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org