Skip to content
Merged
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 @@ -1600,7 +1600,7 @@ private void doCleanup(String broker, boolean gracefully) {
// clean system bundles in the end
var orphanSystemServiceUnitIter = orphanSystemServiceUnits.entrySet().iterator();
while (orphanSystemServiceUnitIter.hasNext()) {
var orphanSystemServiceUnit = iter.next();
var orphanSystemServiceUnit = orphanSystemServiceUnitIter.next();
log.info("Overriding orphan system service unit:{}", orphanSystemServiceUnit.getKey());
overrideFutures.add(
overrideOwnership(orphanSystemServiceUnit.getKey(), orphanSystemServiceUnit.getValue(), broker,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1897,6 +1897,26 @@ public void unloadTimeoutCheckTest()
TimeUnit.SECONDS).get(2, TimeUnit.SECONDS);
}

@Test(priority = 23)
public void testCleanSystemTopicOwnership()
throws Exception {
String topic = "persistent://pulsar/system/test-system-topic";
NamespaceBundle bundleName = pulsar.getNamespaceService().getBundle(TopicName.get(topic));
var releasing = new ServiceUnitStateData(Releasing, pulsar2.getBrokerId(), pulsar1.getBrokerId(), 1);
doReturn(CompletableFuture.completedFuture(Optional.of(brokerId1)))
.when(loadManager).selectAsync(any(), any(), any());

try {
disableChannels();
overrideTableView(channel1, bundleName.toString(), releasing);
} finally {
enableChannels();
}

channel1.cleanOwnerships();
channel2.cleanOwnerships();
}


private static ConcurrentHashMap<String, CompletableFuture<Optional<String>>> getOwnerRequests(
ServiceUnitStateChannel channel) throws IllegalAccessException {
Expand Down