-
Notifications
You must be signed in to change notification settings - Fork 118
SUP-19020: Second level cache is back on by default #1707
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
Open
plyhun
wants to merge
7
commits into
hotfix-3.0.x
Choose a base branch
from
hotfix-3.0.x-sup-19020
base: hotfix-3.0.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
dc123e5
SUP-19020: Second level cache is back on by default
plyhun 6b1a6bd
Tests
plyhun aa1b600
A TestContextProvider for the existing database installations
plyhun 09da040
Stable UUID tests
plyhun 766f1e1
Test bugfixes
plyhun fa9a23d
Cluster startup fix
plyhun 22f5c47
Connector test build fix
plyhun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Core: A default value of `true` for `MESH_HIBERNATE_SECOND_LEVEL_CACHE_ENABLED` config has been restored, enabling the second level SQL cache. The startup of a second level cache in the cluster environment has been fixed. |
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
18 changes: 18 additions & 0 deletions
18
...ctors/common/src/test/java/com/gentics/mesh/core/ExternalDatabaseTestContextProvider.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package com.gentics.mesh.core; | ||
|
|
||
| import com.gentics.mesh.etc.config.HibernateMeshOptions; | ||
| import com.gentics.mesh.test.MeshOptionsProvider; | ||
| import com.gentics.mesh.test.MeshTestContextProvider; | ||
|
|
||
| public class ExternalDatabaseTestContextProvider extends HibernateTestContextProvider implements MeshTestContextProvider { | ||
|
|
||
| static { | ||
| System.setProperty(MeshOptionsProvider.ENV_OPTIONS_PROVIDER_CLASS, ExternalDatabaseTestContextProvider.class.getCanonicalName()); | ||
| } | ||
|
|
||
| @Override | ||
| public void fillMeshOptions(HibernateMeshOptions meshOptions) { | ||
| // Taken from the env variables of HibernateMeshOptions | ||
| } | ||
|
|
||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,5 +123,4 @@ public Comparator<String> reversed() { | |
| } | ||
| }; | ||
| } | ||
|
|
||
| } | ||
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -409,9 +409,15 @@ private void addUserGroupRoleProject(Tx tx) { | |
| project.addLanguage(tx.languageDao().findByLanguageTag(getGerman())); | ||
| } | ||
| HibUser jobUser = userInfo.getUser(); | ||
| //schemaDao.assign(getSchemaContainer("folder"), project, jobUser, batch); // already done | ||
| schemaDao.assign(getSchemaContainer("content"), project, jobUser, batch); | ||
| schemaDao.assign(getSchemaContainer("binary_content"), project, jobUser, batch); | ||
| if (!schemaDao.isLinkedToProject(getSchemaContainer("folder"), project)) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the existing database reusable again. |
||
| schemaDao.assign(getSchemaContainer("folder"), project, jobUser, batch); | ||
| } | ||
| if (!schemaDao.isLinkedToProject(getSchemaContainer("content"), project)) { | ||
| schemaDao.assign(getSchemaContainer("content"), project, jobUser, batch); | ||
| } | ||
| if (!schemaDao.isLinkedToProject(getSchemaContainer("binary_content"), project)) { | ||
| schemaDao.assign(getSchemaContainer("binary_content"), project, jobUser, batch); | ||
| } | ||
| projectUuid = project.getUuid(); | ||
| branchUuid = project.getInitialBranch().getUuid(); | ||
|
|
||
|
|
||
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
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
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
52 changes: 52 additions & 0 deletions
52
tests/tests-hibernate/src/main/java/com/gentics/mesh/cache/AbstractMassivePublishTest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| package com.gentics.mesh.cache; | ||
|
|
||
| import java.time.Instant; | ||
| import java.time.format.DateTimeFormatter; | ||
| import java.util.Optional; | ||
| import java.util.UUID; | ||
| import java.util.concurrent.TimeUnit; | ||
| import java.util.function.BiFunction; | ||
|
|
||
| import org.junit.Before; | ||
| import org.junit.ClassRule; | ||
| import org.junit.Test; | ||
| import org.junit.rules.RuleChain; | ||
| import org.junit.rules.Timeout; | ||
|
|
||
| import com.gentics.mesh.core.node.AbstractMassiveNodeLoadTest; | ||
| import com.gentics.mesh.util.UUIDUtil; | ||
|
|
||
| import ch.qos.logback.core.util.Duration; | ||
|
|
||
| public abstract class AbstractMassivePublishTest extends AbstractMassiveNodeLoadTest { | ||
|
|
||
| /** | ||
| * Global Test Timeout of 60 Minutes, to fit 'em all | ||
| */ | ||
| public static Timeout globalTimeout= new Timeout(60, TimeUnit.MINUTES); | ||
|
|
||
| @ClassRule | ||
| public static RuleChain chain = RuleChain.outerRule(globalTimeout).around(testContext); | ||
|
|
||
| protected static final UUID VERY_BASE_UUID = UUIDUtil.toJavaUuid("6B06697A9ABE11F096B6F7559C093C6E"); | ||
|
|
||
| public AbstractMassivePublishTest() { | ||
| super(10000); | ||
| } | ||
|
|
||
| @Before | ||
| public void makeEmAll() { | ||
| // No make yet | ||
| } | ||
|
|
||
| @Test | ||
| public void testAndMeasureMassivePublish() { | ||
| Instant started = Instant.now(); | ||
| System.out.println(String.format("Publish started at %s", DateTimeFormatter.ISO_INSTANT.format(started))); | ||
| makeEmAll(numOfNodesPerLevel, tx(() -> project().getBaseNode().getUuid()), true, getMaybeUuidProvider()); | ||
| Instant ended = Instant.now(); | ||
| System.out.println(String.format("Publish ended at %s, duration %s", DateTimeFormatter.ISO_INSTANT.format(ended), Duration.buildByMilliseconds(ended.toEpochMilli() - started.toEpochMilli()))); | ||
| } | ||
|
|
||
| protected abstract Optional<BiFunction<UUID, Integer, UUID>> getMaybeUuidProvider(); | ||
| } |
43 changes: 43 additions & 0 deletions
43
...s-hibernate/src/main/java/com/gentics/mesh/cache/NodeMassiveOrderedPublishTestCached.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| package com.gentics.mesh.cache; | ||
|
|
||
| import static com.gentics.mesh.test.ElasticsearchTestMode.TRACKING; | ||
| import static com.gentics.mesh.test.TestSize.FULL; | ||
|
|
||
| import java.math.BigInteger; | ||
| import java.util.Optional; | ||
| import java.util.UUID; | ||
| import java.util.function.BiFunction; | ||
|
|
||
| import org.junit.experimental.categories.Category; | ||
|
|
||
| import com.gentics.mesh.etc.config.HibernateMeshOptions; | ||
| import com.gentics.mesh.etc.config.MeshOptions; | ||
| import com.gentics.mesh.test.MeshOptionChanger; | ||
| import com.gentics.mesh.test.MeshTestSetting; | ||
| import com.gentics.mesh.test.category.FailingTests; | ||
| import com.gentics.mesh.util.UUIDUtil; | ||
|
|
||
| @MeshTestSetting(elasticsearch = TRACKING, testSize = FULL, startServer = true, customOptionChanger = NodeMassiveOrderedPublishTestCached.class) | ||
| @Category({FailingTests.class}) | ||
| //Not actually failing, but may last long | ||
| public class NodeMassiveOrderedPublishTestCached extends AbstractMassivePublishTest implements MeshOptionChanger { | ||
|
|
||
| @Override | ||
| public void change(MeshOptions options) { | ||
| HibernateMeshOptions.class.cast(options).getStorageOptions().setSecondLevelCacheEnabled(true); | ||
| } | ||
|
|
||
| @Override | ||
| protected Optional<BiFunction<UUID, Integer, UUID>> getMaybeUuidProvider() { | ||
| return Optional.of((uuid, i) -> { | ||
| if (i < 0) { | ||
| i = 0; | ||
| uuid = VERY_BASE_UUID; | ||
| } | ||
| BigInteger number = new BigInteger(UUIDUtil.toBytes(uuid)); | ||
| // Minus! | ||
| number = number.subtract(BigInteger.valueOf(i)); | ||
| return UUIDUtil.toJavaUuid(number.toByteArray()); | ||
| }); | ||
| } | ||
| } |
43 changes: 43 additions & 0 deletions
43
...-hibernate/src/main/java/com/gentics/mesh/cache/NodeMassiveOrderedPublishTestNoCache.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| package com.gentics.mesh.cache; | ||
|
|
||
| import static com.gentics.mesh.test.ElasticsearchTestMode.TRACKING; | ||
| import static com.gentics.mesh.test.TestSize.FULL; | ||
|
|
||
| import java.math.BigInteger; | ||
| import java.util.Optional; | ||
| import java.util.UUID; | ||
| import java.util.function.BiFunction; | ||
|
|
||
| import org.junit.experimental.categories.Category; | ||
|
|
||
| import com.gentics.mesh.etc.config.HibernateMeshOptions; | ||
| import com.gentics.mesh.etc.config.MeshOptions; | ||
| import com.gentics.mesh.test.MeshOptionChanger; | ||
| import com.gentics.mesh.test.MeshTestSetting; | ||
| import com.gentics.mesh.test.category.FailingTests; | ||
| import com.gentics.mesh.util.UUIDUtil; | ||
|
|
||
| @MeshTestSetting(elasticsearch = TRACKING, testSize = FULL, startServer = true, customOptionChanger = NodeMassiveOrderedPublishTestNoCache.class) | ||
| @Category({FailingTests.class}) | ||
| //Not actually failing, but may last long | ||
| public class NodeMassiveOrderedPublishTestNoCache extends AbstractMassivePublishTest implements MeshOptionChanger { | ||
|
|
||
| @Override | ||
| public void change(MeshOptions options) { | ||
| HibernateMeshOptions.class.cast(options).getStorageOptions().setSecondLevelCacheEnabled(false); | ||
| } | ||
|
|
||
| @Override | ||
| protected Optional<BiFunction<UUID, Integer, UUID>> getMaybeUuidProvider() { | ||
| return Optional.of((uuid, i) -> { | ||
| if (i < 0) { | ||
| i = 0; | ||
| uuid = VERY_BASE_UUID; | ||
| } | ||
| BigInteger number = new BigInteger(UUIDUtil.toBytes(uuid)); | ||
| // Plus! | ||
| number = number.add(BigInteger.valueOf(i)); | ||
| return UUIDUtil.toJavaUuid(number.toByteArray()); | ||
| }); | ||
| } | ||
| } |
Oops, something went wrong.
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.
Example setup: