You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ab...@apache.org on 2020/09/01 07:49:11 UTC

[ignite] 01/02: add read repair page

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

abudnikov pushed a commit to branch IGNITE-7595
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 5a8681d215ae61968448dba9e2085e6c2a2124b9
Author: abudnikov <ab...@gridgain.com>
AuthorDate: Tue Sep 1 10:48:07 2020 +0300

    add read repair page
---
 docs/_data/toc.yaml                                |  2 ++
 .../ignite/snippets/BasicCacheOperations.java      | 12 +++++++
 .../java/org/apache/ignite/snippets/Tracing.java   |  1 -
 docs/_docs/read-repair.adoc                        | 40 ++++++++++++++++++++++
 docs/_includes/section-toc.html                    |  4 +--
 docs/_layouts/doc.html                             |  1 +
 docs/_sass/docs.scss                               |  9 ++++-
 7 files changed, 65 insertions(+), 4 deletions(-)

diff --git a/docs/_data/toc.yaml b/docs/_data/toc.yaml
index bab4c2d..428e9bd 100644
--- a/docs/_data/toc.yaml
+++ b/docs/_data/toc.yaml
@@ -127,6 +127,8 @@
       url: /key-value-api/binary-objects
     - title: Using Scan Queries
       url: /key-value-api/using-scan-queries
+    - title: Read Repair
+      url: /read-repair
 - title: Using Continuous Queries
   url: /key-value-api/continuous-queries
 - title: Performing Transactions
diff --git a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/BasicCacheOperations.java b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/BasicCacheOperations.java
index 87631db..3ae3786 100644
--- a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/BasicCacheOperations.java
+++ b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/BasicCacheOperations.java
@@ -108,4 +108,16 @@ public class BasicCacheOperations {
             // end::async[]
         }
     }
+
+    void readRepair() {
+
+        try (Ignite ignite = Ignition.start()) {
+            //tag::read-repair[]
+            IgniteCache<Object, Object> cache = ignite.cache("my_cache").withReadRepair();
+
+            Object value = cache.get(10);
+            //end::read-repair[]
+        }
+
+    }
 }
diff --git a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/Tracing.java b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/Tracing.java
index 35bbc34..e52efe0 100644
--- a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/Tracing.java
+++ b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/Tracing.java
@@ -13,7 +13,6 @@ import org.apache.ignite.spi.tracing.TracingConfigurationParameters;
 import org.apache.ignite.transactions.Transaction;
 import org.junit.jupiter.api.Test;
 
-import io.opencensus.common.Duration;
 import io.opencensus.exporter.trace.zipkin.ZipkinExporterConfiguration;
 import io.opencensus.exporter.trace.zipkin.ZipkinTraceExporter;
 
diff --git a/docs/_docs/read-repair.adoc b/docs/_docs/read-repair.adoc
new file mode 100644
index 0000000..c558664
--- /dev/null
+++ b/docs/_docs/read-repair.adoc
@@ -0,0 +1,40 @@
+= Read Repair
+
+WARNING: Experimental API.
+
+
+"Read Repair" refers to a technique of repairing inconsistencies between primary and backup copies of data during normal read operations. When a specific key (or keys) is read by a user operation, Ignite checks the values for the given key in all backup copies.
+
+The Read Repair mode is designed to maintain consistency. However, read operations become {tilde}2 times more costly because backup copies are checked. It is generally not advisable to use this mode all the time, but rather on a once-in-a-while basis.
+
+To enable Read Repair mode, obtain an instance of the cache that enables Read Repair reads as follows:
+
+[source, java]
+----
+include::{javaCodeDir}/BasicCacheOperations.java[tags=read-repair, indent=0]
+----
+
+A consistency check is incompatible with the following cache configurations:
+
+* Caches without backups.
+* Local caches.
+* Near caches.
+* Caches that use "read-through" mode.
+
+== Transactional Caches
+
+Values across the topology will be replaced by the latest versioned value.
+
+*  Automatically for transactions that have `TransactionConcurrency.OPTIMISTIC` concurrency mode or `TransactionIsolation.READ_COMMITTED` isolation level
+*  at the commit() phase for transactions that have `TransactionConcurrency.PESSIMISTIC` concurrency mode and isolation level other than `TransactionIsolation.READ_COMMITTED`
+
+When a backup inconsistency is detected, Ignite will generate a link:https://ignite.apache.org/releases/{version}/javadoc/org/apache/ignite/events/EventType.html#EVT_CONSISTENCY_VIOLATION[consistency violation event] (if the event is enabled in the configuration). You can listen to this event to get notified about inconsistency issues. Refer to the link:events/listening-to-events[Working with Events] section for the information on how to listen to events.
+
+Read Repair does not guarantee "all copies check" in case value already cached inside the transaction.
+For example, in case you use !TransactionIsolation.READ_COMMITTED isolation mode and already read the value or performed a write, you'll gain the cached value.
+
+== Atomic Caches
+
+The consistency violation exception is thrown if differences are found.
+
+Due to the nature of the atomic cache, false-positive results can be observed. For example, an attempt to check consistency under cache loading may lead to consistency violation exception. By default, the implementation tries to check the given key three times. The number of attempts can be changed by setting `IGNITE_NEAR_GET_MAX_REMAPS` system property.
diff --git a/docs/_includes/section-toc.html b/docs/_includes/section-toc.html
index f8fd86f..394a256 100644
--- a/docs/_includes/section-toc.html
+++ b/docs/_includes/section-toc.html
@@ -1,13 +1,13 @@
 {% assign s = include.section %}
 
 {% if include.title %}
-<a {% if s.url %} href="{{site.attrs.base_url}}/{{site.attrs.version}}/{{s.url}}" {% endif %}>{{s.title}}</a>
+<a {% if s.url %} href="{{site.attrs.base_url}}/{{s.url}}" {% endif %}>{{s.title}}</a>
 {% endif %}
 
 {% if s.items %}
     <ul class='sub_pages'>
     {% for subpage in s.items %}
-        <li><a href="{{site.attrs.base_url}}/{{site.attrs.version}}/{{subpage.url}}" class=''>{{subpage.title}}</a></li>
+        <li><a href="{{site.attrs.base_url}}/{{subpage.url}}" class=''>{{subpage.title}}</a></li>
     {% endfor %}
     </ul>
 {% endif %}
diff --git a/docs/_layouts/doc.html b/docs/_layouts/doc.html
index 80c5798..0d99907 100644
--- a/docs/_layouts/doc.html
+++ b/docs/_layouts/doc.html
@@ -10,6 +10,7 @@ layout: default
             <h1>{{page.title}}</h1>
         {% endif %}
         {{content}}
+        {% include copyright.html %}
     </article>
     {% include right-nav.html %}    
 </section>
diff --git a/docs/_sass/docs.scss b/docs/_sass/docs.scss
index 90c409c..4dffc83 100644
--- a/docs/_sass/docs.scss
+++ b/docs/_sass/docs.scss
@@ -125,8 +125,15 @@ section.page-docs {
 	}
 	table tr.even,table tr.alt{background:#f8f8f7}
     table.stripes-all tr,table.stripes-odd tr:nth-of-type(odd),table.stripes-even tr:nth-of-type(even),table.stripes-hover tr:hover{background:#f8f8f7}
+}
 
-
+.copyright {
+    margin-top: 3em;
+    padding-top: 1em;
+    border-top: 1px solid #f0f0f0;
+    font-size: 0.9em;
+    line-height: 1.8em;
+    color: #757575;
 }
 
 body.hide-left-nav {