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

[NOID] Annotate unsafe procedures with @NotThreadSafe #452

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

pontusmelke
Copy link
Contributor

@pontusmelke pontusmelke commented Jul 4, 2023

[NOID] Annotate unsafe procedures with @NotThreadSafe

Proposed Changes

When run with parallel runtime not all operations on injected instances of Transaction and GraphDatabaseService are supported. By annotating these with @NotThreadSafe we can avoid runtime failures and we detect already at planning that we cannot run these procedures with parallel runtime.

NOTE: the NotThreadSafe annotation has been merged in dev but I guess we need to wait for it to become available?

Copy link
Collaborator

@ncordon ncordon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the criteria to mark something as not thread safe?

For example in coll.min, is it that we are trying to execute a transaction against the slotted runtime?

Is there any way we can test the changes are working correctly and that we haven't missed any annotations that are needed?

@pontusmelke pontusmelke changed the title Annotate unsafe procedures with @NotThreadSafe [NOID] Annotate unsafe procedures with @NotThreadSafe Aug 14, 2023
@pontusmelke
Copy link
Contributor Author

pontusmelke commented Aug 14, 2023

What's the criteria to mark something as not thread safe?

For example in coll.min, is it that we are trying to execute a transaction against the slotted runtime?

Is there any way we can test the changes are working correctly and that we haven't missed any annotations that are needed?

Not all operations on injected Transaction or GraphDatabaseService are supported. For example you are not allowed to initiate new transactions nor execute cypher statements when being called from the parallel runtime. So in the case of col.min it is the fact that it uses tx.execute that makes it unsafe to use from parallel runtime.

In order to verify I think we would need to run all tests with all available runtimes but I don't see any easy way of doing this change here.

@pontusmelke pontusmelke removed the NOT READY FOR MERGE PR isn't ready to be merged label Aug 14, 2023
@pontusmelke pontusmelke merged commit dc54bdf into dev Sep 8, 2023
11 of 12 checks passed
@pontusmelke pontusmelke deleted the dev-annotat-unsafe-proc branch September 8, 2023 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants