leizhiyuan opened a new issue, #15113:
URL: https://github.com/apache/pulsar/issues/15113
**Describe the bug**
A clear and concise description of what the bug is.
```
public ResourceGroupConfigListener(ResourceGroupService rgService,
PulsarService pulsarService) {
this.rgService = rgService;
this.pulsarService = pulsarService;
this.rgResources =
pulsarService.getPulsarResources().getResourcegroupResources();
loadAllResourceGroups(); // THIS IS ASYNC 1
this.rgResources.getStore().registerListener(this);
rgNamespaceConfigListener = new ResourceGroupNamespaceConfigListener(
rgService, pulsarService, this);
}
```
loadAllResourceGroups(); // THIS IS ASYNC 1
add invoke
resourceGroupsMap.put(rgName, rg);
```
public ResourceGroupNamespaceConfigListener(ResourceGroupService
rgService, PulsarService pulsarService,
ResourceGroupConfigListener rgConfigListener) {
this.rgService = rgService;
this.pulsarService = pulsarService;
this.namespaceResources =
pulsarService.getPulsarResources().getNamespaceResources();
this.tenantResources =
pulsarService.getPulsarResources().getTenantResources();
this.rgConfigListener = rgConfigListener;
loadAllNamespaceResourceGroups(); // THIS IS ASYNC 2
this.namespaceResources.getStore().registerListener(this);
}
```
loadAllNamespaceResourceGroups(); // THIS IS ASYNC 2
will invoke
rgService.registerNameSpace(policy.resource_group_name, ns);
then
```
private ResourceGroup checkResourceGroupExists(String rgName) throws
PulsarAdminException {
ResourceGroup rg = this.getResourceGroupInternal(rgName);
if (rg == null) {
throw new PulsarAdminException("Resource group does not exist: "
+ rgName);
}
return rg;
}
```
inside
```
/**
* Get the RG with the given name. For internal operations only.
*/
private ResourceGroup getResourceGroupInternal(String resourceGroupName)
{
if (resourceGroupName == null) {
throw new IllegalArgumentException("Invalid null resource group
name: " + resourceGroupName);
}
return resourceGroupsMap.get(resourceGroupName);
}
```
if 2 run earlier than 1, it will occur error, if no resource group is added,
it won't recover.
**To Reproduce**
review the code
**Expected behavior**
A clear and concise description of what you expected to happen.
maybe we need loadAllResourceGroups sync, or when it done, then
loadAllNamespaceResourceGroups
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
**Additional context**
Add any other context about the problem here.
master branch
--
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]