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

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


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

commit 6e988ef347ffdf31e77bc20882d84c4b6eb74adc
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)
    
    (cherry picked from commit 48c7e322fecfbcee0df758bdaf7e9b4263f2835e)
---
 .../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 998591f8177..28e8fb8d5f5 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
@@ -1962,7 +1962,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));
         }
     }
 
@@ -1980,11 +1981,18 @@ public class CmdNamespaces extends CmdBase {
                    required = true)
         private String thresholdStr = "-1";
 
+        @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);
             long threshold = validateSizeString(thresholdStr);
             getAdmin().namespaces().setOffloadThreshold(namespace, threshold);
+            getAdmin().namespaces().setOffloadThresholdInSeconds(namespace, 
thresholdInSeconds);
         }
     }
 

Reply via email to