Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve][admin][branch-3.0] Expose the offload threshold in seconds to the admin #22169

Merged
merged 2 commits into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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).")
private String thresholdInSeconds = "-1";

@Override
void run() throws PulsarAdminException {
String namespace = validateNamespace(params);
long threshold = validateSizeString(thresholdStr);
long timeInSeconds = RelativeTimeUtil.parseRelativeTimeInSeconds(thresholdInSeconds);
getAdmin().namespaces().setOffloadThreshold(namespace, threshold);
getAdmin().namespaces().setOffloadThresholdInSeconds(namespace, timeInSeconds);
}
}

Expand Down
Loading