Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


IDIEP-103
Author
Sponsor
Created

 

Status


Status
colourBlue
title
DRAFT
IN PROGRESS

Table of Contents

Motivation

...

Deploys a deployment unit with identifier <deployment_unit_id> to the cluster.

Code Block
languagebash

$ ignite3 unit deploy <deployment_unit_id> --version <deployment_unit_version> --path <file>|<dir> 

...

The deployment unit must be uploaded to the CMG Raft group majority nodes and must include a leader in the current term (Fig. 1 shows an example of such a majority with an included leader but it is not mandatory). It will ensure that the system is able to detect the change of leader and deploy units correctly; the leader is always a part of the majority during the uploading process.

While majority nodes are available there is at least one node which has an uploaded deployment unit and this deployment unit could be deployed on another node on demand. Otherwise the cluster itself can’t operate correctly.

...

  1. Choose a majority which contains available nodes including a leader.
  2. Supplement chosen set of target nodes by user provided nodes if needed.
  3. Assign depOpId the meta storage revision number.
  4. Create meta storage record for given deployment unit clusterDURecord(depOpId, UPLOADING). This operation could fail because another process has already created a record for the same deployment unit in any status.
  5. Initiate uploading of files to the target nodes and create meta storage record for given deployment unit and node nodeDURecord(depOpId, UPLOADING, node).
  6. As soon as the deployment unit is uploaded to the node, nodeDURecord.status must be changed to DEPLOYED value - nodeDURecord(depOpId, DEPLOYED, node).
  7. As soon as the deployment unit is uploaded to the target nodes, clusterDURecord.status must be changed to DEPLOYED value - clusterDURecord(depOpId, DEPLOYED).

...

  1. Get a class loader which is identified by an array of DeploymentUnit instances passed to the called method.
  2. If the class loader doesn’t exist yet, then create it:
    1. If the deployment unit is deployed and can be used for code execution then use its location for class loading
    2. If the deployment unit is deployed to the cluster but is not deployed to the node then initiate deployment on-demand.
    3. If the deployment unit doesn’t exist, throw ClassNotFoundExceptionthe public DeploymentUnitUnavailableException with <class_fqdn>. Deployment unit <deployment_unit_id_and ver> doesn’t exist message, where <class_fqdn> is a compute job/class class name, <deployment_unit_id_and_ver> is a concatenation of ID and version (e.g. com.example:1.0.0).
    1. If the deployment unit exists but can’t be used for code execution, throw ClassNotFoundExceptionthe public DeploymentUnitUnavailableException with <class_fqdn>. Deployment unit <deployment_unit_id> can’t be used: [clusterStatus = <clusterDURecord.status>, nodeStatus = <nodeDURecord.status>] message, where <class_fqdn> is a compute job/class class name.
    1. For each deployment unit check that it is deployed:
    2. Check that deployment unit can be used for code execution:
  3. Load a class of task/job passed to the Compute API method as parameter. At this point ClassNotFoundException could be thrown from the class loader. Consider this exception as a job execution time exception (see the next step).
  4. Execute required code. At this point any standard Java exception or  job specific exception could be thrown. Consider any of these exceptions as a job execution time exception and throw public ComputeExecutionException which contains an original exception as a cause.

In order to have the possibility to detect that some code is in progress and uses some class loader a reference counter could be used. The counter must be incremented when job execution is started and decremented when code execution is finished.

...