-
Notifications
You must be signed in to change notification settings - Fork 612
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
ISPN-6550 Remote iterator does not work in compatibility mode #4271
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9c5cf0f
ISPN-6550 Added test to reproduce "Invalid magic number" errors
6c62695
ISPN-6550 Fixed key tracking under compatibility
9c07ad4
ISPN-6550 Added reproducer for ClassCastException during iteration wh…
2815a3a
ISPN-6550 Correctly obtain compatibility configuration for the cache
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
44 changes: 44 additions & 0 deletions
44
...ient/src/test/java/org/infinispan/client/hotrod/impl/iteration/MultiServerCompatTest.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.infinispan.client.hotrod.impl.iteration; | ||
|
||
import org.infinispan.client.hotrod.RemoteCache; | ||
import org.infinispan.client.hotrod.test.MultiHotRodServersTest; | ||
import org.infinispan.commons.equivalence.AnyEquivalence; | ||
import org.infinispan.configuration.cache.CacheMode; | ||
import org.infinispan.configuration.cache.ConfigurationBuilder; | ||
import org.testng.annotations.Test; | ||
|
||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import static org.infinispan.server.hotrod.test.HotRodTestingUtil.hotRodCacheConfiguration; | ||
import static org.testng.AssertJUnit.assertEquals; | ||
|
||
@Test(groups = "functional", testName = "client.hotrod.iteration.DistFailOverRemoteIteratorTest") | ||
public class MultiServerCompatTest extends MultiHotRodServersTest implements AbstractRemoteIteratorTest { | ||
|
||
private static final int NUM_SERVERS = 2; | ||
private static final int CACHE_SIZE = 10; | ||
|
||
@Override | ||
protected void createCacheManagers() throws Throwable { | ||
createHotRodServers(NUM_SERVERS, getCacheConfiguration()); | ||
} | ||
|
||
private org.infinispan.configuration.cache.ConfigurationBuilder getCacheConfiguration() { | ||
ConfigurationBuilder builder = hotRodCacheConfiguration(getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false)); | ||
builder.clustering().hash().numSegments(60).numOwners(1); | ||
builder.compatibility().enable(); | ||
builder.dataContainer().keyEquivalence(AnyEquivalence.getInstance()); | ||
return builder; | ||
} | ||
|
||
@Test | ||
public void testIteration() throws Exception { | ||
RemoteCache<Integer, String> remoteCache = clients.get(0).getCache(); | ||
populateCache(CACHE_SIZE, i -> "value", remoteCache); | ||
Set<Map.Entry<Object, Object>> entries = extractEntries(remoteCache.retrieveEntries(null, 5)); | ||
|
||
assertEquals(CACHE_SIZE, entries.size()); | ||
} | ||
} | ||
|
This file contains 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
This file contains 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
70 changes: 70 additions & 0 deletions
70
...ite/src/test/java/org/infinispan/server/test/client/hotrod/HotRodRemoteCacheCompatIT.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package org.infinispan.server.test.client.hotrod; | ||
|
||
import org.infinispan.arquillian.core.InfinispanResource; | ||
import org.infinispan.arquillian.core.RemoteInfinispanServer; | ||
import org.infinispan.client.hotrod.RemoteCache; | ||
import org.infinispan.client.hotrod.RemoteCacheManager; | ||
import org.infinispan.client.hotrod.configuration.ConfigurationBuilder; | ||
import org.infinispan.commons.util.CloseableIterator; | ||
import org.infinispan.server.test.category.HotRodClustered; | ||
import org.infinispan.server.test.category.HotRodSingleNode; | ||
import org.infinispan.server.test.util.RemoteCacheManagerFactory; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.junit.AfterClass; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.experimental.categories.Category; | ||
import org.junit.runner.RunWith; | ||
|
||
import java.io.IOException; | ||
import java.util.HashSet; | ||
import java.util.Map.Entry; | ||
import java.util.Set; | ||
import java.util.stream.IntStream; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
@RunWith(Arquillian.class) | ||
@Category({HotRodSingleNode.class, HotRodClustered.class}) | ||
public class HotRodRemoteCacheCompatIT { | ||
|
||
private static final String CACHE_NAME = "compatibilityCache"; | ||
private static final int CACHE_SIZE = 1000; | ||
private static RemoteCacheManager remoteCacheManager; | ||
|
||
private RemoteCache<Integer, String> remoteCache; | ||
|
||
@InfinispanResource("container1") | ||
RemoteInfinispanServer server1; | ||
|
||
@Before | ||
public void setup() throws IOException { | ||
RemoteCacheManagerFactory remoteCacheManagerFactory = new RemoteCacheManagerFactory(); | ||
ConfigurationBuilder clientBuilder = new ConfigurationBuilder(); | ||
clientBuilder.addServer() | ||
.host(server1.getHotrodEndpoint().getInetAddress().getHostName()) | ||
.port(server1.getHotrodEndpoint().getPort()); | ||
remoteCacheManager = remoteCacheManagerFactory.createManager(clientBuilder); | ||
remoteCache = remoteCacheManager.getCache(CACHE_NAME); | ||
} | ||
|
||
@AfterClass | ||
public static void release() { | ||
if (remoteCacheManager != null) { | ||
remoteCacheManager.stop(); | ||
} | ||
} | ||
|
||
@Test | ||
public void testIteration() { | ||
remoteCache.clear(); | ||
IntStream.range(0, CACHE_SIZE).forEach(k -> remoteCache.put(k, "value" + k)); | ||
Set<Object> keys = new HashSet<>(); | ||
try (CloseableIterator<Entry<Object, Object>> iter = remoteCache.retrieveEntries(null, 10)) { | ||
iter.forEachRemaining(e -> keys.add(e.getKey())); | ||
} | ||
assertEquals(CACHE_SIZE, keys.size()); | ||
} | ||
|
||
|
||
} |
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason
cacheManager.getCacheConfiguration(cacheName).compatibility()
returns the wrong cache configuration (from the default one) instead of thecacheName
's cache configuration.This needs more investigation (another JIRA)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for another JIRA
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly related https://issues.jboss.org/browse/ISPN-6577