Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
[improve][admin] Expose the offload threshold in seconds to the amdin (
Browse files Browse the repository at this point in the history
…apache#22101)

(cherry picked from commit 48c7e32)
  • Loading branch information
zymap authored and heesung-sn committed Feb 27, 2024
1 parent e2ffea1 commit 6e988ef
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1962,7 +1962,8 @@ private class GetOffloadThreshold extends CliCommand {
@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));
}
}

Expand All @@ -1980,11 +1981,18 @@ private class SetOffloadThreshold extends CliCommand {
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);
}
}

Expand Down

0 comments on commit 6e988ef

Please sign in to comment.