IGNITE-27473: WALMode consistency check and tests#12642
IGNITE-27473: WALMode consistency check and tests#12642DEADripER wants to merge 10 commits intoapache:masterfrom
Conversation
|
|
||
| DataStorageConfiguration dsCfg = ctx.config().getDataStorageConfiguration(); | ||
|
|
||
| if (dsCfg != null) |
There was a problem hiding this comment.
| if (dsCfg != null) | |
| if (CU.isPersistenceEnabled(dsCfg)) |
There was a problem hiding this comment.
To avoid test failures in IgniteKernalSelfTestSuite, let’s do the following:
ctx.addNodeAttribute(ATTR_WAL_MODE,
dsCfg != null ? dsCfg.getWalMode().ordinal() : DataStorageConfiguration.DFLT_WAL_MODE.ordinal());
|
|
||
| GridTestUtils.assertThrowsWithCause(() -> startGrid(1), IgniteCheckedException.class); | ||
|
|
||
| assertTrue(walModeErrorLsnr.check()); |
There was a problem hiding this comment.
I propose getting rid of LogListener and simply checking the error message, for example:
String errMsg = GridTestUtils.assertThrowsWithCause(() -> startGrid(1), IgniteCheckedException.class)
.getCause().getMessage();
assertTrue(errMsg.startsWith("Remote node has WAL mode different from local") &&
errMsg.contains("locWalMode=FSYNC") && errMsg.contains("rmtWalMode=LOG_ONLY"));
| DataStorageConfiguration dsCfg = ctx.config().getDataStorageConfiguration(); | ||
|
|
||
| if (dsCfg != null) | ||
| ctx.addNodeAttribute(ATTR_WAL_MODE, dsCfg.getWalMode()); |
There was a problem hiding this comment.
| ctx.addNodeAttribute(ATTR_WAL_MODE, dsCfg.getWalMode()); | |
| ctx.addNodeAttribute(ATTR_WAL_MODE, dsCfg.getWalMode().ordinal()); |
|
|
||
| Boolean locSecurityCompatibilityEnabled = locNode.attribute(ATTR_SECURITY_COMPATIBILITY_MODE); | ||
|
|
||
| WALMode locWalMode = locNode.attribute(ATTR_WAL_MODE); |
There was a problem hiding this comment.
| WALMode locWalMode = locNode.attribute(ATTR_WAL_MODE); | |
| WALMode locWalMode = locNode.attribute(ATTR_WAL_MODE) == null ? null : WALMode.fromOrdinal(locNode.attribute(ATTR_WAL_MODE)); |
| } | ||
| } | ||
|
|
||
| WALMode rmtWalMode = n.attribute(ATTR_WAL_MODE); |
There was a problem hiding this comment.
| WALMode rmtWalMode = n.attribute(ATTR_WAL_MODE); | |
| WALMode rmtWalMode = n.attribute(ATTR_WAL_MODE) == null ? null : WALMode.fromOrdinal(n.attribute(ATTR_WAL_MODE)); |
|
|
||
| WALMode rmtWalMode = n.attribute(ATTR_WAL_MODE); | ||
|
|
||
| if (locWalMode != rmtWalMode) { |
There was a problem hiding this comment.
| if (locWalMode != rmtWalMode) { | |
| if (!Objects.equals(locWalMode, rmtWalMode)) { |
| DataStorageConfiguration dsCfg = cfg.getDataStorageConfiguration(); | ||
|
|
||
| ctx.addNodeAttribute(ATTR_WAL_MODE, | ||
| dsCfg != null ? dsCfg.getWalMode().ordinal() : DataStorageConfiguration.DFLT_WAL_MODE.ordinal()); |
There was a problem hiding this comment.
Why do we want to use DFLT_WAL_MODE when dsCfg is null?
We don't want to send untrue values to the other nodes.
Let's use null value if possible or don't set WAL attribute if dsCfg is null and handle it on receiver side.
| * @throws Exception If failed. | ||
| */ | ||
| @Test | ||
| public void testDifferentWalModesCannotJoin() throws Exception { |
There was a problem hiding this comment.
Let's add tests where
- In memory node
- Persistence +
DFLT_WAL_MODEnode
joins into cluster.
- In memory node
- Persistence +
FSYNC_MODEnode
joins into cluster.
| * @throws Exception If failed. | ||
| */ | ||
| @Test | ||
| public void testSameWalModeJoinsSuccessfully() throws Exception { |
There was a problem hiding this comment.
Please, add start of client node and creation of some cache to the each test.
7877c05 to
c3c0c4a
Compare
This reverts commit c3c0c4a.
Thank you for submitting the pull request to the Apache Ignite.
In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:
The Contribution Checklist
The description explains WHAT and WHY was made instead of HOW.
The following pattern must be used:
IGNITE-XXXX Change summarywhereXXXX- number of JIRA issue.(see the Maintainers list)
the
green visaattached to the JIRA ticket (see TC.Bot: Check PR)Notes
If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com #ignite channel.