You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2019/02/22 14:01:45 UTC

[ignite] branch master updated: IGNITE-10639 Docs update, style changes, and exceptions handling fixes (#6148)

This is an automated email from the ASF dual-hosted git repository.

dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 025562f  IGNITE-10639 Docs update, style changes, and exceptions handling fixes (#6148)
025562f is described below

commit 025562fef8ffdd0f0d4ee34fd84ea114ffb765a5
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Fri Feb 22 17:01:37 2019 +0300

    IGNITE-10639 Docs update, style changes, and exceptions handling fixes (#6148)
---
 .../main/java/org/apache/ignite/internal/README.md | 12 +++++-
 .../ignite/internal/processors/cache/README.md     |  3 ++
 .../CheckpointWriteProgressSupplier.java           |  6 +--
 .../GridCacheDatabaseSharedManager.java            |  6 ++-
 .../cache/persistence/pagemem/PageMemoryImpl.java  |  2 +-
 .../pagemem/IgniteThrottlingUnitTest.java          | 10 ++---
 .../pagemem/PagesWriteThrottleSandboxTest.java     | 45 +++++++++++-----------
 .../ignite/testsuites/IgnitePdsUnitTestSuite.java  |  1 -
 8 files changed, 48 insertions(+), 37 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/README.md b/modules/core/src/main/java/org/apache/ignite/internal/README.md
index 8d0f208..0ed8639 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/README.md
+++ b/modules/core/src/main/java/org/apache/ignite/internal/README.md
@@ -3,10 +3,18 @@ Apache Ignite Internals
 
 Contains implementation classes for Apache Ignite.
 
-*Ignite Components*
+### Ignite Components
 
 All internal Ignite components implements [GridComponent.java](GridComponent.java) - interface for
 - [processors](processors) and for
 - [managers](managers) - has associated SPI.
 
-Service Provider Interface (SPI) abbreviation is here because Apache Ignite was designed as a pluggable product. But Ignite users usually do not define own implementations.
\ No newline at end of file
+Service Provider Interface (SPI) abbreviation is here because Apache Ignite was designed as a pluggable product. But Ignite users usually do not define own implementations.
+
+### Contexts
+Ignite manages its components using Context used to access components and binding theirs to each other.
+Component-related context in the Apache Ignite is an implementation of [GridKernalContext.java](GridKernalContext.java).
+This context instance is usually referred in code as `kctx` or `ctx`.
+
+Higher-level context, cache shared context is also defined in [processors/cache](processors/cache)
+
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/README.md b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/README.md
index f8c50ce..19c5d70 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/README.md
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/README.md
@@ -1,5 +1,8 @@
 Apache Ignite Cache Processors
 ------------------------------
+### Context
+[GridCacheSharedContext.java](GridCacheSharedContext.java) is a class which is used for binding cache-related managers.
+This context is shared by all caches defined. This context instance is usually referred in code as `sctx`, `cctx` or `ctx`.
 
 ### Native Persistence
 Apache Ignite has its own [Native Persistence](persistence) - Implementation
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CheckpointWriteProgressSupplier.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CheckpointWriteProgressSupplier.java
index d20e8d4..596a65f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CheckpointWriteProgressSupplier.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CheckpointWriteProgressSupplier.java
@@ -24,17 +24,17 @@ import java.util.concurrent.atomic.AtomicInteger;
  */
 public interface CheckpointWriteProgressSupplier {
     /**
-     * Counter for written checkpoint pages. Not null only if checkpoint is running.
+     * @return Counter for written checkpoint pages. Not <code>null</code> only if checkpoint is running.
      */
     public AtomicInteger writtenPagesCounter();
 
     /**
-     * @return Counter for fsynced checkpoint pages. Not null only if checkpoint is running.
+     * @return Counter for fsynced checkpoint pages. Not  <code>null</code> only if checkpoint is running.
      */
     public AtomicInteger syncedPagesCounter();
 
     /**
-     * @return Counter for evicted pages during current checkpoint. Not null only if checkpoint is running.
+     * @return Counter for evicted pages during current checkpoint. Not <code>null</code> only if checkpoint is running.
      */
     public AtomicInteger evictedPagesCntr();
 
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index 4cb5bd2..422b949 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -3480,7 +3480,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                 try {
                     chp = markCheckpointBegin(tracker);
                 }
-                catch (IgniteCheckedException e) {
+                catch (Exception e) {
                     if (curCpProgress != null)
                         curCpProgress.cpFinishFut.onDone(e);
 
@@ -3874,7 +3874,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
             tracker.onLockWaitStart();
 
             checkpointLock.writeLock().lock();
-            
+
             try {
                 assert curCpProgress == curr : "Concurrent checkpoint begin should not be happened";
 
@@ -4066,6 +4066,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                     }
                     catch (RejectedExecutionException e) {
                         assert false : "Task should never be rejected by async runner";
+
+                        throw new IgniteException(e); //to protect from disabled asserts and call to failure handler
                     }
             }
 
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
index 0f4ca7d..ae30f0e 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
@@ -330,7 +330,7 @@ public class PageMemoryImpl implements PageMemoryEx {
         storeMgr = ctx.pageStore();
         walMgr = ctx.wal();
         encMgr = ctx.kernalContext().encryption();
-        encryptionDisabled = ctx.gridConfig().getEncryptionSpi() instanceof  NoopEncryptionSpi;
+        encryptionDisabled = ctx.gridConfig().getEncryptionSpi() instanceof NoopEncryptionSpi;
 
         assert storeMgr != null;
         assert walMgr != null;
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/IgniteThrottlingUnitTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/IgniteThrottlingUnitTest.java
index 6f504da..070f3c9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/IgniteThrottlingUnitTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/IgniteThrottlingUnitTest.java
@@ -42,7 +42,7 @@ import static org.mockito.Mockito.when;
 public class IgniteThrottlingUnitTest {
     /** Per test timeout */
     @Rule
-    public Timeout globalTimeout = new Timeout((int) GridTestUtils.DFLT_TEST_TIMEOUT);
+    public Timeout globalTimeout = new Timeout((int)GridTestUtils.DFLT_TEST_TIMEOUT);
 
     /** Logger. */
     private IgniteLogger log = new NullLogger();
@@ -163,7 +163,7 @@ public class IgniteThrottlingUnitTest {
     public void beginOfCp() {
         PagesWriteSpeedBasedThrottle throttle = new PagesWriteSpeedBasedThrottle(pageMemory2g, null, stateChecker, log);
 
-        assertTrue(throttle.getParkTime(0.01, 100,400000,
+        assertTrue(throttle.getParkTime(0.01, 100, 400000,
             1,
             20103,
             23103) == 0);
@@ -213,10 +213,10 @@ public class IgniteThrottlingUnitTest {
     public void tooMuchPagesMarkedDirty() {
         PagesWriteSpeedBasedThrottle throttle = new PagesWriteSpeedBasedThrottle(pageMemory2g, null, stateChecker, log);
 
-       // 363308	350004	348976	10604
+        // 363308	350004	348976	10604
         long time = throttle.getParkTime(0.75,
             ((350004 + 348976) / 2),
-            350004-10604,
+            350004 - 10604,
             4,
             279,
             23933);
@@ -269,7 +269,7 @@ public class IgniteThrottlingUnitTest {
 
             throttle.onMarkDirty(false);
 
-            if(warnings.get()>0)
+            if (warnings.get() > 0)
                 break;
         }
 
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSandboxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSandboxTest.java
index 058792c..743fc3b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSandboxTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSandboxTest.java
@@ -1,19 +1,19 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.ignite.internal.processors.cache.persistence.pagemem;
 
 import java.io.Serializable;
@@ -21,10 +21,10 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.DataRegionMetrics;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteDataStreamer;
-import org.apache.ignite.DataRegionMetrics;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
@@ -34,7 +34,7 @@ import org.apache.ignite.configuration.DataStorageConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.WALMode;
 import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
+import org.apache.ignite.internal.processors.cache.persistence.CheckpointWriteProgressSupplier;
 import org.apache.ignite.internal.processors.cache.ratemetrics.HitRateMetrics;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -43,9 +43,8 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.junit.Test;
 
 /**
- * Test to visualize and debug {@link PagesWriteThrottle}.
- * Prints puts/gets rate, number of dirty pages, pages written in current checkpoint and pages in checkpoint buffer.
- * Not intended to be part of any test suite.
+ * Test to visualize and debug {@link PagesWriteThrottle}. Prints puts/gets rate, number of dirty pages, pages written
+ * in current checkpoint and pages in checkpoint buffer. Not intended to be part of any test suite.
  */
 public class PagesWriteThrottleSandboxTest extends GridCommonAbstractTest {
     /** Cache name. */
@@ -148,7 +147,7 @@ public class PagesWriteThrottleSandboxTest extends GridCommonAbstractTest {
 
                         long cpWrittenPages;
 
-                        AtomicInteger cntr = ((GridCacheDatabaseSharedManager)(((IgniteEx)ignite(0))
+                        AtomicInteger cntr = ((CheckpointWriteProgressSupplier)(((IgniteEx)ignite(0))
                             .context().cache().context().database())).writtenPagesCounter();
 
                         cpWrittenPages = cntr == null ? 0 : cntr.get();
@@ -161,12 +160,12 @@ public class PagesWriteThrottleSandboxTest extends GridCommonAbstractTest {
                             e.printStackTrace();
                         }
 
-                        System.out.println("@@@ putsPerSec=," + (putRate.getRate()) + ", getsPerSec=," + (getRate.getRate())  + ", dirtyPages=," + dirtyPages + ", cpWrittenPages=," + cpWrittenPages +", cpBufPages=," + cpBufPages);
+                        System.out.println("@@@ putsPerSec=," + (putRate.getRate()) + ", getsPerSec=," + (getRate.getRate()) + ", dirtyPages=," + dirtyPages + ", cpWrittenPages=," + cpWrittenPages + ", cpBufPages=," + cpBufPages);
 
                         try {
                             Thread.sleep(1000);
                         }
-                        catch (InterruptedException e) {
+                        catch (InterruptedException ignored) {
                             Thread.currentThread().interrupt();
                         }
                     }
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsUnitTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsUnitTestSuite.java
index c022eea..f68d60c 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsUnitTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsUnitTestSuite.java
@@ -30,7 +30,6 @@ import org.junit.runners.Suite;
 @Suite.SuiteClasses({
     IgniteThrottlingUnitTest.class,
     IgnitePageMemReplaceDelayedWriteUnitTest.class,
-    IgniteThrottlingUnitTest.class,
     FullPageIdTableTest.class,
     RobinHoodBackwardShiftHashMapTest.class
 })