apolloconfig / apollo

Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.
https://www.apolloconfig.com
Apache License 2.0
28.94k stars 10.19k forks source link

删除项目后异常 #5101

Closed Eleven-M closed 2 months ago

Eleven-M commented 3 months ago

image 项目删除后,仍可以在控制台看到,而且项目内部异常,无法再重新创建一个AppId一致的项目。

dosubot[bot] commented 3 months ago

哈哈,@Eleven-M,又见面了!遇到新问题了吗?希望这次我们也能快乐地解决它!

在Apollo中删除项目后,如果您仍然可以在控制台看到它,并且遇到内部错误,无法重新创建具有相同AppId的项目,可能是由于删除过程没有完全从系统中删除与AppId相关的所有引用或数据。在提供的AppController.java文件中,delete方法使用adminService.deleteApp(entity, operator);来删除应用程序。然而,没有看到adminService.deleteApp和相关服务(如数据库清理程序)的实现,很难确定确切的原因。可能的原因包括:

  1. 缓存:应用程序或中间件可能正在缓存项目详细信息,并且在删除后未使缓存失效。
  2. 数据库引用:数据库中可能存在剩余的引用或约束,阻止了项目数据的完全删除,导致不一致。
  3. 异步删除:如果删除过程是异步的,系统的所有组件可能需要一段时间才能识别到删除。
  4. 删除逻辑中的错误:删除过程中可能存在逻辑错误,未能删除所有必要的数据或未处理所有情况,特别是如果存在复杂的关系或依赖。

要解决这些问题,请确保:

没有adminService.deleteApp和相关组件的实现细节,这些都是基于Web应用程序中与删除操作相关的常见问题的推测性解决方案。

参考资料:

adminService.deleteApp方法在Apollo代码库中的确切实现是:

@Transactional
public void deleteApp(App app, String operator) {
  String appId = app.getAppId();

  logger.info("{} is deleting App:{}", operator, appId);

  List<Cluster> managedClusters = clusterService.findParentClusters(appId);

  // 1. delete clusters
  if (Objects.nonNull(managedClusters)) {
    for (Cluster cluster : managedClusters) {
      clusterService.delete(cluster.getId(), operator);
    }
  }

  // 2. delete appNamespace
  appNamespaceService.batchDelete(appId, operator);

  // 3. delete app
  appService.delete(app.getId(), operator);
}

参考资料:

Sources

#### About Dosu This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot.
BlackBear2003 commented 3 months ago

https://github.com/apolloconfig/apollo/issues/5076

nobodyiam commented 3 months ago

@Eleven-M 请描述下详细的复现步骤

stale[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

stale[bot] commented 2 months ago

This issue has been automatically closed because it has not had activity in the last 7 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.