Skip to content

Commit d9664b8

Browse files
IGNITE-28069 Enable EVT_CONSISTENCY_VIOLATION by default
1 parent 2a714fe commit d9664b8

File tree

5 files changed

+6
-24
lines changed

5 files changed

+6
-24
lines changed

docs/_docs/key-value-api/read-repair.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ When 4 copies (3 backups) are given, any value found two or more times, when oth
6666
|===
6767

6868
== Events
69-
link:https://ignite.apache.org/releases/{version}/javadoc/org/apache/ignite/events/EventType.html#EVT_CONSISTENCY_VIOLATION[Сonsistency Violation Event] will be recorded for each violation in case it's configured as recordable. You may listen to this event to get notified about inconsistency issues.
69+
link:https://ignite.apache.org/releases/{version}/javadoc/org/apache/ignite/events/EventType.html#EVT_CONSISTENCY_VIOLATION[Сonsistency Violation Event] will be recorded for each violation. You may listen to this event to get notified about inconsistency issues.
7070

7171
Please, refer to the link:events/listening-to-events[Working with Events] section for the information on how to listen to events.
7272

docs/_docs/tools/control-script.adoc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -699,15 +699,6 @@ The command may not work on some special/unique configurations or even cause a c
699699
Command execution MUST be checked on the test environment using the data/configuration similar to the production before the execution on the real production environment.
700700
====
701701

702-
[WARNING]
703-
====
704-
[discrete]
705-
=== Additional configuration required
706-
The command uses special link:https://ignite.apache.org/releases/{version}/javadoc/org/apache/ignite/events/EventType.html#EVT_CONSISTENCY_VIOLATION[Consistency Violation Event] to detect the consistency violations. This event must be enabled before the command execution.
707-
708-
Please, refer to the link:events/listening-to-events#enabling-events[Enabling Events] section for details.
709-
====
710-
711702
`idle_verify` command provides the inconsistent cache group names and partitions list as a result.
712703
The `repair` command allows performing cache consistency check and repair (when possible) using the link:key-value-api/read-repair[Read Repair] approach for every inconsistent partition found by `idle_verify`.
713704

modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerConsistencyTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@
6363
import static org.apache.ignite.internal.commandline.SecurityCommandHandlerPermissionsTest.enrichWithConnectionArguments;
6464
import static org.apache.ignite.internal.management.consistency.ConsistencyRepairTask.CONSISTENCY_VIOLATIONS_FOUND;
6565
import static org.apache.ignite.plugin.security.SecurityPermission.ADMIN_OPS;
66-
import static org.apache.ignite.plugin.security.SecurityPermission.EVENTS_DISABLE;
67-
import static org.apache.ignite.plugin.security.SecurityPermission.EVENTS_ENABLE;
6866
import static org.apache.ignite.plugin.security.SecurityPermissionSetBuilder.ALL_PERMISSIONS;
6967
import static org.apache.ignite.plugin.security.SecurityPermissionSetBuilder.NO_PERMISSIONS;
7068
import static org.apache.ignite.plugin.security.SecurityPermissionSetBuilder.systemPermissions;
@@ -186,8 +184,7 @@ protected CacheConfiguration<Integer, Integer> cacheConfiguration(boolean tx) {
186184
ALL_PERMISSIONS,
187185
false,
188186
new TestSecurityData(TEST_NO_PERMISSIONS_LOGIN, DEFAULT_PWD, NO_PERMISSIONS, new Permissions()),
189-
new TestSecurityData(TEST_LOGIN, DEFAULT_PWD,
190-
systemPermissions(ADMIN_OPS, EVENTS_ENABLE, EVENTS_DISABLE), new Permissions()))
187+
new TestSecurityData(TEST_LOGIN, DEFAULT_PWD, systemPermissions(ADMIN_OPS), new Permissions()))
191188
);
192189
}
193190

modules/core/src/main/java/org/apache/ignite/internal/management/consistency/ConsistencyRepairTask.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,6 @@ protected ConsistencyRepairJob(ConsistencyRepairCommandArg arg, boolean debug) {
102102
@Override protected String run(ConsistencyRepairCommandArg arg) throws IgniteException {
103103
AtomicReference<Exception> err = new AtomicReference<>();
104104

105-
boolean evtEnabled = ignite.context().event().isRecordable(EVT_CONSISTENCY_VIOLATION);
106-
107-
if (!evtEnabled)
108-
ignite.events().enableLocal(EVT_CONSISTENCY_VIOLATION);
109-
110105
Map<Boolean, List<IgniteBiTuple<Integer, String>>> res = Arrays.stream(arg.partitions())
111106
.mapToObj(p -> F.t(p, ForkJoinPool.commonPool().submit(() -> processPartition(p, arg))))
112107
.map(t -> {
@@ -122,10 +117,6 @@ protected ConsistencyRepairJob(ConsistencyRepairCommandArg arg, boolean debug) {
122117
.filter(t -> t.get2() != null)
123118
.collect(Collectors.groupingBy(t -> t.get2().startsWith(PROCESSED_PREFIX)));
124119

125-
// Restore event state. Assume no concurrent consistency repair task can be run.
126-
if (!evtEnabled)
127-
ignite.events().disableLocal(EVT_CONSISTENCY_VIOLATION);
128-
129120
if (err.get() != null || isCancelled())
130121
throw new IgniteException("Consistency task was interrupted.", err.get());
131122

@@ -168,7 +159,8 @@ private String processPartition(int p, ConsistencyRepairCommandArg arg) {
168159
else
169160
throw new IgniteException("Cache (or cache group) not found [name=" + cacheOrGrpName + "]");
170161

171-
assert ignite.context().event().isRecordable(EVT_CONSISTENCY_VIOLATION);
162+
if (!ignite.context().event().isRecordable(EVT_CONSISTENCY_VIOLATION))
163+
throw new UnsupportedOperationException("Consistency violation events recording is disabled on cluster.");
172164

173165
GridDhtLocalPartition part = grpCtx.topology().localPartition(p);
174166

modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
import static org.apache.ignite.events.EventType.EVT_CLUSTER_ACTIVATED;
7777
import static org.apache.ignite.events.EventType.EVT_CLUSTER_DEACTIVATED;
7878
import static org.apache.ignite.events.EventType.EVT_CLUSTER_STATE_CHANGED;
79+
import static org.apache.ignite.events.EventType.EVT_CONSISTENCY_VIOLATION;
7980
import static org.apache.ignite.events.EventType.EVT_JOB_MAPPED;
8081
import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
8182
import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
@@ -527,6 +528,7 @@ private boolean isInternalEvent(int type) {
527528
case EVT_CLUSTER_DEACTIVATED:
528529
case EVT_BASELINE_CHANGED:
529530
case EVT_CLUSTER_STATE_CHANGED:
531+
case EVT_CONSISTENCY_VIOLATION:
530532
return true;
531533

532534
default:

0 commit comments

Comments
 (0)