codelipenghui commented on a change in pull request #7093:
URL: https://github.com/apache/pulsar/pull/7093#discussion_r432902783



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java
##########
@@ -423,5 +428,13 @@ public long getBytesOutCounter() {
         return getStats(false).bytesOutCounter;
     }
 
+    public boolean isBrokerDeleteInactiveTopicsEnabled() {
+        return brokerDeleteInactiveTopicsEnabled;
+    }
+
+    public void setBrokerDeleteInactiveTopicsEnabled(boolean 
brokerDeleteInactiveTopicsEnabled) {

Review comment:
       @merlimat This is used by the protocol handlers who want to ensure some 
topics under the namespace does not delete by the broker. But do not want to 
change the namespace level policy. Now, we don't have a topic level policy, 
without this change, we must create a virtual producer or consume.

##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java
##########
@@ -63,6 +63,9 @@
 
     protected volatile boolean isFenced;
 
+    // When set to false, this inactive topic can not be deleted
+    protected boolean brokerDeleteInactiveTopicsEnabled;

Review comment:
       I think it's better to named `deleteWhileInactive`.

##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
##########
@@ -830,6 +830,10 @@ public boolean isActive() {
 
     @Override
     public void checkGC(int maxInactiveDurationInSec, InactiveTopicDeleteMode 
deleteMode) {
+        if (brokerDeleteInactiveTopicsEnabled) {

Review comment:
       ```suggestion
           if (! brokerDeleteInactiveTopicsEnabled) {
   ```

##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -1636,6 +1629,10 @@ private boolean hasBacklogs() {
 
     @Override
     public void checkGC(int maxInactiveDurationInSec, InactiveTopicDeleteMode 
deleteMode) {
+        if (brokerDeleteInactiveTopicsEnabled) {

Review comment:
       ```suggestion
           if (!brokerDeleteInactiveTopicsEnabled) {
   ```




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

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


Reply via email to