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



##########
File path: 
pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/impl/BacklogQuotaImpl.java
##########
@@ -18,23 +18,83 @@
  */
 package org.apache.pulsar.common.policies.data.impl;
 
-import lombok.AllArgsConstructor;
-import lombok.Data;
+import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
+import lombok.ToString;
 import org.apache.pulsar.common.policies.data.BacklogQuota;
 
-@Data
-@AllArgsConstructor
+@ToString
+@EqualsAndHashCode
 @NoArgsConstructor
 public class BacklogQuotaImpl implements BacklogQuota {
     public static final long BYTES_IN_GIGABYTE = 1024 * 1024 * 1024;
 
-    // backlog quota by size in byte
-    private long limitSize;
-    // backlog quota by time in second
+    /**
+     * backlog quota by size in byte, remains for compatible.
+     */
+    @Deprecated
+    private Long limit;
+
+    /**
+     * backlog quota by size in byte.
+     */
+    private Long limitSize;
+
+    /**
+     * backlog quota by time in second.
+     */
     private int limitTime;
     private RetentionPolicy policy;
 
+    public BacklogQuotaImpl(long limitSize, int limitTime, RetentionPolicy 
policy) {
+        this.limitSize = limitSize;
+        this.limitTime = limitTime;
+        this.policy = policy;
+    }
+
+    @Deprecated
+    public long getLimit() {
+        if (limitSize == null) {
+            // the limitSize and limit can't be both null
+            return limit;
+        }
+        return limitSize;
+    }
+
+    @Deprecated
+    public void setLimit(long limit) {
+        this.limit = limit;
+        this.limitSize = limit;
+    }
+
+    public long getLimitSize() {
+        if (limitSize == null) {
+            // the limitSize and limit can't be both null
+            return limit;
+        }
+        return limitSize;
+    }
+
+    public void setLimitSize(long limitSize) {
+        this.limitSize = limitSize;

Review comment:
       If users use the new API, they will still encounter the problem, because 
`limit` will be 0, and for the old pulsar server, it only can accept the 
`limit` param.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to