Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,8 @@ private void createPersistentTopic(final String topic, boolean createIfMissing,
}

if (isTransactionSystemTopic(topicName)) {
String msg = String.format("Can not create transaction system topic %s", topic);
String msg = String.format("Only has metadata, used for transactionCoordinator load balance, "
+ "never need to be created, for transaction system topic %s", topic);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah...it's funny.
@Anonymitaet Could you help review this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liangyepianzhou Sorry, I don't quite understand the meaning. Could you please explain a bit more?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, the current situation is that we have some system topics for lookup that only need to create metadata.
Then the user used admin to query this topic, but our error made the user confused and raised the issue.

Copy link
Contributor

@gaozhangmin gaozhangmin Mar 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore creation of transaction system topic, no need to create. @Anonymitaet. I think the meaning is.

log.warn(msg);
pulsar.getExecutor().execute(() -> topics.remove(topic, topicFuture));
topicFuture.completeExceptionally(new NotAllowedException(msg));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,17 @@ public void testCreateTransactionSystemTopic() throws Exception {
Consumer<byte[]> consumer = getConsumer(topicName, subName);
fail();
} catch (PulsarClientException.NotAllowedException e) {
assertTrue(e.getMessage().contains("Can not create transaction system topic"));
assertTrue(e.getMessage().contains("Only has metadata, used for transactionCoordinator load balance, "
+ "never need to be created, for transaction system topic "));
}

// can't create transaction system topic
try {
admin.topics().getSubscriptions(topicName);
fail();
} catch (PulsarAdminException e) {
assertEquals(e.getMessage(), "Can not create transaction system topic " + topicName);
assertEquals(e.getMessage(), "Only has metadata, used for transactionCoordinator load balance, "
+ "never need to be created, for transaction system topic " + topicName);
}

// can't create transaction system topic
Expand Down