This is an automated email from the ASF dual-hosted git repository.

technoboy pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-3.2 by this push:
     new d5262762721 [improve][admin] Expose the offload threshold in seconds 
to the amdin (#22101)
d5262762721 is described below

commit d5262762721b1e8f8ff6c1ec29efd00c7684e6dd
Author: Yong Zhang <[email protected]>
AuthorDate: Fri Feb 23 20:23:38 2024 +0800

    [improve][admin] Expose the offload threshold in seconds to the amdin 
(#22101)
---
 .../main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java   | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git 
a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
 
b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
index f37d5b383f6..3463a697681 100644
--- 
a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
+++ 
b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
@@ -1935,7 +1935,8 @@ public class CmdNamespaces extends CmdBase {
         @Override
         void run() throws PulsarAdminException {
             String namespace = validateNamespace(params);
-            print(getAdmin().namespaces().getOffloadThreshold(namespace));
+            print("offloadThresholdInBytes: " + 
getAdmin().namespaces().getOffloadThreshold(namespace));
+            print("offloadThresholdInSeconds: " + 
getAdmin().namespaces().getOffloadThresholdInSeconds(namespace));
         }
     }
 
@@ -1954,10 +1955,17 @@ public class CmdNamespaces extends CmdBase {
                     converter = ByteUnitToLongConverter.class)
         private Long threshold = -1L;
 
+        @Parameter(names = {"--time", "-t"},
+            description = "Maximum number of seconds stored on the pulsar 
cluster for a topic"
+                + " before the broker will start offloading to longterm 
storage (eg: 10m, 5h, 3d, 2w).",
+            converter = TimeUnitToSecondsConverter.class)
+        private Long thresholdInSeconds = -1L;
+
         @Override
         void run() throws PulsarAdminException {
             String namespace = validateNamespace(params);
             getAdmin().namespaces().setOffloadThreshold(namespace, threshold);
+            getAdmin().namespaces().setOffloadThresholdInSeconds(namespace, 
thresholdInSeconds);
         }
     }
 

Reply via email to