mattisonchao commented on code in PR #17349:
URL: https://github.com/apache/pulsar/pull/17349#discussion_r964932039
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java:
##########
@@ -162,6 +162,21 @@ protected CompletableFuture<Void>
tryCreatePartitionsAsync(int numPartitions) {
return FutureUtil.waitForAll(futures);
}
+ protected CompletableFuture<Void> tryCreateExtendedPartitionsAsync(int
oldNumPartitions, int numPartitions) {
+ if (!topicName.isPersistent()) {
+ return CompletableFuture.completedFuture(null);
+ }
+ if (numPartitions <= oldNumPartitions) {
+ return CompletableFuture.failedFuture(new
RestException(Status.NOT_ACCEPTABLE,
+ "Number of new partitions must be greater than existing
number of partitions"));
+ }
+ List<CompletableFuture<Void>> futures = new ArrayList<>(numPartitions
- oldNumPartitions);
+ for (int i = oldNumPartitions; i < numPartitions; i++) {
+ futures.add(tryCreatePartitionAsync(i, null));
+ }
Review Comment:
We need to discuss this in ML. Thanks a lot for you point it out.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]