Commit 00723403 authored by nobodyiam's avatar nobodyiam

fix the situation when some public app namespace is deleted and recreated in another app

parent 59660027
...@@ -131,6 +131,12 @@ public class AppNamespaceService { ...@@ -131,6 +131,12 @@ public class AppNamespaceService {
List<Cluster> clusters = clusterService.findParentClusters(appId); List<Cluster> clusters = clusterService.findParentClusters(appId);
for (Cluster cluster : clusters) { for (Cluster cluster : clusters) {
// in case there is some dirty data, e.g. public namespace deleted in other app and now created in this app
if (!namespaceService.isNamespaceUnique(appId, cluster.getName(), namespaceName)) {
continue;
}
Namespace namespace = new Namespace(); Namespace namespace = new Namespace();
namespace.setClusterName(cluster.getName()); namespace.setClusterName(cluster.getName());
namespace.setAppId(appId); namespace.setAppId(appId);
......
...@@ -247,7 +247,11 @@ public class AppNamespaceServiceWithCache implements InitializingBean { ...@@ -247,7 +247,11 @@ public class AppNamespaceServiceWithCache implements InitializingBean {
} }
appNamespaceCache.remove(assembleAppNamespaceKey(deleted)); appNamespaceCache.remove(assembleAppNamespaceKey(deleted));
if (deleted.isPublic()) { if (deleted.isPublic()) {
publicAppNamespaceCache.remove(deleted.getName()); AppNamespace publicAppNamespace = publicAppNamespaceCache.get(deleted.getName());
// in case there is some dirty data, e.g. public namespace deleted in some app and now created in another app
if (publicAppNamespace == deleted) {
publicAppNamespaceCache.remove(deleted.getName());
}
} }
logger.info("Found AppNamespace deleted, {}", deleted); logger.info("Found AppNamespace deleted, {}", deleted);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment