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


##########
modules/storage-api/src/main/java/org/apache/ignite/internal/storage/CommitResultStatus.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.storage;
+
+/** Status of result {@link MvPartitionStorage#commitWrite commit} of write 
intent. */
+public enum CommitResultStatus {
+    /** Successful commit of write intent. */
+    SUCCESS,
+
+    /** Failed to commit write intent because it is not in the version chain. 
*/
+    NO_WRITE_INTENT,
+
+    /** Failed to commit write intent because transaction that added it does 
not match transaction that try commits it. */
+    MISMATCH_TX;

Review Comment:
   Same rename suggestion as with `AbortResultStatus`



##########
modules/storage-api/src/main/java/org/apache/ignite/internal/storage/AbortResultStatus.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.storage;
+
+/** Description will be here soon. */

Review Comment:
   When? :)



##########
modules/storage-api/src/main/java/org/apache/ignite/internal/storage/AbortResult.java:
##########
@@ -0,0 +1,86 @@
+/*
+ * 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.storage;
+
+import java.util.UUID;
+import org.apache.ignite.internal.schema.BinaryRow;
+import org.apache.ignite.internal.tostring.S;
+import org.jetbrains.annotations.Nullable;
+
+/** Result of {@link MvPartitionStorage#abortWrite abort} of write intent. */
+public class AbortResult {
+    private static final AbortResult NO_WRITE_INTENT_ABORT_RESULT = new 
AbortResult(AbortResultStatus.NO_WRITE_INTENT, null, null);
+
+    private final AbortResultStatus status;
+
+    private final @Nullable UUID expectedTxId;
+
+    private final @Nullable BinaryRow previousUncommittedRowVersion;

Review Comment:
   Can it be called `previousWriteIntent`? I mean is 'write intent' a synonym 
to 'uncommitted row version'? If yes, we probably should not use both synonyms 
in the same context. If they are different things, how are they different?



##########
modules/storage-api/src/main/java/org/apache/ignite/internal/storage/AbortResultStatus.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.storage;
+
+/** Description will be here soon. */
+public enum AbortResultStatus {
+    /** Successful abort of write intent. */
+    SUCCESS,
+
+    /** Failed to abort write intent because it is not in version chain. */
+    NO_WRITE_INTENT,
+
+    /** Failed to abort write intent because transaction that added it does 
not match transaction that try aborts it. */

Review Comment:
   ```suggestion
       /** Failed to abort write intent because transaction that added it does 
not match transaction that tries to abort it. */
   ```



##########
modules/storage-api/src/main/java/org/apache/ignite/internal/storage/AbortResultStatus.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.storage;
+
+/** Description will be here soon. */
+public enum AbortResultStatus {
+    /** Successful abort of write intent. */
+    SUCCESS,
+
+    /** Failed to abort write intent because it is not in version chain. */
+    NO_WRITE_INTENT,
+
+    /** Failed to abort write intent because transaction that added it does 
not match transaction that try aborts it. */
+    MISMATCH_TX;

Review Comment:
   How about `TX_MISMATCH` or `MISMATCHING_TX`? Current `MISMATCH_TX` sounds a 
bit weird from the point of view of English



##########
modules/storage-api/src/main/java/org/apache/ignite/internal/storage/AbortResult.java:
##########
@@ -0,0 +1,86 @@
+/*
+ * 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.storage;
+
+import java.util.UUID;
+import org.apache.ignite.internal.schema.BinaryRow;
+import org.apache.ignite.internal.tostring.S;
+import org.jetbrains.annotations.Nullable;
+
+/** Result of {@link MvPartitionStorage#abortWrite abort} of write intent. */
+public class AbortResult {
+    private static final AbortResult NO_WRITE_INTENT_ABORT_RESULT = new 
AbortResult(AbortResultStatus.NO_WRITE_INTENT, null, null);
+
+    private final AbortResultStatus status;
+
+    private final @Nullable UUID expectedTxId;
+
+    private final @Nullable BinaryRow previousUncommittedRowVersion;
+
+    /** Constructor. */
+    private AbortResult(AbortResultStatus status, @Nullable UUID expectedTxId, 
@Nullable BinaryRow previousUncommittedRowVersion) {
+        this.status = status;
+        this.expectedTxId = expectedTxId;
+        this.previousUncommittedRowVersion = previousUncommittedRowVersion;
+    }
+
+    /** Returns the abort status of a write intent. */
+    public AbortResultStatus status() {
+        return status;
+    }
+
+    /**
+     * Returns the transaction ID expected to abort the write intent. 
Transaction that added the write intent is expected to abort it.
+     * Not {@code null} only for {@link AbortResultStatus#MISMATCH_TX}.
+     */
+    public @Nullable UUID expectedTxId() {
+        return expectedTxId;
+    }
+
+    /** Returns result of a successful abort of the write intent. */
+    public static AbortResult success(@Nullable BinaryRow 
previousUncommittedRowVersion) {
+        return new AbortResult(AbortResultStatus.SUCCESS, null, 
previousUncommittedRowVersion);
+    }
+
+    /**
+     * Returns previous uncommitted row version. Not {@code null} for {@link 
AbortResultStatus#SUCCESS} and if the previous version is not
+     * a tombstone.
+     */
+    public @Nullable BinaryRow previousUncommittedRowVersion() {
+        return previousUncommittedRowVersion;
+    }
+
+    /** Returns the result if there is no write intent when attempting to 
abort it. */
+    public static AbortResult noWriteIntent() {
+        return NO_WRITE_INTENT_ABORT_RESULT;
+    }
+
+    /**
+     * Returns the result of a failed attempt to abort a write intent by a 
transaction that did not add it.
+     *
+     * @see #expectedTxId()
+     */
+    public static AbortResult mismatchTx(UUID expectedTxId) {

Review Comment:
   How about grouping all static factories together and putting them before 
non-static methods (maybe even before the constructor)?



-- 
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

Reply via email to