You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/03/14 03:56:18 UTC
[GitHub] [pulsar] murong00 opened a new pull request #6537: [Issue 5903]
Support `compact` all partitions of a partitioned topic
murong00 opened a new pull request #6537: [Issue 5903] Support `compact` all partitions of a partitioned topic
URL: https://github.com/apache/pulsar/pull/6537
### Motivation
Fixes #5903
If there is a partitioned topic with too many partitions, users need to `compact` one by one.
### Modifications
Async method `triggerCompaction` and support to get all partitions `compact` of a partitioned topic.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [pulsar] murong00 commented on a change in pull request #6537:
[Issue 5903] Support `compact` all partitions of a partitioned topic
Posted by GitBox <gi...@apache.org>.
murong00 commented on a change in pull request #6537: [Issue 5903] Support `compact` all partitions of a partitioned topic
URL: https://github.com/apache/pulsar/pull/6537#discussion_r393420155
##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/PersistentTopicsTest.java
##########
@@ -439,4 +439,33 @@ public void testRevokePartitionedTopic() {
Assert.assertEquals(partitionPermissions.get(role), null);
}
}
+
+ @Test
+ public void testTriggerCompactionTopic() {
+ final String partitionTopicName = "test-part";
+ final String nonPartitionTopicName = "test-non-part";
+
+ // trigger compaction on non-existing topic
+ AsyncResponse response = mock(AsyncResponse.class);
+ persistentTopics.compact(response, testTenant, testNamespace, "non-existing-topic", true);
+ ArgumentCaptor<RestException> errCaptor = ArgumentCaptor.forClass(RestException.class);
+ verify(response, timeout(5000).times(1)).resume(errCaptor.capture());
+ Assert.assertEquals(errCaptor.getValue().getResponse().getStatus(), Response.Status.NOT_FOUND.getStatusCode());
+
+ // create non partitioned topic and compaction on it
+ response = mock(AsyncResponse.class);
+ persistentTopics.createNonPartitionedTopic(testTenant, testNamespace, nonPartitionTopicName, true);
+ persistentTopics.compact(response, testTenant, testNamespace, nonPartitionTopicName, true);
+ ArgumentCaptor<Response> responseCaptor = ArgumentCaptor.forClass(Response.class);
+ verify(response, timeout(5000).times(1)).resume(responseCaptor.capture());
+ Assert.assertEquals(responseCaptor.getValue().getStatus(), Response.Status.NO_CONTENT.getStatusCode());
+
+ // create partitioned topic and compaction on it
Review comment:
Added a unit test to cover the compact logic and just keep this top level method call test.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [pulsar] sijie merged pull request #6537: [Issue 5903] Support
`compact` all partitions of a partitioned topic
Posted by GitBox <gi...@apache.org>.
sijie merged pull request #6537: [Issue 5903] Support `compact` all partitions of a partitioned topic
URL: https://github.com/apache/pulsar/pull/6537
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [pulsar] jiazhai commented on a change in pull request #6537:
[Issue 5903] Support `compact` all partitions of a partitioned topic
Posted by GitBox <gi...@apache.org>.
jiazhai commented on a change in pull request #6537: [Issue 5903] Support `compact` all partitions of a partitioned topic
URL: https://github.com/apache/pulsar/pull/6537#discussion_r392640439
##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/PersistentTopicsTest.java
##########
@@ -439,4 +439,33 @@ public void testRevokePartitionedTopic() {
Assert.assertEquals(partitionPermissions.get(role), null);
}
}
+
+ @Test
+ public void testTriggerCompactionTopic() {
+ final String partitionTopicName = "test-part";
+ final String nonPartitionTopicName = "test-non-part";
+
+ // trigger compaction on non-existing topic
+ AsyncResponse response = mock(AsyncResponse.class);
+ persistentTopics.compact(response, testTenant, testNamespace, "non-existing-topic", true);
+ ArgumentCaptor<RestException> errCaptor = ArgumentCaptor.forClass(RestException.class);
+ verify(response, timeout(5000).times(1)).resume(errCaptor.capture());
+ Assert.assertEquals(errCaptor.getValue().getResponse().getStatus(), Response.Status.NOT_FOUND.getStatusCode());
+
+ // create non partitioned topic and compaction on it
+ response = mock(AsyncResponse.class);
+ persistentTopics.createNonPartitionedTopic(testTenant, testNamespace, nonPartitionTopicName, true);
+ persistentTopics.compact(response, testTenant, testNamespace, nonPartitionTopicName, true);
+ ArgumentCaptor<Response> responseCaptor = ArgumentCaptor.forClass(Response.class);
+ verify(response, timeout(5000).times(1)).resume(responseCaptor.capture());
+ Assert.assertEquals(responseCaptor.getValue().getStatus(), Response.Status.NO_CONTENT.getStatusCode());
+
+ // create partitioned topic and compaction on it
Review comment:
@murong00 thanks for the contribute, Would you please help add a test that really called into and execute the compact? Seems this is only the top level method call, and not called into the methods, and some of the code in PersistentTopicsBase.java seems not covered.
If there is no ut framework for this, we could add a integration test for it.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [pulsar] murong00 commented on issue #6537: [Issue 5903] Support
`compact` all partitions of a partitioned topic
Posted by GitBox <gi...@apache.org>.
murong00 commented on issue #6537: [Issue 5903] Support `compact` all partitions of a partitioned topic
URL: https://github.com/apache/pulsar/pull/6537#issuecomment-599853940
@jiazhai I hava added a unit test to cover the compact logic, please help to take a look.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [pulsar] murong00 commented on issue #6537: [Issue 5903] Support
`compact` all partitions of a partitioned topic
Posted by GitBox <gi...@apache.org>.
murong00 commented on issue #6537: [Issue 5903] Support `compact` all partitions of a partitioned topic
URL: https://github.com/apache/pulsar/pull/6537#issuecomment-600612241
/pulsarbot run-failure-checks
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services