Skip to content

Commit 102fb53

Browse files
author
nicklixinyang
committed
add unit test and documents
1 parent 74a784a commit 102fb53

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

Diff for: pulsar-client-tools-test/src/test/java/org/apache/pulsar/admin/cli/PulsarAdminToolTest.java

+11
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,17 @@ public void topicPolicies() throws Exception {
13391339
.setOffloadPolicies("persistent://myprop/clust/ns1/ds1",
13401340
OffloadPoliciesImpl.create("s3", "region", "bucket" , "endpoint", null, null, null, null,
13411341
8, 9, 10L, null, OffloadedReadPriority.TIERED_STORAGE_FIRST));
1342+
1343+
// test the set offload policies don't cover old value
1344+
cmdTopics = new CmdTopicPolicies(() -> admin);
1345+
cmdTopics.run(split("set-offload-policies persistent://myprop/clust/ns1/ds1 -d s3 -r" +
1346+
" region -b bucket -t 10 -e endpoint -orp tiered-storage-first -g"));
1347+
verify(mockGlobalTopicsPolicies)
1348+
.setOffloadPolicies("persistent://myprop/clust/ns1/ds1",
1349+
OffloadPoliciesImpl.create("s3", "region", "bucket" , "endpoint", null, null, null, null,
1350+
OffloadPoliciesImpl.DEFAULT_MAX_BLOCK_SIZE_IN_BYTES, OffloadPoliciesImpl.DEFAULT_READ_BUFFER_SIZE_IN_BYTES, 10L,
1351+
OffloadPoliciesImpl.DEFAULT_OFFLOAD_DELETION_LAG_IN_MILLIS, OffloadedReadPriority.TIERED_STORAGE_FIRST));
1352+
13421353
}
13431354

13441355
@Test

Diff for: site2/docs/reference-pulsar-admin.md

+29
Original file line numberDiff line numberDiff line change
@@ -2470,6 +2470,35 @@ Options
24702470
|`-w`, `--wait-complete`|Wait for compaction to complete|false|
24712471

24722472

2473+
### `set-offload-policies`
2474+
Set the offload policy for a topic.
2475+
2476+
Usage
2477+
2478+
```bash
2479+
2480+
$ pulsar-admin topic set-offload-policies tenant/namespace/topic options
2481+
2482+
```
2483+
2484+
Options
2485+
2486+
|Flag|Description|Default|
2487+
|----|---|---|
2488+
|`-d`, `--driver`|Driver to use to offload old data to long term storage,(Possible values: S3, aws-s3, google-cloud-storage)||
2489+
|`-r`, `--region`|The long term storage region||
2490+
|`-b`, `--bucket`|Bucket to place offloaded ledger into||
2491+
|`-e`, `--endpoint`|Alternative endpoint to connect to||
2492+
|`-i`, `--aws-id`|AWS Credential Id to use when using driver S3 or aws-s3||
2493+
|`-s`, `--aws-secret`|AWS Credential Secret to use when using driver S3 or aws-s3||
2494+
|`-ro`, `--s3-role`|S3 Role used for STSAssumeRoleSessionCredentialsProvider using driver S3 or aws-s3||
2495+
|`-rsn`, `--s3-role-session-name`|S3 role session name used for STSAssumeRoleSessionCredentialsProvider using driver S3 or aws-s3||
2496+
|`-m`, `--maxBlockSizeInBytes`|Max block size|64MB|
2497+
|`-rb`, `--readBufferSizeInBytes`|Read buffer size|1MB|
2498+
|`-t`, `--offloadThresholdInBytes`|Offload after threshold size (eg: 1M, 5M)||
2499+
|`-dl`, `--offloadDeletionLagInMillis`|Offload after elapsed in millis (or minutes, hours,days,weeks eg: 100m, 3h, 2d, 5w).||
2500+
2501+
24732502
### `create-partitioned-topic`
24742503
Create a partitioned topic. A partitioned topic must be created before producers can publish to it.
24752504

0 commit comments

Comments
 (0)