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 2022/03/22 14:28:51 UTC

[GitHub] [pulsar] liangyepianzhou opened a new pull request #14803: [Fix][Transaction] Fix transaction can not be enable when allowAutoTopicCreation = false

liangyepianzhou opened a new pull request #14803:
URL: https://github.com/apache/pulsar/pull/14803


   Fix https://github.com/apache/pulsar/issues/14786
   ### Motivation
   Fix transaction can not be enable when allowAutoTopicCreation = false
   ### Modification
   create topic, no only metadata when init transaction
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - Dependencies (does it add or upgrade a dependency): (yes / no)
     - The public API: (yes / no)
     - The schema: (yes / no / don't know)
     - The default values of configurations: (yes / no)
     - The wire protocol: (yes / no)
     - The rest endpoints: (yes / no)
     - The admin cli options: (yes / no)
     - Anything that affects deployment: (yes / no / don't know)
   
   ### Documentation
   
   Check the box below or label this PR directly (if you have committer privilege).
   
   Need to update docs? 
   
   - [ ] `doc-required` 
     
     (If you need help on updating docs, create a doc issue)
     
   - [x] `no-need-doc` 
     
     (Please explain why)
     
   - [ ] `doc` 
     
     (If this PR contains doc changes)
   
   
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] liangyepianzhou removed a comment on pull request #14803: [Fix][Transaction] Fix transaction can not be enable when allowAutoTopicCreation = false

Posted by GitBox <gi...@apache.org>.
liangyepianzhou removed a comment on pull request #14803:
URL: https://github.com/apache/pulsar/pull/14803#issuecomment-1077579566






-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] liangyepianzhou commented on pull request #14803: [Fix][Transaction] Fix transaction can not be enable when allowAutoTopicCreation = false

Posted by GitBox <gi...@apache.org>.
liangyepianzhou commented on pull request #14803:
URL: https://github.com/apache/pulsar/pull/14803#issuecomment-1077579566


   /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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] liangyepianzhou commented on pull request #14803: [Fix][Transaction] Fix transaction can not be enable when allowAutoTopicCreation = false

Posted by GitBox <gi...@apache.org>.
liangyepianzhou commented on pull request #14803:
URL: https://github.com/apache/pulsar/pull/14803#issuecomment-1077781004


   /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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] liangyepianzhou commented on pull request #14803: [Fix][Transaction] Fix transaction can not be enable when allowAutoTopicCreation = false

Posted by GitBox <gi...@apache.org>.
liangyepianzhou commented on pull request #14803:
URL: https://github.com/apache/pulsar/pull/14803#issuecomment-1079830227


   /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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] liangyepianzhou commented on pull request #14803: [Fix][Transaction] Fix transaction can not be enable when allowAutoTopicCreation = false

Posted by GitBox <gi...@apache.org>.
liangyepianzhou commented on pull request #14803:
URL: https://github.com/apache/pulsar/pull/14803#issuecomment-1079850021


   /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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] liangyepianzhou closed pull request #14803: [Fix][Transaction] Fix transaction can not be enable when allowAutoTopicCreation = false

Posted by GitBox <gi...@apache.org>.
liangyepianzhou closed pull request #14803:
URL: https://github.com/apache/pulsar/pull/14803


   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] liangyepianzhou commented on pull request #14803: [Fix][Transaction] Fix transaction can not be enable when allowAutoTopicCreation = false

Posted by GitBox <gi...@apache.org>.
liangyepianzhou commented on pull request #14803:
URL: https://github.com/apache/pulsar/pull/14803#issuecomment-1078570066


   /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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] liangyepianzhou commented on pull request #14803: [Fix][Transaction] Fix transaction can not be enable when allowAutoTopicCreation = false

Posted by GitBox <gi...@apache.org>.
liangyepianzhou commented on pull request #14803:
URL: https://github.com/apache/pulsar/pull/14803#issuecomment-1080174198


   /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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] liangyepianzhou commented on pull request #14803: [Fix][Transaction] Fix transaction can not be enable when allowAutoTopicCreation = false

Posted by GitBox <gi...@apache.org>.
liangyepianzhou commented on pull request #14803:
URL: https://github.com/apache/pulsar/pull/14803#issuecomment-1075940920


   > How about the transaction log topic and transaction buffer snapshot topic? they will create allow auto-creation or not?
   Transaction Log is to open a manager Ledger directly, and Transaction buffer can be created automatically.
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui commented on a change in pull request #14803: [Fix][Transaction] Fix transaction can not be enable when allowAutoTopicCreation = false

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #14803:
URL: https://github.com/apache/pulsar/pull/14803#discussion_r832913624



##########
File path: tests/integration/src/test/java/org/apache/pulsar/tests/integration/transaction/TransactionTest.java
##########
@@ -159,4 +165,17 @@ public void transferNormalTest(Supplier<String> serviceUrl) throws Exception {
         log.info("transfer normal test finish.");
     }
 
+    @Test(dataProvider = "ServiceAndAdminUrls")
+    public void testAutoCreatePartitionTopicOfTC(Supplier<String> serviceUrl, Supplier<String> adminUrl) throws Exception {
+        log.info("create transaction coordinator test start.");
+
+        @Cleanup
+        PulsarAdmin admin = PulsarAdmin.builder().serviceHttpUrl(adminUrl.get()).build();
+
+        Awaitility.await().untilAsserted(() ->
+                Assert.assertTrue(admin.topics().getList(TopicName.TRANSACTION_COORDINATOR_ASSIGN.getNamespace())
+                .contains(TopicName.TRANSACTION_COORDINATOR_ASSIGN.toString())));

Review comment:
       Will fail here if the coordinator assign topic is a partitioned topic.

##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
##########
@@ -2707,7 +2708,9 @@ public boolean isAllowAutoTopicCreation(final String topic) {
 
     public boolean isAllowAutoTopicCreation(final TopicName topicName) {
         //System topic can always be created automatically
-        if (pulsar.getConfiguration().isSystemTopicEnabled() && checkTopicIsEventsNames(topicName)) {
+        if (pulsar.getConfiguration().isSystemTopicEnabled() && checkTopicIsEventsNames(topicName)
+                || pulsar.getConfiguration().isTransactionCoordinatorEnabled()
+                && checkTopicIsTransactionCoordinatorAssign(topicName)) {

Review comment:
       All the system topics should able to create automatically after the system topic is enabled.

##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
##########
@@ -2707,7 +2708,9 @@ public boolean isAllowAutoTopicCreation(final String topic) {
 
     public boolean isAllowAutoTopicCreation(final TopicName topicName) {
         //System topic can always be created automatically
-        if (pulsar.getConfiguration().isSystemTopicEnabled() && checkTopicIsEventsNames(topicName)) {
+        if (pulsar.getConfiguration().isSystemTopicEnabled() && checkTopicIsEventsNames(topicName)
+                || pulsar.getConfiguration().isTransactionCoordinatorEnabled()
+                && checkTopicIsTransactionCoordinatorAssign(topicName)) {

Review comment:
       ```suggestion
           if (pulsar.getConfiguration().isSystemTopicEnabled() && isSystemTopic(topicName)) {
   ```




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] liangyepianzhou removed a comment on pull request #14803: [Fix][Transaction] Fix transaction can not be enable when allowAutoTopicCreation = false

Posted by GitBox <gi...@apache.org>.
liangyepianzhou removed a comment on pull request #14803:
URL: https://github.com/apache/pulsar/pull/14803#issuecomment-1079830227


   /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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] gaoran10 commented on a change in pull request #14803: [Fix][Transaction] Fix transaction can not be enable when allowAutoTopicCreation = false

Posted by GitBox <gi...@apache.org>.
gaoran10 commented on a change in pull request #14803:
URL: https://github.com/apache/pulsar/pull/14803#discussion_r833894512



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
##########
@@ -2836,7 +2835,7 @@ public boolean isAllowAutoTopicCreation(final String topic) {
 
     public boolean isAllowAutoTopicCreation(final TopicName topicName) {
         //System topic can always be created automatically
-        if (pulsar.getConfiguration().isSystemTopicEnabled() && checkTopicIsEventsNames(topicName)) {
+        if (pulsar.getConfiguration().isSystemTopicEnabled() && isSystemTopic(topicName)) {

Review comment:
       Do we need to check the system topic is enabled?




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] liangyepianzhou commented on a change in pull request #14803: [Fix][Transaction] Fix transaction can not be enable when allowAutoTopicCreation = false

Posted by GitBox <gi...@apache.org>.
liangyepianzhou commented on a change in pull request #14803:
URL: https://github.com/apache/pulsar/pull/14803#discussion_r833923824



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
##########
@@ -2836,7 +2835,7 @@ public boolean isAllowAutoTopicCreation(final String topic) {
 
     public boolean isAllowAutoTopicCreation(final TopicName topicName) {
         //System topic can always be created automatically
-        if (pulsar.getConfiguration().isSystemTopicEnabled() && checkTopicIsEventsNames(topicName)) {
+        if (pulsar.getConfiguration().isSystemTopicEnabled() && isSystemTopic(topicName)) {

Review comment:
       Why not?




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org