Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure consistent strategy to update MICO resources #690

Open
davidkopp opened this issue Mar 28, 2019 · 0 comments
Open

Ensure consistent strategy to update MICO resources #690

davidkopp opened this issue Mar 28, 2019 · 0 comments
Labels
question Further information is requested

Comments

@davidkopp
Copy link
Contributor

davidkopp commented Mar 28, 2019

Updating of existing MICO resources is unfortunately quite error prone because of the save approach of the Neo4j-OGM. If the particular entity that should be updated does not have all properties set, the relations are deleted.
Example: If a MICO service already has service interfaces and is updated without these service interfaces set, the relations to these nodes are deleted in the Neo4j database.

There are multiple ways to handle this:

  1. Set the nested objects to the new entity before the save operation
  2. Apply the new values directly from the DTO onto the existing entity from the database (see the MicoServiceDeploymentInfo resource as an example).
  3. Change the depth of the save operation e.g. to 0. That won't delete any edge in the database. However that is not always possible because sometimes also the nested objects have to be updated (e.g. MicoServiceDeploymentInfo → depth of 1 would be necessary to updated the nested objects but can't be used because it has the potential of deleting the relation to the corresponding MicoService node). See issue Adjust DEPTH Parameter for Repository Save's Individually #646.

Currently we use a mix of these options. I recommend to not use option 1 anymore, because it is too error prone. Especially because sometimes the object should be updated with new relationships (must not be overwritten by the existing relationships) and sometimes only the simple values should be updated. I prefer to use both 2 and 3:

  • Limit the depth parameter where it is possible to a minimal value.
  • Use the request DTO in the Broker to be able to apply the new values directly onto the existing database entities (no danger to accidentally delete any existing relationships).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant