-
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-11480 Call EmbeddedCacheManager#stop in shutdown hook #8063
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
96 changes: 96 additions & 0 deletions
96
core/src/test/java/org/infinispan/statetransfer/StatefulSetRollingUpgradeTest.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,96 @@ | ||
package org.infinispan.statetransfer; | ||
|
||
import static org.infinispan.commons.test.CommonsTestingUtil.tmpDirectory; | ||
import static org.infinispan.test.fwk.TestCacheManagerFactory.createClusteredCacheManager; | ||
|
||
import java.io.File; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import org.infinispan.commons.util.Util; | ||
import org.infinispan.configuration.cache.CacheMode; | ||
import org.infinispan.configuration.cache.ConfigurationBuilder; | ||
import org.infinispan.configuration.global.GlobalConfigurationBuilder; | ||
import org.infinispan.manager.EmbeddedCacheManager; | ||
import org.infinispan.partitionhandling.PartitionHandling; | ||
import org.infinispan.test.MultipleCacheManagersTest; | ||
import org.infinispan.test.fwk.CleanupAfterMethod; | ||
import org.infinispan.test.fwk.TransportFlags; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* Start cluster (A,B) redeploy after upgrade. Rolling upgrades always occur in the order B,A and A does not restart | ||
* until B has completed successfully. | ||
* | ||
* @author Ryan Emerson | ||
* @since 11.0 | ||
*/ | ||
@CleanupAfterMethod | ||
@Test(groups = "functional", testName = "statetransfer.StatefulSetRollingUpgradeTest") | ||
public class StatefulSetRollingUpgradeTest extends MultipleCacheManagersTest { | ||
|
||
private static final String CACHE_NAME = "testCache"; | ||
private static final int NUM_ROLLING_UPGRADES = 4; | ||
|
||
private int numNodes; | ||
|
||
@Override | ||
public Object[] factory() { | ||
return new Object[]{ | ||
new StatefulSetRollingUpgradeTest().setNumNodes(2), | ||
new StatefulSetRollingUpgradeTest().setNumNodes(3), | ||
new StatefulSetRollingUpgradeTest().setNumNodes(4), | ||
new StatefulSetRollingUpgradeTest().setNumNodes(5) | ||
}; | ||
} | ||
|
||
private StatefulSetRollingUpgradeTest setNumNodes(int numNodes) { | ||
this.numNodes = numNodes; | ||
return this; | ||
} | ||
|
||
@Override | ||
protected String[] parameterNames() { | ||
return new String[]{"nodes"}; | ||
} | ||
|
||
@Override | ||
protected Object[] parameterValues() { | ||
return new Object[]{numNodes}; | ||
} | ||
|
||
@Override | ||
protected void createCacheManagers() throws Throwable { | ||
Util.recursiveFileRemove(tmpDirectory(this.getClass().getSimpleName())); | ||
|
||
for (int id = 0; id < numNodes; id++) | ||
createStatefulCacheManager(id); | ||
|
||
waitForClusterToForm(CACHE_NAME); | ||
} | ||
|
||
public void testStateTransferRestart() { | ||
for (int i = 0; i < NUM_ROLLING_UPGRADES; i++) { | ||
for (int j = numNodes - 1; j > -1; j--) { | ||
manager(j).stop(); | ||
cacheManagers.remove(j); | ||
waitForClusterToForm(CACHE_NAME); | ||
createStatefulCacheManager(j); | ||
waitForClusterToForm(CACHE_NAME); | ||
} | ||
} | ||
} | ||
|
||
private void createStatefulCacheManager(int id) { | ||
String stateDirectory = tmpDirectory(this.getClass().getSimpleName() + File.separator + id); | ||
GlobalConfigurationBuilder global = GlobalConfigurationBuilder.defaultClusteredBuilder(); | ||
global.globalState().enable().persistentLocation(stateDirectory); | ||
|
||
ConfigurationBuilder config = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC); | ||
config.clustering() | ||
.partitionHandling().whenSplit(PartitionHandling.DENY_READ_WRITES) | ||
.stateTransfer().timeout(5 * numNodes, TimeUnit.SECONDS); | ||
EmbeddedCacheManager manager = createClusteredCacheManager(true, global, null, new TransportFlags()); | ||
manager.defineConfiguration(CACHE_NAME, config.build()); | ||
cacheManagers.add(id, manager); | ||
} | ||
} |
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.
Guess I never knew we required log4j in the server.