eolivelli commented on a change in pull request #10326:
URL: https://github.com/apache/pulsar/pull/10326#discussion_r619163436
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/NonPersistentTopics.java
##########
@@ -374,6 +375,27 @@ public void getListFromBundle(
});
}
+ @DELETE
+ @Path("/{tenant}/{namespace}/{topic}/truncate")
+ @ApiOperation(value = "Truncate a topic.",
+ notes = "NonPersistentTopic is not support truncate.")
+ @ApiResponses(value = {
+ @ApiResponse(code = 412, message = "NonPersistentTopic is not
support truncate")
Review comment:
NonPersistentTopic **does** not support truncate
##########
File path:
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest.java
##########
@@ -1705,13 +1686,13 @@ public void testUnsubscribeOnNamespace(Integer
numBundles) throws Exception {
}
private List<MessageId> publishMessagesOnPersistentTopic(String topicName,
int messages, int startIdx,
- boolean nullValue) throws
Exception {
+ boolean
nullValue) throws Exception {
List<MessageId> messageIds = new ArrayList<>();
Producer<byte[]> producer = pulsarClient.newProducer(Schema.BYTES)
- .topic(topicName)
- .enableBatching(false)
- .messageRoutingMode(MessageRoutingMode.SinglePartition)
- .create();
+ .topic(topicName)
Review comment:
please do not reformat
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/PersistentTopics.java
##########
@@ -3096,5 +3096,30 @@ public void removeSubscribeRate(@Suspended final
AsyncResponse asyncResponse,
});
}
+ @DELETE
+ @Path("/{tenant}/{namespace}/{topic}/truncate")
+ @ApiOperation(value = "Truncate a topic.",
+ notes = "The latest ledger cannot be deleted ,and only delete
acknowledged ledgers.")
Review comment:
The latest ledger will not be deleted, and also only delete acknowledged
ledgers can be deleted.
##########
File path:
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdPersistentTopics.java
##########
@@ -286,6 +287,19 @@ void run() throws PulsarAdminException {
}
}
+ @Parameters(commandDescription = "Truncate a topic. \n"
+ + "\t\tThe topic will be truncate, but the latest ledger cannot be
deleted.")
Review comment:
"The topic will be truncated, but the latest ledger cannot be deleted"
##########
File path:
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java
##########
@@ -484,6 +485,19 @@ void run() throws PulsarAdminException {
}
}
+ @Parameters(commandDescription = "Truncate a topic. \n"
+ + "\t\tThe topic will be truncate, but the latest ledger cannot be
deleted.")
Review comment:
"The topic will be truncated, but the latest ledger cannot be deleted"
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -3922,4 +3922,66 @@ protected void internalHandleResult(AsyncResponse
asyncResponse,
}
}
}
+
+ protected void internalTruncateTopic(AsyncResponse asyncResponse) {
+
Review comment:
+1
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]