Skip to content

Commit 5723edc

Browse files
authored
IGNITE-28476 Fix NPE during WalArchiveSizeConfigurationTest#testIncorrectMaxArchiveSizeConfiguration run (#12987)
1 parent 056831f commit 5723edc

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,8 @@ else if (restored != null)
11261126
if (defrgMgr != null)
11271127
defrgMgr.cancel();
11281128

1129-
checkpointManager.stop(cancel);
1129+
if (checkpointManager != null)
1130+
checkpointManager.stop(cancel);
11301131

11311132
super.onKernalStop0(cancel);
11321133

modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalArchiveSizeConfigurationTest.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.apache.ignite.internal.IgniteEx;
2929
import org.apache.ignite.internal.util.typedef.internal.U;
3030
import org.apache.ignite.testframework.ListeningTestLogger;
31+
import org.apache.ignite.testframework.LogListener;
3132
import org.apache.ignite.testframework.junits.WithSystemProperty;
3233
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
3334
import org.junit.Test;
@@ -85,20 +86,30 @@ public void testPersistentConfiguration() throws Exception {
8586
* Checks that an exception is thrown if WAL segment size is larger than max WAL archive size.
8687
*/
8788
@Test
88-
public void testIncorrectMaxArchiveSizeConfiguration() throws Exception {
89+
public void testIncorrectMaxArchiveSizeConfiguration() {
8990
DataStorageConfiguration dataStorageConfiguration = new DataStorageConfiguration()
9091
.setWalSegmentSize((int)U.MB)
9192
.setMaxWalArchiveSize(10)
9293
.setDefaultDataRegionConfiguration(
9394
new DataRegionConfiguration().setPersistenceEnabled(true)
9495
);
9596

97+
ListeningTestLogger listeningLog = new ListeningTestLogger();
98+
LogListener npeChecker = LogListener.matches(NullPointerException.class.getName()).build();
99+
listeningLog.registerListener(npeChecker);
100+
96101
assertThrowsAnyCause(
97102
log,
98-
() -> startGrid(0, (IgniteConfiguration cfg) -> cfg.setDataStorageConfiguration(dataStorageConfiguration)),
103+
() -> startGrid(0, (IgniteConfiguration cfg) ->
104+
cfg
105+
.setDataStorageConfiguration(dataStorageConfiguration)
106+
.setGridLogger(listeningLog)
107+
),
99108
IgniteCheckedException.class,
100109
"maxWalArchiveSize must be no less than"
101110
);
111+
112+
assertFalse(npeChecker.check());
102113
}
103114

104115
/**

0 commit comments

Comments
 (0)