poorbarcode commented on code in PR #19715:
URL: https://github.com/apache/pulsar/pull/19715#discussion_r1126039184
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/v3/AdminApiTransactionMultiBrokerTest.java:
##########
@@ -46,21 +47,25 @@ protected void cleanup() throws Exception {
super.internalCleanup();
}
+ /**
+ * This test is used to verify the redirect request of
`getCoordinatorInternalStats`.
+ * <p>
+ * 1. Set up 16 broker and create 3 transaction coordinator topic.
+ * 2. The 3 transaction coordinator topic will be assigned to these
brokers through some kind of
+ * load-balancing strategy. (In current implementations, they tend to
be assigned to a broker.)
+ * 3. Find a broker x which is not the owner of the transaction
coordinator topic.
+ * 4. Create a admin connected to broker x, and use the admin to call
` getCoordinatorInternalStats`.
+ * </p>
+ */
@Test
public void testRedirectOfGetCoordinatorInternalStats() throws Exception {
Map<String, String> map = admin.lookups()
.lookupPartitionedTopic(SystemTopicNames.TRANSACTION_COORDINATOR_ASSIGN.toString());
- while
(map.containsValue(getPulsarServiceList().get(0).getBrokerServiceUrl())) {
- pulsarServiceList.get(0).getPulsarResources()
- .getNamespaceResources()
- .getPartitionedTopicResources()
-
.deletePartitionedTopicAsync(SystemTopicNames.TRANSACTION_COORDINATOR_ASSIGN);
- pulsarServiceList.get(0).getPulsarResources()
- .getNamespaceResources()
- .getPartitionedTopicResources()
-
.createPartitionedTopic(SystemTopicNames.TRANSACTION_COORDINATOR_ASSIGN,
- new PartitionedTopicMetadata(NUM_PARTITIONS));
- map =
admin.lookups().lookupPartitionedTopic(SystemTopicNames.TRANSACTION_COORDINATOR_ASSIGN.toString());
+
+ for (int i = 0;
map.containsValue(getPulsarServiceList().get(i).getBrokerServiceUrl()); i++) {
Review Comment:
Why not create a new `admin` connected to the broker who not contains the
TXN coordinator?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]