You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/08/05 12:57:47 UTC

[GitHub] [ignite-3] SammyVimes commented on a change in pull request #254: IGNITE-14790 Persistent partition storage

SammyVimes commented on a change in pull request #254:
URL: https://github.com/apache/ignite-3/pull/254#discussion_r683427268



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/PartitionListener.java
##########
@@ -281,79 +305,40 @@ else if (clo.command() instanceof GetAndUpsertCommand) {
 
     /** {@inheritDoc} */
     @Override public void onShutdown() {
-        // No-op.
-    }
-
-    /**
-     * Wrapper provides correct byte[] comparison.
-     */
-    private static class KeyWrapper {
-        /** Data. */
-        private final byte[] data;
-
-        /** Hash. */
-        private final int hash;
-
-        /**
-         * Constructor.
-         *
-         * @param data Wrapped data.
-         */
-        KeyWrapper(byte[] data, int hash) {
-            assert data != null;
-
-            this.data = data;
-            this.hash = hash;
+        try {
+            storage.close();
         }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-
-            if (o == null || getClass() != o.getClass())
-                return false;
-
-            KeyWrapper wrapper = (KeyWrapper)o;
-            return Arrays.equals(data, wrapper.data);
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return hash;
+        catch (Exception e) {
+            throw new IgniteInternalException("Failed to close storage: " + e.getMessage(), e);
         }
     }
 
     /**
-     * Compares two rows.
+     * Extracts a key and a value from the {@link BinaryRow} and wraps it in a {@link DataRow}.
      *
-     * @param row Row to compare.
-     * @param row2 Row to compare.
-     * @return True if these rows is equivalent, false otherwise.
+     * @param row Binary row.
+     * @return Data row.
      */
-    private boolean equalValues(BinaryRow row, BinaryRow row2) {
-        if (row == row2)
-            return true;
-
-        if (row == null || row2 == null)
-            return false;
+    @NotNull private DataRow extractAndWrapKeyValue(@NotNull BinaryRow row) {
+        byte[] key = new byte[row.keySlice().capacity()];
+        row.keySlice().get(key);
 
-        if (row.hasValue() ^ row2.hasValue())
-            return false;
+        byte[] value = new byte[row.keySlice().capacity()];

Review comment:
       This shouldn't be at all :\




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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