You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/07/30 13:47:58 UTC
[GitHub] [ignite] anton-vinogradov opened a new pull request #9288: IGNITE-15180 Read Repair should generate Event even when nothing fixed but broken (eg. atomics check).
anton-vinogradov opened a new pull request #9288:
URL: https://github.com/apache/ignite/pull/9288
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
- [ ] There is a single JIRA ticket related to the pull request.
- [ ] The web-link to the pull request is attached to the JIRA ticket.
- [ ] The JIRA ticket has the _Patch Available_ state.
- [ ] The pull request body describes changes that have been made.
The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
- [ ] The pull request title is treated as the final commit message.
The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
- [ ] A reviewer has been mentioned through the JIRA comments
(see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers))
- [ ] The pull request has been checked by the Teamcity Bot and
the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
### Notes
- [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
- [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
- [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
- [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] ivandasch commented on a change in pull request #9288: IGNITE-15180 Read Repair should generate Event even when nothing fixed but broken (eg. atomics check).
Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #9288:
URL: https://github.com/apache/ignite/pull/9288#discussion_r680944378
##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/consistency/GridNearReadRepairAbstractFuture.java
##########
@@ -228,4 +254,103 @@ else if (!canRemap)
* Reduces fut's results.
*/
protected abstract void reduce();
+
+ /**
+ * @param fixedEntries Fixed map.
+ */
+ protected void recordConsistencyViolation(
+ Set<KeyCacheObject> inconsistentKeys,
+ Map<KeyCacheObject, EntryGetResult> fixedEntries
+ ) {
+ GridEventStorageManager evtMgr = ctx.gridEvents();
+
+ if (!evtMgr.isRecordable(EVT_CONSISTENCY_VIOLATION))
+ return;
+
+ Map<Object, Map<ClusterNode, CacheConsistencyViolationEvent.EntryInfo>> originalMap = new HashMap<>();
+
+ for (Map.Entry<ClusterNode, GridPartitionedGetFuture<KeyCacheObject, EntryGetResult>> pair : futs.entrySet()) {
+ ClusterNode node = pair.getKey();
+
+ GridPartitionedGetFuture<KeyCacheObject, EntryGetResult> fut = pair.getValue();
+
+ for (Map.Entry<KeyCacheObject, EntryGetResult> entry : fut.result().entrySet()) {
+ KeyCacheObject key = entry.getKey();
+
+ if (inconsistentKeys.contains(key)) {
+ EntryGetResult res = entry.getValue();
+ CacheEntryVersion ver = res.version();
+
+ Object val = ctx.unwrapBinaryIfNeeded(res.value(), false, false, null);
+
+ Map<ClusterNode, CacheConsistencyViolationEvent.EntryInfo> map =
+ originalMap.computeIfAbsent(
+ ctx.unwrapBinaryIfNeeded(key, false, false, null), k -> new HashMap<>());
+
+ boolean primary = primaries.get(key).equals(fut.affNode());
Review comment:
Lets avoid possible NPE
`fut.affNode().equals(primaries.get(key))`
`res.equals(fixedEntries.get(key))`
Even better to use `Objects#equals`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] anton-vinogradov commented on a change in pull request #9288: IGNITE-15180 Read Repair should generate Event even when nothing fixed but broken (eg. atomics check).
Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #9288:
URL: https://github.com/apache/ignite/pull/9288#discussion_r680975783
##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/consistency/GridNearReadRepairAbstractFuture.java
##########
@@ -228,4 +254,103 @@ else if (!canRemap)
* Reduces fut's results.
*/
protected abstract void reduce();
+
+ /**
+ * @param fixedEntries Fixed map.
+ */
+ protected void recordConsistencyViolation(
+ Set<KeyCacheObject> inconsistentKeys,
+ Map<KeyCacheObject, EntryGetResult> fixedEntries
+ ) {
+ GridEventStorageManager evtMgr = ctx.gridEvents();
+
+ if (!evtMgr.isRecordable(EVT_CONSISTENCY_VIOLATION))
+ return;
+
+ Map<Object, Map<ClusterNode, CacheConsistencyViolationEvent.EntryInfo>> originalMap = new HashMap<>();
+
+ for (Map.Entry<ClusterNode, GridPartitionedGetFuture<KeyCacheObject, EntryGetResult>> pair : futs.entrySet()) {
+ ClusterNode node = pair.getKey();
+
+ GridPartitionedGetFuture<KeyCacheObject, EntryGetResult> fut = pair.getValue();
+
+ for (Map.Entry<KeyCacheObject, EntryGetResult> entry : fut.result().entrySet()) {
+ KeyCacheObject key = entry.getKey();
+
+ if (inconsistentKeys.contains(key)) {
+ EntryGetResult res = entry.getValue();
+ CacheEntryVersion ver = res.version();
+
+ Object val = ctx.unwrapBinaryIfNeeded(res.value(), false, false, null);
+
+ Map<ClusterNode, CacheConsistencyViolationEvent.EntryInfo> map =
+ originalMap.computeIfAbsent(
+ ctx.unwrapBinaryIfNeeded(key, false, false, null), k -> new HashMap<>());
+
+ boolean primary = primaries.get(key).equals(fut.affNode());
+ boolean correct = fixedEntries != null && fixedEntries.get(key).equals(res);
+
+ map.put(node, new EventEventEntryInfo(val, ver, primary, correct));
+ }
+ }
+ }
+
+ evtMgr.record(new CacheConsistencyViolationEvent(
+ ctx.discovery().localNode(),
+ "Consistency violation fixed.",
+ originalMap));
+ }
+
+ /**
+ *
+ */
+ private static class EventEventEntryInfo implements CacheConsistencyViolationEvent.EntryInfo {
+ /** Value. */
+ Object val;
Review comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] ivandasch commented on a change in pull request #9288: IGNITE-15180 Read Repair should generate Event even when nothing fixed but broken (eg. atomics check).
Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #9288:
URL: https://github.com/apache/ignite/pull/9288#discussion_r680944378
##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/consistency/GridNearReadRepairAbstractFuture.java
##########
@@ -228,4 +254,103 @@ else if (!canRemap)
* Reduces fut's results.
*/
protected abstract void reduce();
+
+ /**
+ * @param fixedEntries Fixed map.
+ */
+ protected void recordConsistencyViolation(
+ Set<KeyCacheObject> inconsistentKeys,
+ Map<KeyCacheObject, EntryGetResult> fixedEntries
+ ) {
+ GridEventStorageManager evtMgr = ctx.gridEvents();
+
+ if (!evtMgr.isRecordable(EVT_CONSISTENCY_VIOLATION))
+ return;
+
+ Map<Object, Map<ClusterNode, CacheConsistencyViolationEvent.EntryInfo>> originalMap = new HashMap<>();
+
+ for (Map.Entry<ClusterNode, GridPartitionedGetFuture<KeyCacheObject, EntryGetResult>> pair : futs.entrySet()) {
+ ClusterNode node = pair.getKey();
+
+ GridPartitionedGetFuture<KeyCacheObject, EntryGetResult> fut = pair.getValue();
+
+ for (Map.Entry<KeyCacheObject, EntryGetResult> entry : fut.result().entrySet()) {
+ KeyCacheObject key = entry.getKey();
+
+ if (inconsistentKeys.contains(key)) {
+ EntryGetResult res = entry.getValue();
+ CacheEntryVersion ver = res.version();
+
+ Object val = ctx.unwrapBinaryIfNeeded(res.value(), false, false, null);
+
+ Map<ClusterNode, CacheConsistencyViolationEvent.EntryInfo> map =
+ originalMap.computeIfAbsent(
+ ctx.unwrapBinaryIfNeeded(key, false, false, null), k -> new HashMap<>());
+
+ boolean primary = primaries.get(key).equals(fut.affNode());
Review comment:
Lets avoid possible NPE
`fut.affNode().equals(primaries.get(key))`
`res.equals(fixedEntries.get(key))`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] anton-vinogradov commented on a change in pull request #9288: IGNITE-15180 Read Repair should generate Event even when nothing fixed but broken (eg. atomics check).
Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #9288:
URL: https://github.com/apache/ignite/pull/9288#discussion_r680969192
##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/consistency/GridNearReadRepairAbstractFuture.java
##########
@@ -228,4 +254,103 @@ else if (!canRemap)
* Reduces fut's results.
*/
protected abstract void reduce();
+
+ /**
+ * @param fixedEntries Fixed map.
+ */
+ protected void recordConsistencyViolation(
+ Set<KeyCacheObject> inconsistentKeys,
+ Map<KeyCacheObject, EntryGetResult> fixedEntries
+ ) {
+ GridEventStorageManager evtMgr = ctx.gridEvents();
+
+ if (!evtMgr.isRecordable(EVT_CONSISTENCY_VIOLATION))
+ return;
+
+ Map<Object, Map<ClusterNode, CacheConsistencyViolationEvent.EntryInfo>> originalMap = new HashMap<>();
+
+ for (Map.Entry<ClusterNode, GridPartitionedGetFuture<KeyCacheObject, EntryGetResult>> pair : futs.entrySet()) {
+ ClusterNode node = pair.getKey();
+
+ GridPartitionedGetFuture<KeyCacheObject, EntryGetResult> fut = pair.getValue();
+
+ for (Map.Entry<KeyCacheObject, EntryGetResult> entry : fut.result().entrySet()) {
+ KeyCacheObject key = entry.getKey();
+
+ if (inconsistentKeys.contains(key)) {
+ EntryGetResult res = entry.getValue();
+ CacheEntryVersion ver = res.version();
+
+ Object val = ctx.unwrapBinaryIfNeeded(res.value(), false, false, null);
+
+ Map<ClusterNode, CacheConsistencyViolationEvent.EntryInfo> map =
+ originalMap.computeIfAbsent(
+ ctx.unwrapBinaryIfNeeded(key, false, false, null), k -> new HashMap<>());
+
+ boolean primary = primaries.get(key).equals(fut.affNode());
Review comment:
`primaries.get(key)` MUST be not null in this code (because primary should be recorded for each key).
`Objects#equals` overcomplicates the code without real need.
Let's keep it as is.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] anton-vinogradov merged pull request #9288: IGNITE-15180 Read Repair should generate Event even when nothing fixed but broken (eg. atomics check).
Posted by GitBox <gi...@apache.org>.
anton-vinogradov merged pull request #9288:
URL: https://github.com/apache/ignite/pull/9288
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] ivandasch commented on a change in pull request #9288: IGNITE-15180 Read Repair should generate Event even when nothing fixed but broken (eg. atomics check).
Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #9288:
URL: https://github.com/apache/ignite/pull/9288#discussion_r680945010
##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/consistency/GridNearReadRepairAbstractFuture.java
##########
@@ -228,4 +254,103 @@ else if (!canRemap)
* Reduces fut's results.
*/
protected abstract void reduce();
+
+ /**
+ * @param fixedEntries Fixed map.
+ */
+ protected void recordConsistencyViolation(
+ Set<KeyCacheObject> inconsistentKeys,
+ Map<KeyCacheObject, EntryGetResult> fixedEntries
+ ) {
+ GridEventStorageManager evtMgr = ctx.gridEvents();
+
+ if (!evtMgr.isRecordable(EVT_CONSISTENCY_VIOLATION))
+ return;
+
+ Map<Object, Map<ClusterNode, CacheConsistencyViolationEvent.EntryInfo>> originalMap = new HashMap<>();
+
+ for (Map.Entry<ClusterNode, GridPartitionedGetFuture<KeyCacheObject, EntryGetResult>> pair : futs.entrySet()) {
+ ClusterNode node = pair.getKey();
+
+ GridPartitionedGetFuture<KeyCacheObject, EntryGetResult> fut = pair.getValue();
+
+ for (Map.Entry<KeyCacheObject, EntryGetResult> entry : fut.result().entrySet()) {
+ KeyCacheObject key = entry.getKey();
+
+ if (inconsistentKeys.contains(key)) {
+ EntryGetResult res = entry.getValue();
+ CacheEntryVersion ver = res.version();
+
+ Object val = ctx.unwrapBinaryIfNeeded(res.value(), false, false, null);
+
+ Map<ClusterNode, CacheConsistencyViolationEvent.EntryInfo> map =
+ originalMap.computeIfAbsent(
+ ctx.unwrapBinaryIfNeeded(key, false, false, null), k -> new HashMap<>());
+
+ boolean primary = primaries.get(key).equals(fut.affNode());
+ boolean correct = fixedEntries != null && fixedEntries.get(key).equals(res);
+
+ map.put(node, new EventEventEntryInfo(val, ver, primary, correct));
+ }
+ }
+ }
+
+ evtMgr.record(new CacheConsistencyViolationEvent(
+ ctx.discovery().localNode(),
+ "Consistency violation fixed.",
+ originalMap));
+ }
+
+ /**
+ *
+ */
+ private static class EventEventEntryInfo implements CacheConsistencyViolationEvent.EntryInfo {
+ /** Value. */
+ Object val;
Review comment:
lets make it final (class and fields)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] anton-vinogradov merged pull request #9288: IGNITE-15180 Read Repair should generate Event even when nothing fixed but broken (eg. atomics check).
Posted by GitBox <gi...@apache.org>.
anton-vinogradov merged pull request #9288:
URL: https://github.com/apache/ignite/pull/9288
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org