Skip to content

Commit

Permalink
[fix][broker] Fix UnsupportedOperationException when update topic p…
Browse files Browse the repository at this point in the history
…roperties. (#20261)

(cherry picked from commit 0b4c29d)
  • Loading branch information
liangyepianzhou authored and poorbarcode committed May 30, 2023
1 parent c8e45aa commit 89da706
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import io.netty.buffer.CompositeByteBuf;
import io.netty.buffer.Unpooled;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -182,7 +181,7 @@ public void operationComplete(MLDataFormats.ManagedLedgerInfo mlInfo, Stat stat)
@Override
public void operationFailed(MetaStoreException e) {
if (e instanceof MetadataNotFoundException) {
result.complete(Collections.emptyMap());
result.complete(new HashMap<>());
} else {
result.completeExceptionally(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,22 @@ public void cleanup() throws Exception {
super.internalCleanup();
}

@Test
public void updatePropertiesForAutoCreatedTopicTest() throws Exception {
TopicName topicName = TopicName.get(
TopicDomain.persistent.value(),
NamespaceName.get(myNamespace),
"test-" + UUID.randomUUID()
);
String testTopic = topicName.toString();
@Cleanup
Producer<byte[]> producer = pulsarClient.newProducer().topic(testTopic).create();
HashMap<String, String> properties = new HashMap<>();
properties.put("backlogQuotaType", "message_age");
admin.topics().updateProperties(testTopic, properties);
admin.topics().delete(topicName.toString(), true);
}

@Test
public void testTopicPolicyInitialValueWithNamespaceAlreadyLoaded() throws Exception{
TopicName topicName = TopicName.get(
Expand Down

0 comments on commit 89da706

Please sign in to comment.