[PR] IGNITE-22756 Fix dns_failure ducktest to work with jdk 9 and above [ignite]

2024-07-16 Thread via GitHub


skorotkov opened a new pull request, #11440:
URL: https://github.com/apache/ignite/pull/11440

   Support test for JDK 9 and above.  In particular JDK17
   
   ---
   
   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
   - [X] There is a single JIRA ticket related to the pull request. 
   - [X] The web-link to the pull request is attached to the JIRA ticket.
   - [X] The JIRA ticket has the _Patch Available_ state.
   - [X] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [X] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE- Change summary` where 
`` - 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 d...@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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22710 Add exception translation to Transaction implementations [ignite-3]

2024-07-16 Thread via GitHub


rpuch merged PR #4070:
URL: https://github.com/apache/ignite-3/pull/4070


-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22605 Add check for SSL errors on TcpDiscovery writing failures [ignite]

2024-07-16 Thread via GitHub


timoninmaxim merged PR #11415:
URL: https://github.com/apache/ignite/pull/11415


-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22555 Fixed assertion in ReplicaStateManager.onPrimaryElected [ignite-3]

2024-07-16 Thread via GitHub


vldpyatkov merged PR #4055:
URL: https://github.com/apache/ignite-3/pull/4055


-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22735 Sql. Avoid double parsing of sql queries [ignite-3]

2024-07-16 Thread via GitHub


korlov42 merged PR #4085:
URL: https://github.com/apache/ignite-3/pull/4085


-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22662 : Snapshot check as distributed process [ignite]

2024-07-16 Thread via GitHub


Vladsz83 commented on code in PR #11391:
URL: https://github.com/apache/ignite/pull/11391#discussion_r1679643145


##
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotCheckProcess.java:
##
@@ -0,0 +1,549 @@
+/*
+ * 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.snapshot;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.management.cache.IdleVerifyResultV2;
+import org.apache.ignite.internal.management.cache.PartitionKeyV2;
+import 
org.apache.ignite.internal.processors.cache.verify.PartitionHashRecordV2;
+import org.apache.ignite.internal.util.distributed.DistributedProcess;
+import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
+import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_CHECK_METAS;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_VALIDATE_PARTS;
+
+/** Distributed process of snapshot checking (with the partition hashes). */
+public class SnapshotCheckProcess {
+/** */
+private final IgniteLogger log;
+
+/** */
+private final GridKernalContext kctx;
+
+/** Snapshot check requests per snapshot on every node. */
+private final Map requests = new 
ConcurrentHashMap<>();
+
+/** Cluster-wide operation futures per snapshot called from current node. 
*/
+private final Map> clusterOpFuts = new 
ConcurrentHashMap<>();
+
+/** Check metas first phase subprocess. */
+private final DistributedProcess phase1CheckMetas;
+
+/** Partition hashes second phase subprocess.  */
+private final DistributedProcess phase2PartsHashes;
+
+/** */
+public SnapshotCheckProcess(GridKernalContext kctx) {
+this.kctx = kctx;
+
+log = kctx.log(getClass());
+
+phase1CheckMetas = new DistributedProcess<>(kctx, 
SNAPSHOT_CHECK_METAS, this::prepareAndCheckMetas,
+this::reducePreparationAndMetasCheck);
+
+phase2PartsHashes = new DistributedProcess<>(kctx, 
SNAPSHOT_VALIDATE_PARTS, this::validateParts,
+this::reduceValidatePartsAndFinish);
+
+kctx.event().addLocalEventListener((evt) -> 
nodeLeft(((DiscoveryEvent)evt).eventNode()), EVT_NODE_FAILED, EVT_NODE_LEFT);
+}
+
+/** */
+Map requests() {
+return Collections.unmodifiableMap(requests);
+}
+
+/**
+ * Stops the process with the passed exception.
+ *
+ * @param th The interrupt reason.
+ * @param rqFilter If not {@code null}, used to filter which 
requests/process to stop. If {@code null}, stops all the validations.
+ */
+void interrupt(Throwable th, @Nullable 
Function rqFilter) {
+requests.values().forEach(rq -> {
+if (rqFilter == null || rqFilter.apply(rq)) {
+rq.error(th);
+
+clean(rq.requestId(), th, null, null);
+}
+});
+}
+
+/** Stops the related validation if the node is a mandatory one. */
+private v

Re: [PR] IGNITE-22735 Sql. Avoid double parsing of sql queries [ignite-3]

2024-07-16 Thread via GitHub


korlov42 commented on code in PR #4085:
URL: https://github.com/apache/ignite-3/pull/4085#discussion_r1679570967


##
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlToRelConvertor.java:
##
@@ -322,4 +324,44 @@ private RelNode convertMerge(SqlMerge call) {
 relBuilder.build(), LogicalTableModify.Operation.MERGE,
 targetColumnNameList, null, false);
 }
+
+// =

Review Comment:
   done
   
   https://issues.apache.org/jira/browse/IGNITE-22755



-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22555 Fixed assertion in ReplicaStateManager.onPrimaryElected [ignite-3]

2024-07-16 Thread via GitHub


denis-chudov commented on code in PR #4055:
URL: https://github.com/apache/ignite-3/pull/4055#discussion_r1679469018


##
modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/LeaseUpdater.java:
##
@@ -449,12 +460,16 @@ private void updateLeaseBatchInternal() {
 if (e != null) {
 LOG.error("Lease update invocation failed", e);
 
+cancelAgreements(toBeNegotiated.keySet());
+
 return;
 }
 
 if (!success) {
 LOG.debug("Lease update invocation failed");

Review Comment:
   done



##
modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/negotiation/LeaseNegotiator.java:
##
@@ -120,12 +120,26 @@ public LeaseAgreement 
getAndRemoveIfReady(ReplicationGroupId groupId) {
 return res[0] == null ? UNDEFINED_AGREEMENT : res[0];
 }
 
+/**
+ * Creates an agreement.
+ *
+ * @param groupId Group id.
+ * @param lease Lease to negotiate.
+ */
+public void createAgreement(ReplicationGroupId groupId, Lease lease) {
+leaseToNegotiate.put(groupId, new LeaseAgreement(lease, new 
CompletableFuture<>()));

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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22555 Fixed assertion in ReplicaStateManager.onPrimaryElected [ignite-3]

2024-07-16 Thread via GitHub


denis-chudov commented on code in PR #4055:
URL: https://github.com/apache/ignite-3/pull/4055#discussion_r1679467163


##
modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/negotiation/LeaseAgreement.java:
##
@@ -158,4 +158,12 @@ public void checkValid(
 }
 }
 }
+
+void onResponse(LeaseGrantedMessageResponse response) {
+responseFut.complete(response);

Review Comment:
   exactly



-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22662 : Snapshot check as distributed process [ignite]

2024-07-16 Thread via GitHub


Vladsz83 commented on code in PR #11391:
URL: https://github.com/apache/ignite/pull/11391#discussion_r1679464466


##
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotCheckProcess.java:
##
@@ -0,0 +1,549 @@
+/*
+ * 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.snapshot;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.management.cache.IdleVerifyResultV2;
+import org.apache.ignite.internal.management.cache.PartitionKeyV2;
+import 
org.apache.ignite.internal.processors.cache.verify.PartitionHashRecordV2;
+import org.apache.ignite.internal.util.distributed.DistributedProcess;
+import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
+import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_CHECK_METAS;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_VALIDATE_PARTS;
+
+/** Distributed process of snapshot checking (with the partition hashes). */
+public class SnapshotCheckProcess {
+/** */
+private final IgniteLogger log;
+
+/** */
+private final GridKernalContext kctx;
+
+/** Snapshot check requests per snapshot on every node. */
+private final Map requests = new 
ConcurrentHashMap<>();
+
+/** Cluster-wide operation futures per snapshot called from current node. 
*/
+private final Map> clusterOpFuts = new 
ConcurrentHashMap<>();
+
+/** Check metas first phase subprocess. */
+private final DistributedProcess phase1CheckMetas;
+
+/** Partition hashes second phase subprocess.  */
+private final DistributedProcess phase2PartsHashes;
+
+/** */
+public SnapshotCheckProcess(GridKernalContext kctx) {
+this.kctx = kctx;
+
+log = kctx.log(getClass());
+
+phase1CheckMetas = new DistributedProcess<>(kctx, 
SNAPSHOT_CHECK_METAS, this::prepareAndCheckMetas,
+this::reducePreparationAndMetasCheck);
+
+phase2PartsHashes = new DistributedProcess<>(kctx, 
SNAPSHOT_VALIDATE_PARTS, this::validateParts,
+this::reduceValidatePartsAndFinish);
+
+kctx.event().addLocalEventListener((evt) -> 
nodeLeft(((DiscoveryEvent)evt).eventNode()), EVT_NODE_FAILED, EVT_NODE_LEFT);
+}
+
+/** */
+Map requests() {
+return Collections.unmodifiableMap(requests);
+}
+
+/**
+ * Stops the process with the passed exception.
+ *
+ * @param th The interrupt reason.
+ * @param rqFilter If not {@code null}, used to filter which 
requests/process to stop. If {@code null}, stops all the validations.
+ */
+void interrupt(Throwable th, @Nullable 
Function rqFilter) {
+requests.values().forEach(rq -> {
+if (rqFilter == null || rqFilter.apply(rq)) {
+rq.error(th);
+
+clean(rq.requestId(), th, null, null);
+}
+});
+}
+
+/** Stops the related validation if the node is a mandatory one. */
+private v

Re: [PR] IGNITE-22662 : Snapshot check as distributed process [ignite]

2024-07-16 Thread via GitHub


Vladsz83 commented on code in PR #11391:
URL: https://github.com/apache/ignite/pull/11391#discussion_r1679463472


##
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotCheckProcess.java:
##
@@ -0,0 +1,549 @@
+/*
+ * 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.snapshot;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.management.cache.IdleVerifyResultV2;
+import org.apache.ignite.internal.management.cache.PartitionKeyV2;
+import 
org.apache.ignite.internal.processors.cache.verify.PartitionHashRecordV2;
+import org.apache.ignite.internal.util.distributed.DistributedProcess;
+import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
+import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_CHECK_METAS;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_VALIDATE_PARTS;
+
+/** Distributed process of snapshot checking (with the partition hashes). */
+public class SnapshotCheckProcess {
+/** */
+private final IgniteLogger log;
+
+/** */
+private final GridKernalContext kctx;
+
+/** Snapshot check requests per snapshot on every node. */
+private final Map requests = new 
ConcurrentHashMap<>();
+
+/** Cluster-wide operation futures per snapshot called from current node. 
*/
+private final Map> clusterOpFuts = new 
ConcurrentHashMap<>();
+
+/** Check metas first phase subprocess. */
+private final DistributedProcess phase1CheckMetas;
+
+/** Partition hashes second phase subprocess.  */
+private final DistributedProcess phase2PartsHashes;
+
+/** */
+public SnapshotCheckProcess(GridKernalContext kctx) {
+this.kctx = kctx;
+
+log = kctx.log(getClass());
+
+phase1CheckMetas = new DistributedProcess<>(kctx, 
SNAPSHOT_CHECK_METAS, this::prepareAndCheckMetas,
+this::reducePreparationAndMetasCheck);
+
+phase2PartsHashes = new DistributedProcess<>(kctx, 
SNAPSHOT_VALIDATE_PARTS, this::validateParts,
+this::reduceValidatePartsAndFinish);
+
+kctx.event().addLocalEventListener((evt) -> 
nodeLeft(((DiscoveryEvent)evt).eventNode()), EVT_NODE_FAILED, EVT_NODE_LEFT);
+}
+
+/** */
+Map requests() {
+return Collections.unmodifiableMap(requests);
+}
+
+/**
+ * Stops the process with the passed exception.
+ *
+ * @param th The interrupt reason.
+ * @param rqFilter If not {@code null}, used to filter which 
requests/process to stop. If {@code null}, stops all the validations.
+ */
+void interrupt(Throwable th, @Nullable 
Function rqFilter) {
+requests.values().forEach(rq -> {
+if (rqFilter == null || rqFilter.apply(rq)) {
+rq.error(th);
+
+clean(rq.requestId(), th, null, null);
+}
+});
+}
+
+/** Stops the related validation if the node is a mandatory one. */
+private v

Re: [PR] IGNITE-22662 : Snapshot check as distributed process [ignite]

2024-07-16 Thread via GitHub


Vladsz83 commented on code in PR #11391:
URL: https://github.com/apache/ignite/pull/11391#discussion_r1679400040


##
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotCheckProcess.java:
##
@@ -0,0 +1,549 @@
+/*
+ * 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.snapshot;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.management.cache.IdleVerifyResultV2;
+import org.apache.ignite.internal.management.cache.PartitionKeyV2;
+import 
org.apache.ignite.internal.processors.cache.verify.PartitionHashRecordV2;
+import org.apache.ignite.internal.util.distributed.DistributedProcess;
+import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
+import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_CHECK_METAS;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_VALIDATE_PARTS;
+
+/** Distributed process of snapshot checking (with the partition hashes). */
+public class SnapshotCheckProcess {
+/** */
+private final IgniteLogger log;
+
+/** */
+private final GridKernalContext kctx;
+
+/** Snapshot check requests per snapshot on every node. */
+private final Map requests = new 
ConcurrentHashMap<>();
+
+/** Cluster-wide operation futures per snapshot called from current node. 
*/
+private final Map> clusterOpFuts = new 
ConcurrentHashMap<>();
+
+/** Check metas first phase subprocess. */
+private final DistributedProcess phase1CheckMetas;
+
+/** Partition hashes second phase subprocess.  */
+private final DistributedProcess phase2PartsHashes;
+
+/** */
+public SnapshotCheckProcess(GridKernalContext kctx) {
+this.kctx = kctx;
+
+log = kctx.log(getClass());
+
+phase1CheckMetas = new DistributedProcess<>(kctx, 
SNAPSHOT_CHECK_METAS, this::prepareAndCheckMetas,
+this::reducePreparationAndMetasCheck);
+
+phase2PartsHashes = new DistributedProcess<>(kctx, 
SNAPSHOT_VALIDATE_PARTS, this::validateParts,
+this::reduceValidatePartsAndFinish);
+
+kctx.event().addLocalEventListener((evt) -> 
nodeLeft(((DiscoveryEvent)evt).eventNode()), EVT_NODE_FAILED, EVT_NODE_LEFT);
+}
+
+/** */
+Map requests() {
+return Collections.unmodifiableMap(requests);
+}
+
+/**
+ * Stops the process with the passed exception.
+ *
+ * @param th The interrupt reason.
+ * @param rqFilter If not {@code null}, used to filter which 
requests/process to stop. If {@code null}, stops all the validations.
+ */
+void interrupt(Throwable th, @Nullable 
Function rqFilter) {
+requests.values().forEach(rq -> {
+if (rqFilter == null || rqFilter.apply(rq)) {
+rq.error(th);
+
+clean(rq.requestId(), th, null, null);
+}
+});
+}
+
+/** Stops the related validation if the node is a mandatory one. */
+private v

Re: [PR] IGNITE-22662 : Snapshot check as distributed process [ignite]

2024-07-16 Thread via GitHub


Vladsz83 commented on code in PR #11391:
URL: https://github.com/apache/ignite/pull/11391#discussion_r1679406593


##
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotCheckProcess.java:
##
@@ -0,0 +1,549 @@
+/*
+ * 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.snapshot;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.management.cache.IdleVerifyResultV2;
+import org.apache.ignite.internal.management.cache.PartitionKeyV2;
+import 
org.apache.ignite.internal.processors.cache.verify.PartitionHashRecordV2;
+import org.apache.ignite.internal.util.distributed.DistributedProcess;
+import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
+import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_CHECK_METAS;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_VALIDATE_PARTS;
+
+/** Distributed process of snapshot checking (with the partition hashes). */
+public class SnapshotCheckProcess {
+/** */
+private final IgniteLogger log;
+
+/** */
+private final GridKernalContext kctx;
+
+/** Snapshot check requests per snapshot on every node. */
+private final Map requests = new 
ConcurrentHashMap<>();
+
+/** Cluster-wide operation futures per snapshot called from current node. 
*/
+private final Map> clusterOpFuts = new 
ConcurrentHashMap<>();
+
+/** Check metas first phase subprocess. */
+private final DistributedProcess phase1CheckMetas;
+
+/** Partition hashes second phase subprocess.  */
+private final DistributedProcess phase2PartsHashes;
+
+/** */
+public SnapshotCheckProcess(GridKernalContext kctx) {
+this.kctx = kctx;
+
+log = kctx.log(getClass());
+
+phase1CheckMetas = new DistributedProcess<>(kctx, 
SNAPSHOT_CHECK_METAS, this::prepareAndCheckMetas,
+this::reducePreparationAndMetasCheck);
+
+phase2PartsHashes = new DistributedProcess<>(kctx, 
SNAPSHOT_VALIDATE_PARTS, this::validateParts,
+this::reduceValidatePartsAndFinish);
+
+kctx.event().addLocalEventListener((evt) -> 
nodeLeft(((DiscoveryEvent)evt).eventNode()), EVT_NODE_FAILED, EVT_NODE_LEFT);
+}
+
+/** */
+Map requests() {
+return Collections.unmodifiableMap(requests);
+}
+
+/**
+ * Stops the process with the passed exception.
+ *
+ * @param th The interrupt reason.
+ * @param rqFilter If not {@code null}, used to filter which 
requests/process to stop. If {@code null}, stops all the validations.
+ */
+void interrupt(Throwable th, @Nullable 
Function rqFilter) {
+requests.values().forEach(rq -> {
+if (rqFilter == null || rqFilter.apply(rq)) {
+rq.error(th);
+
+clean(rq.requestId(), th, null, null);
+}
+});
+}
+
+/** Stops the related validation if the node is a mandatory one. */
+private v

Re: [PR] IGNITE-22662 : Snapshot check as distributed process [ignite]

2024-07-16 Thread via GitHub


Vladsz83 commented on code in PR #11391:
URL: https://github.com/apache/ignite/pull/11391#discussion_r1679436087


##
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotCheckProcess.java:
##
@@ -0,0 +1,549 @@
+/*
+ * 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.snapshot;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.management.cache.IdleVerifyResultV2;
+import org.apache.ignite.internal.management.cache.PartitionKeyV2;
+import 
org.apache.ignite.internal.processors.cache.verify.PartitionHashRecordV2;
+import org.apache.ignite.internal.util.distributed.DistributedProcess;
+import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
+import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_CHECK_METAS;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_VALIDATE_PARTS;
+
+/** Distributed process of snapshot checking (with the partition hashes). */
+public class SnapshotCheckProcess {
+/** */
+private final IgniteLogger log;
+
+/** */
+private final GridKernalContext kctx;
+
+/** Snapshot check requests per snapshot on every node. */
+private final Map requests = new 
ConcurrentHashMap<>();
+
+/** Cluster-wide operation futures per snapshot called from current node. 
*/
+private final Map> clusterOpFuts = new 
ConcurrentHashMap<>();
+
+/** Check metas first phase subprocess. */
+private final DistributedProcess phase1CheckMetas;
+
+/** Partition hashes second phase subprocess.  */
+private final DistributedProcess phase2PartsHashes;
+
+/** */
+public SnapshotCheckProcess(GridKernalContext kctx) {
+this.kctx = kctx;
+
+log = kctx.log(getClass());
+
+phase1CheckMetas = new DistributedProcess<>(kctx, 
SNAPSHOT_CHECK_METAS, this::prepareAndCheckMetas,
+this::reducePreparationAndMetasCheck);
+
+phase2PartsHashes = new DistributedProcess<>(kctx, 
SNAPSHOT_VALIDATE_PARTS, this::validateParts,
+this::reduceValidatePartsAndFinish);
+
+kctx.event().addLocalEventListener((evt) -> 
nodeLeft(((DiscoveryEvent)evt).eventNode()), EVT_NODE_FAILED, EVT_NODE_LEFT);
+}
+
+/** */
+Map requests() {
+return Collections.unmodifiableMap(requests);
+}
+
+/**
+ * Stops the process with the passed exception.
+ *
+ * @param th The interrupt reason.
+ * @param rqFilter If not {@code null}, used to filter which 
requests/process to stop. If {@code null}, stops all the validations.
+ */
+void interrupt(Throwable th, @Nullable 
Function rqFilter) {
+requests.values().forEach(rq -> {
+if (rqFilter == null || rqFilter.apply(rq)) {
+rq.error(th);
+
+clean(rq.requestId(), th, null, null);
+}
+});
+}
+
+/** Stops the related validation if the node is a mandatory one. */
+private v

Re: [PR] IGNITE-22662 : Snapshot check as distributed process [ignite]

2024-07-16 Thread via GitHub


Vladsz83 commented on code in PR #11391:
URL: https://github.com/apache/ignite/pull/11391#discussion_r1679406593


##
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotCheckProcess.java:
##
@@ -0,0 +1,549 @@
+/*
+ * 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.snapshot;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.management.cache.IdleVerifyResultV2;
+import org.apache.ignite.internal.management.cache.PartitionKeyV2;
+import 
org.apache.ignite.internal.processors.cache.verify.PartitionHashRecordV2;
+import org.apache.ignite.internal.util.distributed.DistributedProcess;
+import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
+import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_CHECK_METAS;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_VALIDATE_PARTS;
+
+/** Distributed process of snapshot checking (with the partition hashes). */
+public class SnapshotCheckProcess {
+/** */
+private final IgniteLogger log;
+
+/** */
+private final GridKernalContext kctx;
+
+/** Snapshot check requests per snapshot on every node. */
+private final Map requests = new 
ConcurrentHashMap<>();
+
+/** Cluster-wide operation futures per snapshot called from current node. 
*/
+private final Map> clusterOpFuts = new 
ConcurrentHashMap<>();
+
+/** Check metas first phase subprocess. */
+private final DistributedProcess phase1CheckMetas;
+
+/** Partition hashes second phase subprocess.  */
+private final DistributedProcess phase2PartsHashes;
+
+/** */
+public SnapshotCheckProcess(GridKernalContext kctx) {
+this.kctx = kctx;
+
+log = kctx.log(getClass());
+
+phase1CheckMetas = new DistributedProcess<>(kctx, 
SNAPSHOT_CHECK_METAS, this::prepareAndCheckMetas,
+this::reducePreparationAndMetasCheck);
+
+phase2PartsHashes = new DistributedProcess<>(kctx, 
SNAPSHOT_VALIDATE_PARTS, this::validateParts,
+this::reduceValidatePartsAndFinish);
+
+kctx.event().addLocalEventListener((evt) -> 
nodeLeft(((DiscoveryEvent)evt).eventNode()), EVT_NODE_FAILED, EVT_NODE_LEFT);
+}
+
+/** */
+Map requests() {
+return Collections.unmodifiableMap(requests);
+}
+
+/**
+ * Stops the process with the passed exception.
+ *
+ * @param th The interrupt reason.
+ * @param rqFilter If not {@code null}, used to filter which 
requests/process to stop. If {@code null}, stops all the validations.
+ */
+void interrupt(Throwable th, @Nullable 
Function rqFilter) {
+requests.values().forEach(rq -> {
+if (rqFilter == null || rqFilter.apply(rq)) {
+rq.error(th);
+
+clean(rq.requestId(), th, null, null);
+}
+});
+}
+
+/** Stops the related validation if the node is a mandatory one. */
+private v

Re: [PR] IGNITE-22662 : Snapshot check as distributed process [ignite]

2024-07-16 Thread via GitHub


Vladsz83 commented on code in PR #11391:
URL: https://github.com/apache/ignite/pull/11391#discussion_r1679400040


##
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotCheckProcess.java:
##
@@ -0,0 +1,549 @@
+/*
+ * 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.snapshot;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.management.cache.IdleVerifyResultV2;
+import org.apache.ignite.internal.management.cache.PartitionKeyV2;
+import 
org.apache.ignite.internal.processors.cache.verify.PartitionHashRecordV2;
+import org.apache.ignite.internal.util.distributed.DistributedProcess;
+import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
+import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_CHECK_METAS;
+import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.SNAPSHOT_VALIDATE_PARTS;
+
+/** Distributed process of snapshot checking (with the partition hashes). */
+public class SnapshotCheckProcess {
+/** */
+private final IgniteLogger log;
+
+/** */
+private final GridKernalContext kctx;
+
+/** Snapshot check requests per snapshot on every node. */
+private final Map requests = new 
ConcurrentHashMap<>();
+
+/** Cluster-wide operation futures per snapshot called from current node. 
*/
+private final Map> clusterOpFuts = new 
ConcurrentHashMap<>();
+
+/** Check metas first phase subprocess. */
+private final DistributedProcess phase1CheckMetas;
+
+/** Partition hashes second phase subprocess.  */
+private final DistributedProcess phase2PartsHashes;
+
+/** */
+public SnapshotCheckProcess(GridKernalContext kctx) {
+this.kctx = kctx;
+
+log = kctx.log(getClass());
+
+phase1CheckMetas = new DistributedProcess<>(kctx, 
SNAPSHOT_CHECK_METAS, this::prepareAndCheckMetas,
+this::reducePreparationAndMetasCheck);
+
+phase2PartsHashes = new DistributedProcess<>(kctx, 
SNAPSHOT_VALIDATE_PARTS, this::validateParts,
+this::reduceValidatePartsAndFinish);
+
+kctx.event().addLocalEventListener((evt) -> 
nodeLeft(((DiscoveryEvent)evt).eventNode()), EVT_NODE_FAILED, EVT_NODE_LEFT);
+}
+
+/** */
+Map requests() {
+return Collections.unmodifiableMap(requests);
+}
+
+/**
+ * Stops the process with the passed exception.
+ *
+ * @param th The interrupt reason.
+ * @param rqFilter If not {@code null}, used to filter which 
requests/process to stop. If {@code null}, stops all the validations.
+ */
+void interrupt(Throwable th, @Nullable 
Function rqFilter) {
+requests.values().forEach(rq -> {
+if (rqFilter == null || rqFilter.apply(rq)) {
+rq.error(th);
+
+clean(rq.requestId(), th, null, null);
+}
+});
+}
+
+/** Stops the related validation if the node is a mandatory one. */
+private v

Re: [PR] IGNITE-22581 Add planner test to verify numeric type coercion of source for INSERT, UPDATE and MERGE operators [ignite-3]

2024-07-16 Thread via GitHub


ygerzhedovich merged PR #4045:
URL: https://github.com/apache/ignite-3/pull/4045


-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22555 Fixed assertion in ReplicaStateManager.onPrimaryElected [ignite-3]

2024-07-16 Thread via GitHub


vldpyatkov commented on code in PR #4055:
URL: https://github.com/apache/ignite-3/pull/4055#discussion_r1679270132


##
modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/negotiation/LeaseAgreement.java:
##
@@ -158,4 +158,12 @@ public void checkValid(
 }
 }
 }
+
+void onResponse(LeaseGrantedMessageResponse response) {
+responseFut.complete(response);

Review Comment:
   This future should be created internally, because it is controlled by these 
new methods.
   I would use a private constructor to create UNDEFINED_AGREEMENT.



##
modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/negotiation/LeaseNegotiator.java:
##
@@ -120,12 +120,26 @@ public LeaseAgreement 
getAndRemoveIfReady(ReplicationGroupId groupId) {
 return res[0] == null ? UNDEFINED_AGREEMENT : res[0];
 }
 
+/**
+ * Creates an agreement.
+ *
+ * @param groupId Group id.
+ * @param lease Lease to negotiate.
+ */
+public void createAgreement(ReplicationGroupId groupId, Lease lease) {
+leaseToNegotiate.put(groupId, new LeaseAgreement(lease, new 
CompletableFuture<>()));

Review Comment:
   Use constructor without future as a parameter here.



##
modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/LeaseUpdater.java:
##
@@ -449,12 +460,16 @@ private void updateLeaseBatchInternal() {
 if (e != null) {
 LOG.error("Lease update invocation failed", e);
 
+cancelAgreements(toBeNegotiated.keySet());
+
 return;
 }
 
 if (!success) {
 LOG.debug("Lease update invocation failed");

Review Comment:
   Maybe we will log this as a warning because, in ordinary cases, it should 
pass.



-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22750 log node start errors in error logging level [ignite-3]

2024-07-16 Thread via GitHub


PakhomovAlexander merged PR #4093:
URL: https://github.com/apache/ignite-3/pull/4093


-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22710 Add exception translation to Transaction implementations [ignite-3]

2024-07-16 Thread via GitHub


sanpwc commented on code in PR #4070:
URL: https://github.com/apache/ignite-3/pull/4070#discussion_r1679245096


##
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/StaleTransactionOperationException.java:
##
@@ -21,10 +21,10 @@
 import static 
org.apache.ignite.lang.ErrorGroups.Transactions.TX_STALE_OPERATION_ERR;
 
 import java.util.UUID;
-import org.apache.ignite.tx.TransactionException;
+import org.apache.ignite.internal.tx.TransactionInternalException;
 
 /** Error that occurs when a stale operation of a completed transaction is 
detected. */
-public class StaleTransactionOperationException extends TransactionException {
+public class StaleTransactionOperationException extends 
TransactionInternalException {

Review Comment:
   Not sure about discussion within context of such changes. Anyway 
ignite-20415 it 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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22749 Mention ignite-json as dependency in the REST API module README.txt [ignite]

2024-07-16 Thread via GitHub


nizhikov merged PR #11439:
URL: https://github.com/apache/ignite/pull/11439


-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] IGNITE-22749 Mention ignite-json as dependency in the REST API module README.txt [ignite]

2024-07-16 Thread via GitHub


skorotkov opened a new pull request, #11439:
URL: https://github.com/apache/ignite/pull/11439

   Now it's not enogh to copy libs/optional/ignite-rest-http folder to libs to 
enable REST API.
   New ignite-json module should be copied as well.
   
   
   
   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
   - [X] There is a single JIRA ticket related to the pull request. 
   - [X] The web-link to the pull request is attached to the JIRA ticket.
   - [X] The JIRA ticket has the _Patch Available_ state.
   - [X] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [X] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE- Change summary` where 
`` - 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 d...@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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] IGNITE-22750 log node start errors in error logging level [ignite-3]

2024-07-16 Thread via GitHub


dant3 opened a new pull request, #4093:
URL: https://github.com/apache/ignite-3/pull/4093

   https://issues.apache.org/jira/browse/IGNITE-22750


-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22710 Add exception translation to Transaction implementations [ignite-3]

2024-07-16 Thread via GitHub


rpuch commented on code in PR #4070:
URL: https://github.com/apache/ignite-3/pull/4070#discussion_r1679146055


##
modules/core/src/main/java/org/apache/ignite/internal/lang/IgniteExceptionMapperUtil.java:
##
@@ -84,9 +85,29 @@ static void registerMapping(
  * @return Public exception.
  */
 public static Throwable mapToPublicException(Throwable origin) {
+return mapToPublicException(origin, ex -> new 
IgniteException(INTERNAL_ERR, ex));
+}
+
+/**
+ * This method provides a mapping from internal exception to Ignite public 
ones.
+ *
+ * The rules of mapping are the following:
+ * 
+ * any instance of {@link Error} is returned as is, except {@link 
AssertionError}
+ * that will always be mapped to {@link IgniteException} with the 
{@link Common#INTERNAL_ERR} error code.
+ * any instance of {@link IgniteException} or {@link 
IgniteCheckedException} is returned as is.

Review Comment:
   I filed an issue for this https://issues.apache.org/jira/browse/IGNITE-22748



-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22710 Add exception translation to Transaction implementations [ignite-3]

2024-07-16 Thread via GitHub


rpuch commented on code in PR #4070:
URL: https://github.com/apache/ignite-3/pull/4070#discussion_r1679139744


##
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/StaleTransactionOperationException.java:
##
@@ -21,10 +21,10 @@
 import static 
org.apache.ignite.lang.ErrorGroups.Transactions.TX_STALE_OPERATION_ERR;
 
 import java.util.UUID;
-import org.apache.ignite.tx.TransactionException;
+import org.apache.ignite.internal.tx.TransactionInternalException;
 
 /** Error that occurs when a stale operation of a completed transaction is 
detected. */
-public class StaleTransactionOperationException extends TransactionException {
+public class StaleTransactionOperationException extends 
TransactionInternalException {

Review Comment:
   To change public API, we need some discussion. I was planning to do it in 
IGNITE-20415. I added a TODO for now.



-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] IGNITE-22585 [ignite-3]

2024-07-16 Thread via GitHub


xtern opened a new pull request, #4092:
URL: https://github.com/apache/ignite-3/pull/4092

   https://issues.apache.org/jira/browse/IGNITE-22585


-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] IGNITE-22152 WIP [ignite-3]

2024-07-16 Thread via GitHub


Pochatkin opened a new pull request, #4091:
URL: https://github.com/apache/ignite-3/pull/4091

   https://issues.apache.org/jira/browse/IGNITE-22152


-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22619 Add `InternalTable#estimatedSize` method [ignite-3]

2024-07-16 Thread via GitHub


sashapolo merged PR #4065:
URL: https://github.com/apache/ignite-3/pull/4065


-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] [WIP] IGNITE-22732 Transaction aware SQL [ignite]

2024-07-16 Thread via GitHub


nizhikov opened a new pull request, #11438:
URL: https://github.com/apache/ignite/pull/11438

   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- Change summary` where 
`` - 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 d...@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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22619 Add `InternalTable#estimatedSize` method [ignite-3]

2024-07-16 Thread via GitHub


sashapolo commented on code in PR #4065:
URL: https://github.com/apache/ignite-3/pull/4065#discussion_r1678944946


##
modules/table/src/test/java/org/apache/ignite/internal/table/distributed/storage/InternalTableEstimatedSizeTest.java:
##
@@ -0,0 +1,471 @@
+/*
+ * 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.table.distributed.storage;
+
+import static java.util.concurrent.CompletableFuture.completedFuture;
+import static java.util.concurrent.CompletableFuture.failedFuture;
+import static java.util.stream.Collectors.toList;
+import static 
org.apache.ignite.internal.network.utils.ClusterServiceTestUtils.clusterService;
+import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.testNodeName;
+import static 
org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willBe;
+import static 
org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
+import static 
org.apache.ignite.internal.util.CompletableFutures.nullCompletedFuture;
+import static org.apache.ignite.internal.util.IgniteUtils.startAsync;
+import static org.apache.ignite.internal.util.IgniteUtils.stopAsync;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.lenient;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ForkJoinPool;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.TimeoutException;
+import java.util.stream.IntStream;
+import org.apache.ignite.internal.catalog.CatalogService;
+import 
org.apache.ignite.internal.configuration.testframework.ConfigurationExtension;
+import 
org.apache.ignite.internal.configuration.testframework.InjectConfiguration;
+import org.apache.ignite.internal.hlc.ClockService;
+import org.apache.ignite.internal.hlc.ClockServiceImpl;
+import org.apache.ignite.internal.hlc.ClockWaiter;
+import org.apache.ignite.internal.hlc.HybridClockImpl;
+import org.apache.ignite.internal.hlc.HybridTimestamp;
+import org.apache.ignite.internal.manager.ComponentContext;
+import org.apache.ignite.internal.manager.IgniteComponent;
+import org.apache.ignite.internal.metastorage.MetaStorageManager;
+import 
org.apache.ignite.internal.metastorage.impl.StandaloneMetaStorageManager;
+import 
org.apache.ignite.internal.metastorage.server.SimpleInMemoryKeyValueStorage;
+import org.apache.ignite.internal.network.ClusterNodeResolver;
+import org.apache.ignite.internal.network.ClusterService;
+import org.apache.ignite.internal.network.MessagingService;
+import org.apache.ignite.internal.network.StaticNodeFinder;
+import org.apache.ignite.internal.placementdriver.PlacementDriver;
+import org.apache.ignite.internal.placementdriver.leases.Lease;
+import org.apache.ignite.internal.raft.Command;
+import org.apache.ignite.internal.raft.service.RaftCommandRunner;
+import org.apache.ignite.internal.replicator.ReplicaService;
+import org.apache.ignite.internal.replicator.TablePartitionId;
+import 
org.apache.ignite.internal.replicator.configuration.ReplicationConfiguration;
+import org.apache.ignite.internal.replicator.message.ReplicaMessagesFactory;
+import org.apache.ignite.internal.replicator.message.ReplicaRequest;
+import org.apache.ignite.internal.schema.SchemaRegistry;
+import org.apache.ignite.internal.storage.MvPartitionStorage;
+import org.apache.ignite.internal.storage.engine.MvTableStorage;
+import org.apache.ignite.internal.table.InternalTable;
+import org.apache.ignite.internal.table.distributed.StorageUpdateHandler;
+import org.apache.ignite.internal.table.distributed.index.IndexMetaStorage;
+import 
org.apache.i

Re: [PR] IGNITE-22619 Add `InternalTable#estimatedSize` method [ignite-3]

2024-07-16 Thread via GitHub


sashapolo commented on code in PR #4065:
URL: https://github.com/apache/ignite-3/pull/4065#discussion_r1678933616


##
modules/table/build.gradle:
##
@@ -64,6 +64,7 @@ dependencies {
 testImplementation project(':ignite-page-memory')
 testImplementation project(':ignite-storage-rocksdb')
 testImplementation project(':ignite-placement-driver-api')
+testImplementation project(':ignite-placement-driver')

Review Comment:
   Because I need the `Lease` class



-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22734 update jetty [ignite]

2024-07-16 Thread via GitHub


petrov-mg merged PR #11436:
URL: https://github.com/apache/ignite/pull/11436


-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22731 update zookeeper [ignite]

2024-07-16 Thread via GitHub


petrov-mg merged PR #11435:
URL: https://github.com/apache/ignite/pull/11435


-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22710 Add exception translation to Transaction implementations [ignite-3]

2024-07-16 Thread via GitHub


rpuch commented on code in PR #4070:
URL: https://github.com/apache/ignite-3/pull/4070#discussion_r1678921638


##
modules/transactions/src/main/java/org/apache/ignite/internal/tx/MismatchingTransactionOutcomeException.java:
##
@@ -19,15 +19,13 @@
 
 import static 
org.apache.ignite.lang.ErrorGroups.Transactions.TX_UNEXPECTED_STATE_ERR;
 
-import org.apache.ignite.tx.TransactionException;
-
 /**
  * The exception is thrown when the transaction result differs from the 
intended one.
  *
  * For example, {@code tx.commit()} is called for a transaction, but the 
verification logic decided to abort it instead. The transaction
  * will be finished with {@link TxState#ABORTED} and the call to {@code 
tx.commit()} will throw this exception.
  */
-public class MismatchingTransactionOutcomeException extends 
TransactionException {
+public class MismatchingTransactionOutcomeException extends 
TransactionInternalException {

Review Comment:
   Please take a look at 
https://github.com/apache/ignite-3/pull/4070#discussion_r1678848166



-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22710 Add exception translation to Transaction implementations [ignite-3]

2024-07-16 Thread via GitHub


rpuch commented on code in PR #4070:
URL: https://github.com/apache/ignite-3/pull/4070#discussion_r1678919212


##
modules/core/src/main/java/org/apache/ignite/internal/lang/IgniteExceptionMapperUtil.java:
##
@@ -84,9 +85,29 @@ static void registerMapping(
  * @return Public exception.
  */
 public static Throwable mapToPublicException(Throwable origin) {
+return mapToPublicException(origin, ex -> new 
IgniteException(INTERNAL_ERR, ex));
+}
+
+/**
+ * This method provides a mapping from internal exception to Ignite public 
ones.
+ *
+ * The rules of mapping are the following:
+ * 
+ * any instance of {@link Error} is returned as is, except {@link 
AssertionError}
+ * that will always be mapped to {@link IgniteException} with the 
{@link Common#INTERNAL_ERR} error code.
+ * any instance of {@link IgniteException} or {@link 
IgniteCheckedException} is returned as is.

Review Comment:
   I think that the fact that our exceptions extend public 'root' exceptions, 
but get placed in internal packages, should be fixed, but not in this PR.



-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22710 Add exception translation to Transaction implementations [ignite-3]

2024-07-16 Thread via GitHub


rpuch commented on code in PR #4070:
URL: https://github.com/apache/ignite-3/pull/4070#discussion_r1678915962


##
modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItDurableFinishTest.java:
##
@@ -310,7 +310,7 @@ void testCommitAlreadyAbortedTx() throws 
ExecutionException, InterruptedExceptio
 
 Throwable cause = 
ExceptionUtils.unwrapCause(transactionException.getCause());
 
-assertInstanceOf(MismatchingTransactionOutcomeException.class, cause);
+assertInstanceOf(MismatchingTransactionOutcomeException.class, 
cause.getCause());

Review Comment:
   It cannot be public as it brings some internal state. I was going to add 
some kind of a public counterpart for it, like `RollbackException`, in 
IGNITE-20415 (which is the root cause for the current issue)



-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22710 Add exception translation to Transaction implementations [ignite-3]

2024-07-16 Thread via GitHub


sanpwc commented on code in PR #4070:
URL: https://github.com/apache/ignite-3/pull/4070#discussion_r1678886098


##
modules/core/src/main/java/org/apache/ignite/internal/lang/IgniteExceptionMapperUtil.java:
##
@@ -115,7 +134,20 @@ public static Throwable mapToPublicException(Throwable 
origin) {
 }
 
 // There are no exception mappings for the given exception. This case 
should be considered as internal error.
-return new IgniteException(INTERNAL_ERR, origin);
+return mapCheckingResultIsPublic(origin, unknownProblemMapper);
+}
+
+private static Throwable mapCheckingResultIsPublic(Throwable origin, 
Function unknownProblemMapper) {
+Throwable result = unknownProblemMapper.apply(origin);
+
+checkResultIsPublic(result, origin);
+
+return result;
+}
+
+private static void checkResultIsPublic(Throwable mappingResult, Throwable 
origin) {
+assert mappingResult instanceof IgniteException || mappingResult 
instanceof IgniteCheckedException :

Review Comment:
   I'd also add an assertion that mappingResult is not part of an internal 
package.



-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22710 Add exception translation to Transaction implementations [ignite-3]

2024-07-16 Thread via GitHub


sanpwc commented on code in PR #4070:
URL: https://github.com/apache/ignite-3/pull/4070#discussion_r1678854238


##
modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItTransactionRecoveryTest.java:
##
@@ -789,7 +791,8 @@ public void 
testPrimaryFailureWhileInflightInProgressAfterFirstResponse() throws
 
 cancelLease(commitPartNode, tblReplicationGrp);
 
-assertThat(commitFut, 
willThrow(MismatchingTransactionOutcomeException.class, 30, SECONDS));
+TransactionException txEx = assertWillThrow(commitFut, 
TransactionException.class, 30, SECONDS);
+assertThat(txEx.getCause(), 
instanceOf(MismatchingTransactionOutcomeException.class));

Review Comment:
   Same as above. MismatchingTransactionOutcomeException is a 
TransactionException itself. There's no need to wrap it with any other 
TransactionException. We may however move 
MismatchingTransactionOutcomeException to public API. Same for 
IncompatibleSchemaException etc.
   
   Seems that the problem is deeper.
   
   > How that should work. Almost all our exceptions extend either 
IgniteExpception or IgniteCheckedException but placed in internal packages.



-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22710 Add exception translation to Transaction implementations [ignite-3]

2024-07-16 Thread via GitHub


sanpwc commented on code in PR #4070:
URL: https://github.com/apache/ignite-3/pull/4070#discussion_r1678848166


##
modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItDurableFinishTest.java:
##
@@ -310,7 +310,7 @@ void testCommitAlreadyAbortedTx() throws 
ExecutionException, InterruptedExceptio
 
 Throwable cause = 
ExceptionUtils.unwrapCause(transactionException.getCause());
 
-assertInstanceOf(MismatchingTransactionOutcomeException.class, cause);
+assertInstanceOf(MismatchingTransactionOutcomeException.class, 
cause.getCause());

Review Comment:
   That's confusing. I'd expect MismatchingTransactionOutcomeException to be 
public one.



-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] IGNITE-22710 Add exception translation to Transaction implementations [ignite-3]

2024-07-16 Thread via GitHub


sanpwc commented on code in PR #4070:
URL: https://github.com/apache/ignite-3/pull/4070#discussion_r1678830382


##
modules/core/src/test/java/org/apache/ignite/internal/lang/ExceptionUtilsTest.java:
##
@@ -90,6 +94,28 @@ private static Stream 
provideIgniteCheckedExceptions() {
 );
 }
 
+@Test
+void withCauseDoesNotApplyDefaultCodeWhenCodeIsThere() {

Review Comment:
   Could you please add few more tests in order to verify that coded exceptions 
wrapped with  `ExecutionException`, `CompletionException` and 
`CancellationException` will also preserve original code. BTW I believe that it 
won't work for `CancellationException`.



##
modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItDurableFinishTest.java:
##
@@ -310,7 +310,7 @@ void testCommitAlreadyAbortedTx() throws 
ExecutionException, InterruptedExceptio
 
 Throwable cause = 
ExceptionUtils.unwrapCause(transactionException.getCause());
 
-assertInstanceOf(MismatchingTransactionOutcomeException.class, cause);
+assertInstanceOf(MismatchingTransactionOutcomeException.class, 
cause.getCause());

Review Comment:
   That's confusing. What's the cause?
   
   Seems that the problem is deeper.
   
   > How that should work. Almost all our exceptions extend either 
IgniteExpception or IgniteCheckedException but placed in internal packages.



##
modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItTransactionRecoveryTest.java:
##
@@ -789,7 +791,8 @@ public void 
testPrimaryFailureWhileInflightInProgressAfterFirstResponse() throws
 
 cancelLease(commitPartNode, tblReplicationGrp);
 
-assertThat(commitFut, 
willThrow(MismatchingTransactionOutcomeException.class, 30, SECONDS));
+TransactionException txEx = assertWillThrow(commitFut, 
TransactionException.class, 30, SECONDS);
+assertThat(txEx.getCause(), 
instanceOf(MismatchingTransactionOutcomeException.class));

Review Comment:
   Same as above. MismatchingTransactionOutcomeException is a 
TransactionException itself. There's no need to wrap it with any other 
TransactionException. We may however move 
MismatchingTransactionOutcomeException to public API. Same for 
IncompatibleSchemaException etc.
   
   Seems that the problem is deeper.
   
   > How that should work. Almost all our exceptions extend either 
IgniteExpception or IgniteCheckedException but placed in internal packages.



##
modules/core/src/main/java/org/apache/ignite/internal/lang/IgniteExceptionMapperUtil.java:
##
@@ -84,9 +85,29 @@ static void registerMapping(
  * @return Public exception.
  */
 public static Throwable mapToPublicException(Throwable origin) {
+return mapToPublicException(origin, ex -> new 
IgniteException(INTERNAL_ERR, ex));
+}
+
+/**
+ * This method provides a mapping from internal exception to Ignite public 
ones.
+ *
+ * The rules of mapping are the following:
+ * 
+ * any instance of {@link Error} is returned as is, except {@link 
AssertionError}
+ * that will always be mapped to {@link IgniteException} with the 
{@link Common#INTERNAL_ERR} error code.
+ * any instance of {@link IgniteException} or {@link 
IgniteCheckedException} is returned as is.

Review Comment:
   How that should work. Almost all our exceptions extend either 
IgniteExpception or IgniteCheckedException but placed in internal packages.



##
modules/transactions/src/main/java/org/apache/ignite/internal/tx/MismatchingTransactionOutcomeException.java:
##
@@ -19,15 +19,13 @@
 
 import static 
org.apache.ignite.lang.ErrorGroups.Transactions.TX_UNEXPECTED_STATE_ERR;
 
-import org.apache.ignite.tx.TransactionException;
-
 /**
  * The exception is thrown when the transaction result differs from the 
intended one.
  *
  * For example, {@code tx.commit()} is called for a transaction, but the 
verification logic decided to abort it instead. The transaction
  * will be finished with {@link TxState#ABORTED} and the call to {@code 
tx.commit()} will throw this exception.
  */
-public class MismatchingTransactionOutcomeException extends 
TransactionException {
+public class MismatchingTransactionOutcomeException extends 
TransactionInternalException {

Review Comment:
   Semantically it's not internal.



##
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/StaleTransactionOperationException.java:
##
@@ -21,10 +21,10 @@
 import static 
org.apache.ignite.lang.ErrorGroups.Transactions.TX_STALE_OPERATION_ERR;
 
 import java.util.UUID;
-import org.apache.ignite.tx.TransactionException;
+import org.apache.ignite.internal.tx.TransactionInternalException;
 
 /** Error that occurs when a stale operation of a completed transaction is 
detected. */
-public class StaleTransactionOperationException extends TransactionException {
+public class StaleTransactionOperat