You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sk...@apache.org on 2022/06/14 16:49:09 UTC

[ignite] branch master updated: IGNITE-17150 Reserved new WAL type for encrypted OUT_OF_ORDER_UPDATE record

This is an automated email from the ASF dual-hosted git repository.

sk0x50 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 48d756a7f69 IGNITE-17150 Reserved new WAL type for encrypted OUT_OF_ORDER_UPDATE record
48d756a7f69 is described below

commit 48d756a7f69e770b1c2664d33b1ed520c7995e81
Author: Slava Koptilin <sl...@gmail.com>
AuthorDate: Tue Jun 14 19:48:49 2022 +0300

    IGNITE-17150 Reserved new WAL type for encrypted OUT_OF_ORDER_UPDATE record
---
 .../internal/pagemem/wal/record/WALRecord.java     |   7 +-
 .../testframework/wal/record/RecordUtils.java      | 117 +++++----------------
 2 files changed, 32 insertions(+), 92 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
index f3f9f2cac10..fe3f1965478 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
@@ -238,7 +238,7 @@ public abstract class WALRecord {
         /** Record that indicates that "corrupted" flag should be removed from tracking page. */
         TRACKING_PAGE_REPAIR_DELTA(61, PHYSICAL),
 
-        /** Atomic out-of-order update. */
+        /** Out-of-order update which is used by atomic caches on backup nodes. (Placeholder) */
         OUT_OF_ORDER_UPDATE(62, LOGICAL),
 
         /** Encrypted WAL-record. */
@@ -276,7 +276,10 @@ public abstract class WALRecord {
         INDEX_ROOT_PAGE_RENAME_RECORD(72, LOGICAL),
 
         /** Partition clearing start. */
-        PARTITION_CLEARING_START_RECORD(73, LOGICAL);
+        PARTITION_CLEARING_START_RECORD(73, LOGICAL),
+
+        /** Ecnrypted out-of-order update which is used by atomic caches on backup nodes. (Placeholder) */
+        ENCRYPTED_OUT_OF_ORDER_UPDATE(74, LOGICAL);
 
         /** Index for serialization. Should be consistent throughout all versions. */
         private final int idx;
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/wal/record/RecordUtils.java b/modules/core/src/test/java/org/apache/ignite/testframework/wal/record/RecordUtils.java
index 4e10182e9b2..92311a5d103 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/wal/record/RecordUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/wal/record/RecordUtils.java
@@ -119,6 +119,7 @@ import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType
 import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType.ENCRYPTED_DATA_RECORD;
 import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType.ENCRYPTED_DATA_RECORD_V2;
 import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType.ENCRYPTED_DATA_RECORD_V3;
+import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType.ENCRYPTED_OUT_OF_ORDER_UPDATE;
 import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType.ENCRYPTED_RECORD;
 import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType.ENCRYPTED_RECORD_V2;
 import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType.EXCHANGE;
@@ -183,7 +184,7 @@ public class RecordUtils {
         put(DATA_RECORD, RecordUtils::buildDataRecord);
         put(DATA_RECORD_V2, RecordUtils::buildDataRecord);
         put(CHECKPOINT_RECORD, RecordUtils::buildCheckpointRecord);
-        put(HEADER_RECORD, RecordUtils::buildHeaderRecord);
+        put(HEADER_RECORD, buildUpsupportedWalRecord(HEADER_RECORD));
         put(INIT_NEW_PAGE_RECORD, RecordUtils::buildInitNewPageRecord);
         put(DATA_PAGE_INSERT_RECORD, RecordUtils::buildDataPageInsertRecord);
         put(DATA_PAGE_INSERT_FRAGMENT_RECORD, RecordUtils::buildDataPageInsertFragmentRecord);
@@ -199,11 +200,11 @@ public class RecordUtils {
         put(BTREE_FIX_COUNT, RecordUtils::buildFixCountRecord);
         put(BTREE_PAGE_REPLACE, RecordUtils::buildReplaceRecord);
         put(BTREE_PAGE_REMOVE, RecordUtils::buildRemoveRecord);
-        put(BTREE_PAGE_INNER_REPLACE, RecordUtils::buildBtreeInnerReplace);
+        put(BTREE_PAGE_INNER_REPLACE, buildUpsupportedWalRecord(BTREE_PAGE_INNER_REPLACE));
         put(BTREE_FIX_REMOVE_ID, RecordUtils::buildFixRemoveId);
-        put(BTREE_FORWARD_PAGE_SPLIT, RecordUtils::buildBtreeForwardPageSplit);
+        put(BTREE_FORWARD_PAGE_SPLIT, buildUpsupportedWalRecord(BTREE_FORWARD_PAGE_SPLIT));
         put(BTREE_EXISTING_PAGE_SPLIT, RecordUtils::buildSplitExistingPageRecord);
-        put(BTREE_PAGE_MERGE, RecordUtils::buildBtreeMergeRecord);
+        put(BTREE_PAGE_MERGE, buildUpsupportedWalRecord(BTREE_PAGE_MERGE));
         put(PAGES_LIST_SET_NEXT, RecordUtils::buildPagesListSetNextRecord);
         put(PAGES_LIST_SET_PREVIOUS, RecordUtils::buildPagesListSetPreviousRecord);
         put(PAGES_LIST_INIT_NEW_PAGE, RecordUtils::buildPagesListInitNewPageRecord);
@@ -228,30 +229,31 @@ public class RecordUtils {
         put(SNAPSHOT, RecordUtils::buildSnapshotRecord);
         put(METASTORE_DATA_RECORD, RecordUtils::buildMetastoreDataRecord);
         put(EXCHANGE, RecordUtils::buildExchangeRecord);
-        put(RESERVED, RecordUtils::buildReservedRecord);
+        put(RESERVED, buildUpsupportedWalRecord(RESERVED));
         put(ROLLBACK_TX_RECORD, RecordUtils::buildRollbackRecord);
         put(PARTITION_META_PAGE_UPDATE_COUNTERS_V2, RecordUtils::buildMetaPageUpdatePartitionDataRecordV2);
         put(PARTITION_META_PAGE_DELTA_RECORD_V3, RecordUtils::buildMetaPageUpdatePartitionDataRecordV3);
-        put(PARTITION_META_PAGE_DELTA_RECORD_V4, RecordUtils::buildMetaPageUpdatePartitionDataRecordV4);
-        put(MASTER_KEY_CHANGE_RECORD, RecordUtils::buildMasterKeyChangeRecord);
+        put(PARTITION_META_PAGE_DELTA_RECORD_V4, buildUpsupportedWalRecord(PARTITION_META_PAGE_DELTA_RECORD_V4));
+        put(MASTER_KEY_CHANGE_RECORD, buildUpsupportedWalRecord(MASTER_KEY_CHANGE_RECORD));
         put(MASTER_KEY_CHANGE_RECORD_V2, RecordUtils::buildMasterKeyChangeRecordV2);
         put(REENCRYPTION_START_RECORD, RecordUtils::buildEncryptionStatusRecord);
         put(ROTATED_ID_PART_RECORD, RecordUtils::buildRotatedIdPartRecord);
         put(MVCC_DATA_PAGE_MARK_UPDATED_RECORD, RecordUtils::buildDataPageMvccMarkUpdatedRecord);
         put(MVCC_DATA_PAGE_TX_STATE_HINT_UPDATED_RECORD, RecordUtils::buildDataPageMvccUpdateTxStateHintRecord);
         put(MVCC_DATA_PAGE_NEW_TX_STATE_HINT_UPDATED_RECORD, RecordUtils::buildDataPageMvccUpdateNewTxStateHintRecord);
-        put(ENCRYPTED_RECORD, RecordUtils::buildEncryptedRecord);
-        put(ENCRYPTED_DATA_RECORD, RecordUtils::buildEncryptedDataRecord);
-        put(ENCRYPTED_RECORD_V2, RecordUtils::buildEncryptedRecordV2);
-        put(ENCRYPTED_DATA_RECORD_V2, RecordUtils::buildEncryptedDataRecordV2);
-        put(ENCRYPTED_DATA_RECORD_V3, RecordUtils::buildEncryptedDataRecordV3);
+        put(ENCRYPTED_RECORD, buildUpsupportedWalRecord(ENCRYPTED_RECORD));
+        put(ENCRYPTED_DATA_RECORD, buildUpsupportedWalRecord(ENCRYPTED_DATA_RECORD));
+        put(ENCRYPTED_RECORD_V2, buildUpsupportedWalRecord(ENCRYPTED_RECORD_V2));
+        put(ENCRYPTED_DATA_RECORD_V2, buildUpsupportedWalRecord(ENCRYPTED_DATA_RECORD_V2));
+        put(ENCRYPTED_DATA_RECORD_V3, buildUpsupportedWalRecord(ENCRYPTED_DATA_RECORD_V3));
         put(MVCC_DATA_RECORD, RecordUtils::buildMvccDataRecord);
         put(MVCC_TX_RECORD, RecordUtils::buildMvccTxRecord);
-        put(CONSISTENT_CUT, RecordUtils::buildConsistentCutRecord);
-        put(BTREE_META_PAGE_INIT_ROOT_V3, RecordUtils::buildBtreeMetaPageInitRootV3);
-        put(OUT_OF_ORDER_UPDATE, RecordUtils::buildOutOfOrderRecord);
+        put(CONSISTENT_CUT, buildUpsupportedWalRecord(CONSISTENT_CUT));
+        put(BTREE_META_PAGE_INIT_ROOT_V3, buildUpsupportedWalRecord(BTREE_META_PAGE_INIT_ROOT_V3));
+        put(OUT_OF_ORDER_UPDATE, buildUpsupportedWalRecord(OUT_OF_ORDER_UPDATE));
         put(INDEX_ROOT_PAGE_RENAME_RECORD, RecordUtils::buildIndexRenameRootPageRecord);
         put(PARTITION_CLEARING_START_RECORD, RecordUtils::buildPartitionClearingStartedRecord);
+        put(ENCRYPTED_OUT_OF_ORDER_UPDATE, buildUpsupportedWalRecord(ENCRYPTED_OUT_OF_ORDER_UPDATE));
     }
 
     /** */
@@ -296,11 +298,6 @@ public class RecordUtils {
         return record;
     }
 
-    /** **/
-    public static UnsupportedWalRecord buildHeaderRecord() {
-        return new UnsupportedWalRecord(HEADER_RECORD);
-    }
-
     /** **/
     public static InitNewPageRecord buildInitNewPageRecord() {
         return new InitNewPageRecord(1, 1L, 1, 1, 1L);
@@ -390,31 +387,16 @@ public class RecordUtils {
         return new RemoveRecord(1, 1, 1, 1);
     }
 
-    /** **/
-    public static UnsupportedWalRecord buildBtreeInnerReplace() {
-        return new UnsupportedWalRecord(BTREE_PAGE_INNER_REPLACE);
-    }
-
     /** **/
     public static FixRemoveId buildFixRemoveId() {
         return new FixRemoveId(1, 1, 1);
     }
 
-    /** **/
-    public static UnsupportedWalRecord buildBtreeForwardPageSplit() {
-        return new UnsupportedWalRecord(BTREE_FORWARD_PAGE_SPLIT);
-    }
-
     /** **/
     public static SplitExistingPageRecord buildSplitExistingPageRecord() {
         return new SplitExistingPageRecord(1, 1, 1, 1);
     }
 
-    /** **/
-    public static UnsupportedWalRecord buildBtreeMergeRecord() {
-        return new UnsupportedWalRecord(BTREE_PAGE_MERGE);
-    }
-
     /** **/
     public static PagesListSetNextRecord buildPagesListSetNextRecord() {
         return new PagesListSetNextRecord(1, 1, 1);
@@ -539,11 +521,6 @@ public class RecordUtils {
         return new ExchangeRecord((short)1, ExchangeRecord.Type.LEFT, 1);
     }
 
-    /** **/
-    public static UnsupportedWalRecord buildReservedRecord() {
-        return new UnsupportedWalRecord(RESERVED);
-    }
-
     /** **/
     public static RollbackRecord buildRollbackRecord() {
         return new RollbackRecord(1, 1, 1, 1);
@@ -559,16 +536,6 @@ public class RecordUtils {
         return new MetaPageUpdatePartitionDataRecordV3(1, 1, 1, 1, 1, 1, (byte)1, 1, 1, 0, 0);
     }
 
-    /** **/
-    public static UnsupportedWalRecord buildMetaPageUpdatePartitionDataRecordV4() {
-        return new UnsupportedWalRecord(PARTITION_META_PAGE_DELTA_RECORD_V4);
-    }
-
-    /** **/
-    public static UnsupportedWalRecord buildMasterKeyChangeRecord() {
-        return new UnsupportedWalRecord(MASTER_KEY_CHANGE_RECORD);
-    }
-
     /** **/
     public static MasterKeyChangeRecordV2 buildMasterKeyChangeRecordV2() {
         return new MasterKeyChangeRecordV2("", Collections.emptyList());
@@ -599,31 +566,6 @@ public class RecordUtils {
         return new DataPageMvccUpdateNewTxStateHintRecord(1, 1, 2, (byte)1);
     }
 
-    /** **/
-    public static UnsupportedWalRecord buildEncryptedRecord() {
-        return new UnsupportedWalRecord(ENCRYPTED_RECORD);
-    }
-
-    /** **/
-    public static UnsupportedWalRecord buildEncryptedDataRecord() {
-        return new UnsupportedWalRecord(ENCRYPTED_DATA_RECORD);
-    }
-
-    /** **/
-    public static UnsupportedWalRecord buildEncryptedRecordV2() {
-        return new UnsupportedWalRecord(ENCRYPTED_RECORD_V2);
-    }
-
-    /** **/
-    public static UnsupportedWalRecord buildEncryptedDataRecordV2() {
-        return new UnsupportedWalRecord(ENCRYPTED_DATA_RECORD_V2);
-    }
-
-    /** **/
-    public static UnsupportedWalRecord buildEncryptedDataRecordV3() {
-        return new UnsupportedWalRecord(ENCRYPTED_DATA_RECORD_V3);
-    }
-
     /** **/
     public static MvccDataRecord buildMvccDataRecord() {
         return new MvccDataRecord(Collections.emptyList(), 1);
@@ -640,21 +582,6 @@ public class RecordUtils {
         );
     }
 
-    /** **/
-    public static UnsupportedWalRecord buildConsistentCutRecord() {
-        return new UnsupportedWalRecord(CONSISTENT_CUT);
-    }
-
-    /** **/
-    public static UnsupportedWalRecord buildBtreeMetaPageInitRootV3() {
-        return new UnsupportedWalRecord(BTREE_META_PAGE_INIT_ROOT_V3);
-    }
-
-    /** **/
-    public static UnsupportedWalRecord buildOutOfOrderRecord() {
-        return new UnsupportedWalRecord(OUT_OF_ORDER_UPDATE);
-    }
-
     /**
      * Return {@code true} if include to write-ahead log.
      *
@@ -683,4 +610,14 @@ public class RecordUtils {
     public static PartitionClearingStartRecord buildPartitionClearingStartedRecord() {
         return new PartitionClearingStartRecord(12, 345, 123456789);
     }
+
+    /**
+     * Creates a new supplier that always return UnsupportedWalRecord for the given {@code type}.
+     *
+     * @param type WAL record type.
+     * @return Supplier that always return UnsupportedWalRecord.
+     */
+    private static Supplier<WALRecord> buildUpsupportedWalRecord(WALRecord.RecordType type) {
+        return () -> new UnsupportedWalRecord(type);
+    }
 }