Skip to content

Commit

Permalink
IGNITE-13770 Fix NPE in Ignite.dataRegionMetrics with empty persisten…
Browse files Browse the repository at this point in the history
…t region - Fixes apache#8506.

Signed-off-by: Ilya Kasnacheev <ilya.kasnacheev@gmail.com>
  • Loading branch information
alamar committed Dec 2, 2020
1 parent dad79aa commit 77b90b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1829,14 +1829,14 @@ public int activePagesCount() {

/** {@inheritDoc} */
@Override public int checkpointBufferPagesCount() {
return checkpointPool.size();
return checkpointPool == null ? 0 : checkpointPool.size();
}

/**
* Number of used pages in checkpoint buffer.
*/
public int checkpointBufferPagesSize() {
return checkpointPool.pages();
return checkpointPool == null ? 0 : checkpointPool.pages();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ public class IgnitePdsDataRegionMetricsTest extends GridCommonAbstractTest {
.setMaxSize(MAX_REGION_SIZE)
.setPersistenceEnabled(true)
.setMetricsEnabled(true))
.setDataRegionConfigurations(
new DataRegionConfiguration()
.setName("EmptyRegion")
.setInitialSize(INIT_REGION_SIZE)
.setMaxSize(MAX_REGION_SIZE)
.setPersistenceEnabled(true)
.setMetricsEnabled(true))
.setCheckpointFrequency(1000);

cfg.setDataStorageConfiguration(memCfg);
Expand Down

0 comments on commit 77b90b1

Please sign in to comment.