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

[#643] improvement(core): Improve and fix the possible concurrent problem when visiting EntityStore #654

Merged
merged 6 commits into from
Nov 3, 2023

Conversation

yuqi1129
Copy link
Contributor

@yuqi1129 yuqi1129 commented Nov 1, 2023

What changes were proposed in this pull request?

Introducing the reentrantReadWriteLock to alleviate possible concurrent problems to access the KvEntityStore

Why are the changes needed?

KvEntityStore subjects to concurrent problems when multi-thread access it at the same time. For instance, if there are
multiple threads are attempting to save the entity with the same name identifier into the store. We must ensure that the entity can only be saved successfully once.

Fix: #643
Fix: #618

Does this PR introduce any user-facing change?

No

How was this patch tested?

New test case named testConcurrentIssues in TestKvEntityStorage added.

@yuqi1129 yuqi1129 closed this Nov 2, 2023
@yuqi1129 yuqi1129 reopened this Nov 2, 2023
Copy link

github-actions bot commented Nov 2, 2023

Code Coverage Report

Overall Project 67.24% 🟢
Files changed 100% 🟢

Module Coverage
core 74.81% 🟢
Files
Module File Coverage
core KvEntityStore.java 94.85% 🟢

@yuqi1129 yuqi1129 closed this Nov 2, 2023
@yuqi1129 yuqi1129 reopened this Nov 2, 2023
@yuqi1129 yuqi1129 self-assigned this Nov 2, 2023
Assertions.assertEquals(9, totalFailed);

} finally {
FileUtils.deleteDirectory(FileUtils.getFile("/tmp/testConcurrentIssues"));
Copy link
Contributor

@qqqttt123 qqqttt123 Nov 2, 2023

Choose a reason for hiding this comment

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

Could we use the TempDir of Junit here? We don't need care the deletion of the file if we use TempDir.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea.

@yuqi1129 yuqi1129 added this to the Graviton 0.3.0 milestone Nov 3, 2023
@jerryshao
Copy link
Contributor

The current change LGTM. @qqqttt123 do you have any more comment?

@jerryshao jerryshao merged commit 53a9cab into apache:main Nov 3, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants