pingtimeout opened a new pull request, #1339:
URL: https://github.com/apache/polaris/pull/1339
<!--
Possible security vulnerabilities: STOP here and contact
[email protected] instead!
Please update the title of the PR with a meaningful message - do not
leave it "empty" or "generated"
Please update this summary field:
The summary should cover these topics, if applicable:
* the motivation for the change
* a description of the status quo, for example the current behavior
* the desired behavior
* etc
PR checklist:
- Do a self-review of your code before opening a pull request
- Make sure that there's good test coverage for the changes included in
this PR
- Run tests locally before pushing a PR (./gradlew check)
- Code should have comments where applicable. Particularly
hard-to-understand
areas deserve good in-line documentation.
- Include changes and enhancements to the documentation (in
site/content/in-dev/unreleased)
- For Work In Progress Pull Requests, please use the Draft PR feature.
Make sure to add the information BELOW this comment.
Everything in this comment will NOT be added to the PR description.
-->
This pull request introduces the integration of JCStress tests into the
Polaris project to enhance concurrency testing. It also includes a rewrite of
the `EntityCache` class to fix concurrency issues that are surfaced by the
JCStress tests. Fixes #761.
The most important changes include adding new dependencies, configuring the
JCStress plugin, and creating several JCStress test cases for concurrency
validation of the `EntityCache` class.
### Dependency and Configuration Additions:
*
[`bom/build.gradle.kts`](diffhunk://#diff-f11ddd31805406938cbae2a53975b7f8af4fdcabea69384d213067d5e0a76eb9R53):
Added `polaris-jcstress-tests` to the project dependencies.
*
[`gradle/libs.versions.toml`](diffhunk://#diff-697f70cdd88ba88fe77eebda60c7e143f6ad1286bca75017421e93ad84fb87dfR100):
Added the JCStress plugin with version `0.8.15`, released under the ASLv2.
* Indirect test dependency: https://github.com/openjdk/jcstress/, released
under the GPLv2
### EntityCache concurrency tests:
*
[`jcstress-tests/src/jcstress/java/org/apache/polaris/core/persistence/cache/EntityCacheCoherenceTest.java`](diffhunk://#diff-e58c84b84664d563ef6f2d899c80904455d950bc3a6d47aa972da1b6400794acR1-R175):
Added tests to ensure the coherence of the `EntityCache` when accessed
concurrently by multiple threads.
*
[`jcstress-tests/src/jcstress/java/org/apache/polaris/core/persistence/cache/EntityCacheGetAndRefreshIfNeededTest.java`](diffhunk://#diff-de9cb8cb5f7ff57981c4178e4681823f2587bec735b887ffc3452e7ec17378e2R1-R73):
Added tests to verify the thread-safety of the `getAndRefreshIfNeeded` method.
*
[`jcstress-tests/src/jcstress/java/org/apache/polaris/core/persistence/cache/EntityCacheGetByIdTest.java`](diffhunk://#diff-ada8ec23f866d87dab5887f82666d82d4f300660e436a1a4a53f6996d70d9e8dR1-R151):
Added tests to ensure the `getOrLoadById` method behaves correctly under
concurrent access.
### Documentation:
*
[`jcstress-tests/README.md`](diffhunk://#diff-1d9c09b8f7df121e9bde734a1e69cd2b8d03d8ed5bf994dde95c68c3993245e8R1-R155):
Added comprehensive documentation explaining the purpose of JCStress tests,
how to run them, and how to interpret the results.
### EntityCache reimplementation:
Heavily inspired by @ben-manes implementation of `IndexedCache`.
The code includes a new `IndexedCache` class. That class is a Caffeine
cache that stores entries twice, once indexing the entries using the `long` id
field, and once using a compound field using the name. Any update to the cache
is guarded by a lock on the key so that it remains consistent under high
concurrency.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]