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 2021/04/23 05:14:35 UTC

[GitHub] [pulsar] eolivelli commented on a change in pull request #10334: [Transaction] Fix MLTransactionLog open manageLedger name problem.

eolivelli commented on a change in pull request #10334:
URL: https://github.com/apache/pulsar/pull/10334#discussion_r618941725



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -302,7 +303,8 @@ public PersistentTopic(String topic, ManagedLedger ledger, BrokerService brokerS
 
         if (brokerService.getPulsar().getConfiguration().isTransactionCoordinatorEnabled()
                 && !checkTopicIsEventsNames(topic)
-                && !topic.contains(TopicName.TRANSACTION_COORDINATOR_ASSIGN.getLocalName())) {
+                && !topic.contains(TopicName.TRANSACTION_COORDINATOR_ASSIGN.getLocalName())
+                && !topic.contains(MLTransactionLogImpl.TRANSACTION_LOG_PREFIX)) {

Review comment:
       Can we use `startsWith` ?

##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/ManagedLedgerMetricsTest.java
##########
@@ -87,4 +94,19 @@ public void testManagedLedgerMetrics() throws Exception {
 
     }
 
+    @Test
+    public void testTransactionTopic() throws Exception {
+        admin.tenants().createTenant(NamespaceName.SYSTEM_NAMESPACE.getTenant(),
+                new TenantInfo(Sets.newHashSet("appid1"), Sets.newHashSet("test")));
+        admin.namespaces().createNamespace(NamespaceName.SYSTEM_NAMESPACE.toString());
+        admin.topics().createPartitionedTopic(TopicName.TRANSACTION_COORDINATOR_ASSIGN.toString(), 1);
+        ManagedLedgerConfig managedLedgerConfig = new ManagedLedgerConfig();
+        managedLedgerConfig.setMaxEntriesPerLedger(2);
+        new MLTransactionLogImpl(TransactionCoordinatorID.get(0),
+                pulsar.getManagedLedgerFactory(), managedLedgerConfig);
+        Thread.sleep(2000);

Review comment:
       Why do you need this sleep? Can we replace with Awaiatility in order to make the test more resilient?




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