Pochatkin commented on code in PR #2102: URL: https://github.com/apache/ignite-3/pull/2102#discussion_r1210086064
########## modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/DeploymentManagerImpl.java: ########## @@ -111,10 +115,38 @@ public DeploymentManagerImpl(ClusterService clusterService, this.configuration = configuration; this.cmgManager = cmgManager; this.workDir = workDir; - this.tracker = new DeployTracker(); - metastore = new DeploymentUnitStoreImpl(metaStorage); + tracker = new DeployTracker(); deployer = new FileDeployerService(); messaging = new DeployMessagingService(clusterService, cmgManager, deployer, tracker); + deploymentUnitStore = new DeploymentUnitStoreImpl(metaStorage, + () -> this.clusterService.topologyService().localMember().name(), + this::onUnitRegister); + } + + private void onUnitRegister(UnitNodeStatus status, Set<String> deployedNodes) { + if (status.status() == UPLOADING) { + messaging.downloadUnitContent(status.id(), status.version(), new ArrayList<>(deployedNodes)) + .thenCompose(content -> deployer.deploy(status.id(), status.version(), content)) + .thenApply(deployed -> { + if (deployed) { + return deploymentUnitStore.updateNodeStatus( + clusterService.topologyService().localMember().name(), + status.id(), + status.version(), + DEPLOYED); + } + return deployed; + }); + } else if (status.status() == DEPLOYED) { + deploymentUnitStore.getClusterStatus(status.id(), status.version()) + .thenApply(UnitClusterStatus::initialNodesToDeploy) + .thenApply(deployedNodes::containsAll) + .thenAccept(allRequiredDeployed -> { + if (allRequiredDeployed) { + deploymentUnitStore.updateClusterStatus(status.id(), status.version(), DEPLOYED); Review Comment: No, this code executed only on node where unit deployed and this is last required node for initial deploy. -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org