You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/12/09 02:36:18 UTC

[GitHub] [pulsar] Jason918 commented on a change in pull request #13195: [pulsar-broker] Support of TopicLifecyclePolicies REST handler.

Jason918 commented on a change in pull request #13195:
URL: https://github.com/apache/pulsar/pull/13195#discussion_r765389268



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -2485,6 +2493,13 @@ private boolean shouldTopicBeRetained() {
         //If the topic-level policy already exists, the namespace-level policy cannot override the topic-level policy.
         Optional<TopicPolicies> topicPolicies = getTopicPolicies();
 
+        if (data.topicLifecycle != null) {

Review comment:
       We should update all topicPolicies values in `updateTopicPolicyByNamespacePolicy`

##########
File path: pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/TopicLifecyclePolicies.java
##########
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.common.policies.data;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * Topic life-cycle policies.
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class TopicLifecyclePolicies {
+
+    /**
+     * Whether topics should be automatically created when producers/consumers connect, or rather explicitly created
+     * through admin API.
+     */
+    private boolean autoCreateTopics;
+
+    /**
+     * Whether topics should be automatically deleted when inactive, or rather or rather explicitly deleted through

Review comment:
       Typo "or rather or rather" 
   

##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -2485,6 +2493,13 @@ private boolean shouldTopicBeRetained() {
         //If the topic-level policy already exists, the namespace-level policy cannot override the topic-level policy.
         Optional<TopicPolicies> topicPolicies = getTopicPolicies();
 
+        if (data.topicLifecycle != null) {
+            // reset new inactiveTopicPolicies with topicLifecycle info if one exists
+            this.topicPolicies.getInactiveTopicPolicies().updateBrokerValue(

Review comment:
       Why do we update `brokerValue` in namespace policy?




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