Skip to content

Commit 926b01d

Browse files
committed
Unload bundle instead of clean tableview
1 parent 81d4bc0 commit 926b01d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImplTest.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -612,13 +612,23 @@ public void initialize(PulsarService pulsar) {
612612

613613
}
614614

615-
private static void cleanTableView(ServiceUnitStateChannel channel)
615+
private void cleanTableView(ServiceUnitStateChannel channel)
616616
throws IllegalAccessException {
617617
var tv = (TableViewImpl<ServiceUnitStateData>)
618618
FieldUtils.readField(channel, "tableview", true);
619619
var cache = (ConcurrentMap<String, ServiceUnitStateData>)
620620
FieldUtils.readField(tv, "data", true);
621-
cache.clear();
621+
cache.forEach((k, v) -> {
622+
try {
623+
int i = k.lastIndexOf("/");
624+
String namespace = k.substring(0, i);
625+
String bundle = k.substring(i + 1);
626+
admin.namespaces().unloadNamespaceBundle(namespace, bundle);
627+
} catch (Exception e) {
628+
throw new RuntimeException(e);
629+
}
630+
});
631+
// cache.clear();
622632
}
623633

624634
private CompletableFuture<NamespaceBundle> getBundleAsync(PulsarService pulsar, TopicName topic) {

0 commit comments

Comments
 (0)