issue-3097 : re-writting getAll() impl#3130
Merged
chrisdennis merged 1 commit intoehcache:masterfrom Aug 18, 2023
Merged
Conversation
Contributor
Author
|
Proposed changes are in early stage. Opening the PR to have effective feedback |
chrisdennis
requested changes
Apr 10, 2023
Member
chrisdennis
left a comment
There was a problem hiding this comment.
Subject: [PATCH] Code Review Comments
---
Index: ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/AuthoritativeTier.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/AuthoritativeTier.java b/ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/AuthoritativeTier.java
--- a/ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/AuthoritativeTier.java (revision 154708ade16df25847e8b9fbf4a583fba27d5c06)
+++ b/ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/AuthoritativeTier.java (date 1681135893484)
@@ -76,8 +76,7 @@
*/
void setInvalidationValve(InvalidationValve valve);
-
- Iterable<? extends Map.Entry<? extends K,? extends V>> bulkComputeIfAbsentAndFault(Iterable<? extends K> keyParam, Function<Iterable<? extends K>, Iterable<? extends Map.Entry<? extends K,? extends V>>> mappingFunction) throws StoreAccessException;
+ Iterable<? extends Map.Entry<? extends K,? extends ValueHolder<V>>> bulkComputeIfAbsentAndFault(Iterable<? extends K> keyParam, Function<Iterable<? extends K>, Iterable<? extends Map.Entry<? extends K,? extends V>>> mappingFunction) throws StoreAccessException;
/**
* Invalidation valve, that is the mechanism through which an {@link AuthoritativeTier} can request invalidations
Index: ehcache-impl/src/main/java/org/ehcache/impl/internal/store/basic/NopStore.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/basic/NopStore.java b/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/basic/NopStore.java
--- a/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/basic/NopStore.java (revision 154708ade16df25847e8b9fbf4a583fba27d5c06)
+++ b/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/basic/NopStore.java (date 1681135486810)
@@ -68,7 +68,7 @@
}
@Override
- public Iterable<? extends Map.Entry<? extends K, ? extends V>> bulkComputeIfAbsentAndFault(Iterable<? extends K> keyParam, Function<Iterable<? extends K>, Iterable<? extends Map.Entry<? extends K, ? extends V>>> mappingFunction) throws StoreAccessException {
+ public Iterable<? extends Map.Entry<? extends K, ? extends ValueHolder<V>>> bulkComputeIfAbsentAndFault(Iterable<? extends K> keyParam, Function<Iterable<? extends K>, Iterable<? extends Map.Entry<? extends K, ? extends V>>> mappingFunction) throws StoreAccessException {
return null;
}
Index: ehcache-impl/src/main/java/org/ehcache/impl/internal/store/tiering/TieredStore.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/tiering/TieredStore.java b/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/tiering/TieredStore.java
--- a/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/tiering/TieredStore.java (revision 154708ade16df25847e8b9fbf4a583fba27d5c06)
+++ b/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/tiering/TieredStore.java (date 1681135391217)
@@ -361,7 +361,7 @@
try {
return cachingTier().bulkGetOrComputeIfAbsent(keys, missingKeys -> {
try {
- return authoritativeTier.bulkComputeIfAbsent(missingKeys, mappingFunction).entrySet();
+ return authoritativeTier.bulkComputeIfAbsentAndFault(missingKeys, mappingFunction);
} catch (StoreAccessException cae) {
throw new StorePassThroughException(cae);
}
Index: clustered/ehcache-client/src/main/java/org/ehcache/clustered/client/internal/store/ClusteredStore.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/clustered/ehcache-client/src/main/java/org/ehcache/clustered/client/internal/store/ClusteredStore.java b/clustered/ehcache-client/src/main/java/org/ehcache/clustered/client/internal/store/ClusteredStore.java
--- a/clustered/ehcache-client/src/main/java/org/ehcache/clustered/client/internal/store/ClusteredStore.java (revision 154708ade16df25847e8b9fbf4a583fba27d5c06)
+++ b/clustered/ehcache-client/src/main/java/org/ehcache/clustered/client/internal/store/ClusteredStore.java (date 1681135472355)
@@ -596,10 +596,10 @@
}
@Override
- public Iterable<? extends Map.Entry<? extends K, ? extends V>> bulkComputeIfAbsentAndFault(Iterable<? extends K> keys, Function<Iterable<? extends K>, Iterable<? extends Map.Entry<? extends K, ? extends V>>> mappingFunction) throws StoreAccessException {
- Map<K, V> result = new HashMap<>();
+ public Iterable<? extends Map.Entry<? extends K, ? extends ValueHolder<V>>> bulkComputeIfAbsentAndFault(Iterable<? extends K> keys, Function<Iterable<? extends K>, Iterable<? extends Map.Entry<? extends K, ? extends V>>> mappingFunction) throws StoreAccessException {
+ Map<K, ValueHolder<V>> result = new HashMap<>();
for (K key : keys) {
- result.put(key, getAndFault(key).get());
+ result.put(key, getAndFault(key));
}
return result.entrySet();
}
Index: ehcache-impl/src/main/java/org/ehcache/impl/internal/store/offheap/AbstractOffHeapStore.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/offheap/AbstractOffHeapStore.java b/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/offheap/AbstractOffHeapStore.java
--- a/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/offheap/AbstractOffHeapStore.java (revision 154708ade16df25847e8b9fbf4a583fba27d5c06)
+++ b/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/offheap/AbstractOffHeapStore.java (date 1681135526749)
@@ -809,7 +809,7 @@
return null;
}
};
- ValueHolder<V> computed = computeIfAbsentAndFault(key, function);
+ ValueHolder<V> computed = computeIfAbsent(key, function);
result.put(key, computed);
}
return result;
@@ -846,8 +846,8 @@
return mappedValue;
}
- public Iterable<? extends Map.Entry<? extends K, ? extends V>> bulkComputeIfAbsentAndFault(Iterable<? extends K> keys, Function<Iterable<? extends K>, Iterable<? extends Map.Entry<? extends K, ? extends V>>> mappingFunction) throws StoreAccessException {
- Map<K, V> result = new HashMap<>();
+ public Iterable<? extends Map.Entry<? extends K, ? extends ValueHolder<V>>> bulkComputeIfAbsentAndFault(Iterable<? extends K> keys, Function<Iterable<? extends K>, Iterable<? extends Map.Entry<? extends K, ? extends V>>> mappingFunction) throws StoreAccessException {
+ Map<K, ValueHolder<V>> result = new HashMap<>();
for (K key : keys) {
checkKey(key);
Function<K, V> function = k -> {
@@ -860,8 +860,7 @@
return null;
}
};
- ValueHolder<V> computed = computeIfAbsent(key, function);
- result.put(key, computed.get());
+ result.put(key, computeIfAbsentAndFault(key, function));
}
return result.entrySet();
}
chrisdennis
reviewed
May 8, 2023
Member
chrisdennis
left a comment
There was a problem hiding this comment.
Test changes look like they're moving in the right direction. Lets chat tomorrow about how the tests look now.
chrisdennis
requested changes
May 18, 2023
...ehcache-client/src/main/java/org/ehcache/clustered/client/internal/store/ClusteredStore.java
Show resolved
Hide resolved
chrisdennis
requested changes
Jul 18, 2023
core-spi-test/src/main/java/org/ehcache/internal/store/StoreSPITest.java
Outdated
Show resolved
Hide resolved
...ehcache-client/src/main/java/org/ehcache/clustered/client/internal/store/ClusteredStore.java
Outdated
Show resolved
Hide resolved
ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/AuthoritativeTier.java
Outdated
Show resolved
Hide resolved
ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/CachingTier.java
Outdated
Show resolved
Hide resolved
ehcache-impl/src/main/java/org/ehcache/impl/internal/store/basic/NopStore.java
Outdated
Show resolved
Hide resolved
ehcache-impl/src/main/java/org/ehcache/impl/internal/store/tiering/TieredStore.java
Outdated
Show resolved
Hide resolved
ehcache-impl/src/test/java/org/ehcache/impl/internal/store/heap/OnHeapStoreBulkMethodsTest.java
Outdated
Show resolved
Hide resolved
ehcache-impl/src/test/java/org/ehcache/impl/internal/store/heap/OnHeapStoreBulkMethodsTest.java
Outdated
Show resolved
Hide resolved
chrisdennis
approved these changes
Aug 16, 2023
Member
chrisdennis
left a comment
There was a problem hiding this comment.
Approved... with one minor question. Probably not a big deal... but would be good to know which it should be.
ehcache-impl/src/main/java/org/ehcache/impl/internal/store/tiering/TieredStore.java
Outdated
Show resolved
Hide resolved
Member
|
Probably makes sense to rebase this and do some squashing. |
chrisdennis
requested changes
Aug 17, 2023
ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/AuthoritativeTier.java
Outdated
Show resolved
Hide resolved
ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/AuthoritativeTier.java
Outdated
Show resolved
Hide resolved
ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/AuthoritativeTier.java
Outdated
Show resolved
Hide resolved
ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/AuthoritativeTier.java
Outdated
Show resolved
Hide resolved
ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/CachingTier.java
Outdated
Show resolved
Hide resolved
ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/CachingTier.java
Outdated
Show resolved
Hide resolved
ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/CachingTier.java
Outdated
Show resolved
Hide resolved
ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/CachingTier.java
Outdated
Show resolved
Hide resolved
ehcache-core/src/main/java/org/ehcache/core/spi/store/tiering/CachingTier.java
Outdated
Show resolved
Hide resolved
6b2129a to
c4ca535
Compare
chrisdennis
approved these changes
Aug 18, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.