This is an automated email from the ASF dual-hosted git repository. av 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 63c95b769c9 IGNITE-21369 Removal of MVCC code in WAL classes (#11204) 63c95b769c9 is described below commit 63c95b769c9698f185dfa5e19023dd5345f0fd2b Author: Ilya Shishkov <shishkovi...@gmail.com> AuthorDate: Wed Apr 17 13:22:51 2024 +0300 IGNITE-21369 Removal of MVCC code in WAL classes (#11204) --- .../pagemem/wal/record/LazyMvccDataEntry.java | 149 --------------------- .../internal/pagemem/wal/record/MvccDataEntry.java | 75 ----------- .../pagemem/wal/record/MvccDataRecord.java | 69 ---------- .../internal/pagemem/wal/record/MvccTxRecord.java | 98 -------------- .../pagemem/wal/record/UnwrapMvccDataEntry.java | 126 ----------------- .../internal/pagemem/wal/record/WALRecord.java | 5 + .../delta/DataPageMvccMarkUpdatedRecord.java | 103 -------------- .../DataPageMvccUpdateNewTxStateHintRecord.java | 79 ----------- .../delta/DataPageMvccUpdateTxStateHintRecord.java | 79 ----------- .../GridCacheDatabaseSharedManager.java | 2 - .../cache/persistence/tree/io/DataPageIO.java | 105 --------------- .../wal/reader/StandaloneWalRecordsIterator.java | 51 +++---- .../wal/serializer/RecordDataV1Serializer.java | 88 +----------- .../wal/serializer/RecordDataV2Serializer.java | 139 +------------------ .../wal/serializer/TxRecordSerializer.java | 123 ----------------- .../db/wal/reader/IgniteWalReaderTest.java | 11 +- .../testframework/wal/record/RecordUtils.java | 50 ++----- .../apache/ignite/development/utils/WalStat.java | 5 +- 18 files changed, 36 insertions(+), 1321 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/LazyMvccDataEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/LazyMvccDataEntry.java deleted file mode 100644 index a7ad86f4eaf..00000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/LazyMvccDataEntry.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 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.pagemem.wal.record; - -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteException; -import org.apache.ignite.internal.processors.cache.CacheObject; -import org.apache.ignite.internal.processors.cache.GridCacheContext; -import org.apache.ignite.internal.processors.cache.GridCacheOperation; -import org.apache.ignite.internal.processors.cache.GridCacheSharedContext; -import org.apache.ignite.internal.processors.cache.KeyCacheObject; -import org.apache.ignite.internal.processors.cache.mvcc.MvccVersion; -import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; -import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor; - -/** - * Represents Data Entry ({@link #key}, {@link #val value}) pair update {@link #op operation}. <br> - * This Data entry was not converted to key, value pair during record deserialization. - */ -public class LazyMvccDataEntry extends MvccDataEntry implements MarshalledDataEntry { - /** */ - private GridCacheSharedContext cctx; - - /** Data Entry key type code. See {@link CacheObject} for built-in value type codes */ - private byte keyType; - - /** Key value bytes. */ - private byte[] keyBytes; - - /** Data Entry Value type code. See {@link CacheObject} for built-in value type codes */ - private byte valType; - - /** Value value bytes. */ - private byte[] valBytes; - - /** - * @param cctx Shared context. - * @param cacheId Cache ID. - * @param keyType Object type code for Key. - * @param keyBytes Data Entry Key value bytes. - * @param valType Object type code for Value. - * @param valBytes Data Entry Value value bytes. - * @param op Operation. - * @param nearXidVer Near transaction version. - * @param writeVer Write version. - * @param expireTime Expire time. - * @param partId Partition ID. - * @param partCnt Partition counter. - * @param mvccVer Mvcc version. - */ - public LazyMvccDataEntry( - GridCacheSharedContext cctx, - int cacheId, - byte keyType, - byte[] keyBytes, - byte valType, - byte[] valBytes, - GridCacheOperation op, - GridCacheVersion nearXidVer, - GridCacheVersion writeVer, - long expireTime, - int partId, - long partCnt, - MvccVersion mvccVer - ) { - super(cacheId, null, null, op, nearXidVer, writeVer, expireTime, partId, partCnt, mvccVer); - - this.cctx = cctx; - this.keyType = keyType; - this.keyBytes = keyBytes; - this.valType = valType; - this.valBytes = valBytes; - } - - /** {@inheritDoc} */ - @Override public KeyCacheObject key() { - try { - if (key == null) { - GridCacheContext cacheCtx = cctx.cacheContext(cacheId); - - if (cacheCtx == null) - throw new IgniteException("Failed to find cache context for the given cache ID: " + cacheId); - - IgniteCacheObjectProcessor co = cctx.kernalContext().cacheObjects(); - - key = co.toKeyCacheObject(cacheCtx.cacheObjectContext(), keyType, keyBytes); - - if (key.partition() == -1) - key.partition(partId); - } - - return key; - } - catch (IgniteCheckedException e) { - throw new IgniteException(e); - } - } - - /** {@inheritDoc} */ - @Override public CacheObject value() { - if (val == null && valBytes != null) { - GridCacheContext cacheCtx = cctx.cacheContext(cacheId); - - if (cacheCtx == null) - throw new IgniteException("Failed to find cache context for the given cache ID: " + cacheId); - - IgniteCacheObjectProcessor co = cctx.kernalContext().cacheObjects(); - - val = co.toCacheObject(cacheCtx.cacheObjectContext(), valType, valBytes); - } - - return val; - } - - /** {@inheritDoc} */ - @Override public byte getKeyType() { - return keyType; - } - - /** {@inheritDoc} */ - @Override public byte[] getKeyBytes() { - return keyBytes; - } - - /** {@inheritDoc} */ - @Override public byte getValType() { - return valType; - } - - /** {@inheritDoc} */ - @Override public byte[] getValBytes() { - return valBytes; - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MvccDataEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MvccDataEntry.java deleted file mode 100644 index 387c147bc5b..00000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MvccDataEntry.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.pagemem.wal.record; - -import org.apache.ignite.internal.processors.cache.CacheObject; -import org.apache.ignite.internal.processors.cache.GridCacheOperation; -import org.apache.ignite.internal.processors.cache.KeyCacheObject; -import org.apache.ignite.internal.processors.cache.mvcc.MvccVersion; -import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.jetbrains.annotations.Nullable; - -/** - * Represents Data Entry ({@link #key}, {@link #val value}) pair for mvcc update {@link #op operation} in WAL log. - */ -public class MvccDataEntry extends DataEntry { - /** Entry version. */ - private MvccVersion mvccVer; - - /** - * @param cacheId Cache ID. - * @param key Key. - * @param val Value or null for delete operation. - * @param op Operation. - * @param nearXidVer Near transaction version. - * @param writeVer Write version. - * @param expireTime Expire time. - * @param partId Partition ID. - * @param partCnt Partition counter. - * @param mvccVer Mvcc version. - */ - public MvccDataEntry( - int cacheId, - KeyCacheObject key, - @Nullable CacheObject val, - GridCacheOperation op, - GridCacheVersion nearXidVer, - GridCacheVersion writeVer, - long expireTime, - int partId, - long partCnt, - MvccVersion mvccVer - ) { - super(cacheId, key, val, op, nearXidVer, writeVer, expireTime, partId, partCnt, EMPTY_FLAGS); - - this.mvccVer = mvccVer; - } - - /** - * @return Mvcc version. - */ - public MvccVersion mvccVer() { - return mvccVer; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(MvccDataEntry.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MvccDataRecord.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MvccDataRecord.java deleted file mode 100644 index 6cffbe53d84..00000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MvccDataRecord.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.pagemem.wal.record; - -import java.util.Collections; -import java.util.List; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; - -/** - * Logical data record with cache operation description. - * This record contains information about operation we want to do. - * Contains operation type (put, remove) and (Key, Value, Version) for each {@link MvccDataEntry} - */ -public class MvccDataRecord extends DataRecord { - /** {@inheritDoc} */ - @Override public RecordType type() { - return RecordType.MVCC_DATA_RECORD; - } - - /** - * @param writeEntry Write entry. - */ - public MvccDataRecord(MvccDataEntry writeEntry) { - this(writeEntry, U.currentTimeMillis()); - } - - /** - * @param writeEntries Write entries. - */ - public MvccDataRecord(List<DataEntry> writeEntries) { - this(writeEntries, U.currentTimeMillis()); - } - - /** - * @param writeEntry Write entry. - */ - public MvccDataRecord(MvccDataEntry writeEntry, long timestamp) { - this(Collections.singletonList(writeEntry), timestamp); - } - - /** - * @param writeEntries Write entries. - * @param timestamp TimeStamp. - */ - public MvccDataRecord(List<DataEntry> writeEntries, long timestamp) { - super(writeEntries, timestamp); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(MvccDataRecord.class, this, "super", super.toString()); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MvccTxRecord.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MvccTxRecord.java deleted file mode 100644 index 6e9923f80c9..00000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MvccTxRecord.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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.pagemem.wal.record; - -import java.util.Collection; -import java.util.Map; -import org.apache.ignite.internal.processors.cache.mvcc.MvccVersion; -import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; -import org.apache.ignite.internal.util.typedef.internal.CU; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.transactions.TransactionState; -import org.jetbrains.annotations.Nullable; - -/** - * Logical data record indented for MVCC transaction related actions.<br> - * This record is marker of prepare, commit, and rollback transactions. - */ -public class MvccTxRecord extends TxRecord implements WalRecordCacheGroupAware { - /** Transaction mvcc snapshot version. */ - private final MvccVersion mvccVer; - - /** - * @param state Transaction state. - * @param nearXidVer Transaction id. - * @param writeVer Transaction entries write topology version. - * @param participatingNodes Primary -> Backup nodes compact IDs participating in transaction. - * @param mvccVer Transaction snapshot version. - */ - public MvccTxRecord( - TransactionState state, - GridCacheVersion nearXidVer, - GridCacheVersion writeVer, - @Nullable Map<Short, Collection<Short>> participatingNodes, - MvccVersion mvccVer - ) { - super(state, nearXidVer, writeVer, participatingNodes); - - this.mvccVer = mvccVer; - } - - /** - * @param state Transaction state. - * @param nearXidVer Transaction id. - * @param writeVer Transaction entries write topology version. - * @param mvccVer Transaction snapshot version. - * @param participatingNodes Primary -> Backup nodes participating in transaction. - * @param ts TimeStamp. - */ - public MvccTxRecord( - TransactionState state, - GridCacheVersion nearXidVer, - GridCacheVersion writeVer, - @Nullable Map<Short, Collection<Short>> participatingNodes, - MvccVersion mvccVer, - long ts - ) { - super(state, nearXidVer, writeVer, participatingNodes, ts); - - this.mvccVer = mvccVer; - } - - /** {@inheritDoc} */ - @Override public RecordType type() { - return RecordType.MVCC_TX_RECORD; - } - - /** - * @return Mvcc version. - */ - public MvccVersion mvccVersion() { - return mvccVer; - } - - /** {@inheritDoc} */ - @Override public int groupId() { - return CU.cacheId("TxLog"); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(MvccTxRecord.class, this, "super", super.toString()); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/UnwrapMvccDataEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/UnwrapMvccDataEntry.java deleted file mode 100644 index 47a9d7cc384..00000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/UnwrapMvccDataEntry.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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.pagemem.wal.record; - -import org.apache.ignite.binary.BinaryObject; -import org.apache.ignite.internal.processors.cache.CacheObject; -import org.apache.ignite.internal.processors.cache.CacheObjectValueContext; -import org.apache.ignite.internal.processors.cache.GridCacheOperation; -import org.apache.ignite.internal.processors.cache.KeyCacheObject; -import org.apache.ignite.internal.processors.cache.mvcc.MvccVersion; -import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.SB; - -/** - * Data Entry for automatic unwrapping key and value from Mvcc Data Entry - */ -public class UnwrapMvccDataEntry extends MvccDataEntry implements UnwrappedDataEntry { - /** Cache object value context. Context is used for unwrapping objects. */ - private final CacheObjectValueContext cacheObjValCtx; - - /** Keep binary. This flag disables converting of non primitive types (BinaryObjects). */ - private boolean keepBinary; - - /** - * @param cacheId Cache ID. - * @param key Key. - * @param val Value or null for delete operation. - * @param op Operation. - * @param nearXidVer Near transaction version. - * @param writeVer Write version. - * @param expireTime Expire time. - * @param partId Partition ID. - * @param partCnt Partition counter. - * @param mvccVer Mvcc version. - * @param cacheObjValCtx cache object value context for unwrapping objects. - * @param keepBinary disable unwrapping for non primitive objects, Binary Objects would be returned instead. - */ - public UnwrapMvccDataEntry( - final int cacheId, - final KeyCacheObject key, - final CacheObject val, - final GridCacheOperation op, - final GridCacheVersion nearXidVer, - final GridCacheVersion writeVer, - final long expireTime, - final int partId, - final long partCnt, - MvccVersion mvccVer, - final CacheObjectValueContext cacheObjValCtx, - final boolean keepBinary) { - super(cacheId, key, val, op, nearXidVer, writeVer, expireTime, partId, partCnt, mvccVer); - - this.cacheObjValCtx = cacheObjValCtx; - this.keepBinary = keepBinary; - } - - /** {@inheritDoc} */ - @Override public Object unwrappedKey() { - try { - if (keepBinary && key instanceof BinaryObject) - return key; - - Object unwrapped = key.value(cacheObjValCtx, false); - - if (unwrapped instanceof BinaryObject) { - if (keepBinary) - return unwrapped; - unwrapped = ((BinaryObject)unwrapped).deserialize(); - } - - return unwrapped; - } - catch (Exception e) { - cacheObjValCtx.kernalContext().log(UnwrapMvccDataEntry.class) - .error("Unable to convert key [" + key + "]", e); - - return null; - } - } - - /** {@inheritDoc} */ - @Override public Object unwrappedValue() { - try { - if (val == null) - return null; - - if (keepBinary && val instanceof BinaryObject) - return val; - - return val.value(cacheObjValCtx, false); - } - catch (Exception e) { - cacheObjValCtx.kernalContext().log(UnwrapMvccDataEntry.class) - .error("Unable to convert value [" + value() + "]", e); - return null; - } - } - - /** {@inheritDoc} */ - @Override public String toString() { - SB sb = new SB(); - - sb.a(getClass().getSimpleName()).a('['); - - if (S.includeSensitive()) - sb.a("k = ").a(unwrappedKey()).a(", v = [ ").a(unwrappedValue()).a("], "); - - return sb.a("super = [").a(super.toString()).a("]]").toString(); - } -} 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 2a38b2e9e8a..438e759195a 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 @@ -196,12 +196,15 @@ public abstract class WALRecord { ROTATED_ID_PART_RECORD(48, PHYSICAL), /** */ + @Deprecated MVCC_DATA_PAGE_MARK_UPDATED_RECORD(49, PHYSICAL), /** */ + @Deprecated MVCC_DATA_PAGE_TX_STATE_HINT_UPDATED_RECORD(50, PHYSICAL), /** */ + @Deprecated MVCC_DATA_PAGE_NEW_TX_STATE_HINT_UPDATED_RECORD(51, PHYSICAL), /** Encrypted WAL-record. */ @@ -215,9 +218,11 @@ public abstract class WALRecord { ENCRYPTED_DATA_RECORD(53, LOGICAL), /** Mvcc data record. */ + @Deprecated MVCC_DATA_RECORD(54, LOGICAL), /** Mvcc Tx state change record. */ + @Deprecated MVCC_TX_RECORD(55, LOGICAL), /** Consistent cut record. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/DataPageMvccMarkUpdatedRecord.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/DataPageMvccMarkUpdatedRecord.java deleted file mode 100644 index 907f4c09aa9..00000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/DataPageMvccMarkUpdatedRecord.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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.pagemem.wal.record.delta; - -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.internal.pagemem.PageMemory; -import org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO; -import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO; -import org.apache.ignite.internal.util.typedef.internal.S; - -/** - * MVCC mark updated record. - */ -public class DataPageMvccMarkUpdatedRecord extends PageDeltaRecord { - /** */ - private int itemId; - - /** */ - private long newMvccCrd; - - /** */ - private long newMvccCntr; - - /** */ - private int newMvccOpCntr; - - /** - * @param grpId Cache group ID. - * @param pageId Page ID. - * @param itemId Item id. - * @param newMvccCrd New MVCC coordinator version. - * @param newMvccCntr New MVCC counter version. - * @param newMvccOpCntr New MVCC operation counter. - */ - public DataPageMvccMarkUpdatedRecord(int grpId, long pageId, int itemId, long newMvccCrd, long newMvccCntr, int newMvccOpCntr) { - super(grpId, pageId); - - this.itemId = itemId; - this.newMvccCrd = newMvccCrd; - this.newMvccCntr = newMvccCntr; - this.newMvccOpCntr = newMvccOpCntr; - } - - /** {@inheritDoc} */ - @Override public void applyDelta(PageMemory pageMem, long pageAddr) throws IgniteCheckedException { - DataPageIO io = PageIO.getPageIO(pageAddr); - - io.updateNewVersion(pageAddr, itemId, pageMem.realPageSize(groupId()), newMvccCrd, newMvccCntr, newMvccOpCntr); - } - - /** {@inheritDoc} */ - @Override public RecordType type() { - return RecordType.MVCC_DATA_PAGE_MARK_UPDATED_RECORD; - } - - /** - * @return Item id. - */ - public int itemId() { - return itemId; - } - - /** - * @return New MVCC coordinator version. - */ - public long newMvccCrd() { - return newMvccCrd; - } - - /** - * @return New MVCC counter version. - */ - public long newMvccCntr() { - return newMvccCntr; - } - - /** - * @return New MVCC operation counter. - */ - public int newMvccOpCntr() { - return newMvccOpCntr; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(DataPageMvccMarkUpdatedRecord.class, this, "super", super.toString()); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/DataPageMvccUpdateNewTxStateHintRecord.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/DataPageMvccUpdateNewTxStateHintRecord.java deleted file mode 100644 index f3d235d35e1..00000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/DataPageMvccUpdateNewTxStateHintRecord.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.pagemem.wal.record.delta; - -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.internal.pagemem.PageMemory; -import org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO; -import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO; -import org.apache.ignite.internal.util.typedef.internal.S; - -/** - * MVCC update tx state hint record. - */ -public class DataPageMvccUpdateNewTxStateHintRecord extends PageDeltaRecord { - /** */ - private int itemId; - - /** */ - private byte txState; - - /** - * @param grpId Cache group ID. - * @param pageId Page ID. - * @param itemId Item id. - * @param txState Tx state hint. - */ - public DataPageMvccUpdateNewTxStateHintRecord(int grpId, long pageId, int itemId, byte txState) { - super(grpId, pageId); - - this.itemId = itemId; - this.txState = txState; - } - - /** {@inheritDoc} */ - @Override public void applyDelta(PageMemory pageMem, long pageAddr) throws IgniteCheckedException { - DataPageIO io = PageIO.getPageIO(pageAddr); - - io.updateNewTxState(pageAddr, itemId, pageMem.realPageSize(groupId()), txState); - } - - /** {@inheritDoc} */ - @Override public RecordType type() { - return RecordType.MVCC_DATA_PAGE_NEW_TX_STATE_HINT_UPDATED_RECORD; - } - - /** - * @return Item id. - */ - public int itemId() { - return itemId; - } - - /** - * @return Tx state hint. - */ - public byte txState() { - return txState; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(DataPageMvccUpdateNewTxStateHintRecord.class, this, "super", super.toString()); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/DataPageMvccUpdateTxStateHintRecord.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/DataPageMvccUpdateTxStateHintRecord.java deleted file mode 100644 index fd77728d7ac..00000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/DataPageMvccUpdateTxStateHintRecord.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.pagemem.wal.record.delta; - -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.internal.pagemem.PageMemory; -import org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO; -import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO; -import org.apache.ignite.internal.util.typedef.internal.S; - -/** - * MVCC update tx state hint record. - */ -public class DataPageMvccUpdateTxStateHintRecord extends PageDeltaRecord { - /** */ - private int itemId; - - /** */ - private byte txState; - - /** - * @param grpId Cache group ID. - * @param pageId Page ID. - * @param itemId Item id. - * @param txState Tx state hint. - */ - public DataPageMvccUpdateTxStateHintRecord(int grpId, long pageId, int itemId, byte txState) { - super(grpId, pageId); - - this.itemId = itemId; - this.txState = txState; - } - - /** {@inheritDoc} */ - @Override public void applyDelta(PageMemory pageMem, long pageAddr) throws IgniteCheckedException { - DataPageIO io = PageIO.getPageIO(pageAddr); - - io.updateTxState(pageAddr, itemId, pageMem.realPageSize(groupId()), txState); - } - - /** {@inheritDoc} */ - @Override public RecordType type() { - return RecordType.MVCC_DATA_PAGE_TX_STATE_HINT_UPDATED_RECORD; - } - - /** - * @return Item id. - */ - public int itemId() { - return itemId; - } - - /** - * @return Tx state hint. - */ - public byte txState() { - return txState; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(DataPageMvccUpdateTxStateHintRecord.class, this, "super", super.toString()); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java index f534624e23e..a33615135cd 100755 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java @@ -2428,7 +2428,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan break; switch (rec.type()) { - case MVCC_DATA_RECORD: case DATA_RECORD: case DATA_RECORD_V2: checkpointReadLock(); @@ -2562,7 +2561,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan break; - case MVCC_DATA_RECORD: case DATA_RECORD: case DATA_RECORD_V2: case ENCRYPTED_DATA_RECORD: diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/DataPageIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/DataPageIO.java index bf5e0ac6390..249f17d11f2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/DataPageIO.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/DataPageIO.java @@ -25,8 +25,6 @@ import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow; import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; import org.apache.ignite.internal.util.GridStringBuilder; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.MVCC_HINTS_BIT_OFF; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.MVCC_HINTS_MASK; import static org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO.EntryPart.CACHE_ID; import static org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO.EntryPart.EXPIRE_TIME; import static org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO.EntryPart.KEY; @@ -193,76 +191,6 @@ public class DataPageIO extends AbstractDataPageIO<CacheDataRow> { return len; } - /** - * @param pageAddr Page address. - * @param itemId Item ID. - * @param pageSize Page size. - * @param mvccCrd Mvcc coordinator. - * @param mvccCntr Mvcc counter. - * @param mvccOpCntr Operation counter. - */ - public void updateNewVersion(long pageAddr, int itemId, int pageSize, long mvccCrd, long mvccCntr, int mvccOpCntr) { - assertPageType(pageAddr); - - int dataOff = getDataOffset(pageAddr, itemId, pageSize); - - long addr = pageAddr + dataOff + (isFragmented(pageAddr, dataOff) ? 10 : 2); - - updateNewVersion(addr, mvccCrd, mvccCntr, mvccOpCntr); - } - - /** - * @param pageAddr Page address. - * @param itemId Item ID. - * @param pageSize Page size. - * @param txState Tx state hint. - */ - public void updateTxState(long pageAddr, int itemId, int pageSize, byte txState) { - assertPageType(pageAddr); - - int dataOff = getDataOffset(pageAddr, itemId, pageSize); - - long addr = pageAddr + dataOff + (isFragmented(pageAddr, dataOff) ? 10 : 2); - - int opCntr = rawMvccOperationCounter(addr, 0); - - rawMvccOperationCounter(addr, 0, (opCntr & ~MVCC_HINTS_MASK) | ((int)txState << MVCC_HINTS_BIT_OFF)); - } - - /** - * @param pageAddr Page address. - * @param itemId Item ID. - * @param pageSize Page size. - * @param txState Tx state hint. - */ - public void updateNewTxState(long pageAddr, int itemId, int pageSize, byte txState) { - assertPageType(pageAddr); - - int dataOff = getDataOffset(pageAddr, itemId, pageSize); - - long addr = pageAddr + dataOff + (isFragmented(pageAddr, dataOff) ? 10 : 2); - - int opCntr = rawNewMvccOperationCounter(addr, 0); - - rawNewMvccOperationCounter(addr, 0, (opCntr & ~MVCC_HINTS_MASK) | ((int)txState << MVCC_HINTS_BIT_OFF)); - } - - /** - * Marks row removed. - * - * @param addr Address. - * @param mvccCrd Mvcc coordinator. - * @param mvccCntr Mvcc counter. - */ - private void updateNewVersion(long addr, long mvccCrd, long mvccCntr, int mvccOpCntr) { - // Skip xid_min. - addr += 20; - - PageUtils.putLong(addr, 0, mvccCrd); - PageUtils.putLong(addr, 8, mvccCntr); - PageUtils.putInt(addr, 16, mvccOpCntr); - } - /** * Returns MVCC coordinator number. * @@ -302,21 +230,6 @@ public class DataPageIO extends AbstractDataPageIO<CacheDataRow> { return PageUtils.getInt(addr, 16); } - /** - * Sets MVCC operation counter raw value (with hints and flags). - * - * @param pageAddr Page address. - * @param dataOff Data offset. - * @param opCntr MVCC counter value. - */ - public void rawMvccOperationCounter(long pageAddr, int dataOff, int opCntr) { - assertPageType(pageAddr); - - long addr = pageAddr + dataOff; - - PageUtils.putInt(addr, 16, opCntr); - } - /** * Returns new MVCC coordinator number. * @@ -365,24 +278,6 @@ public class DataPageIO extends AbstractDataPageIO<CacheDataRow> { return PageUtils.getInt(addr, 16); } - /** - * Sets MVCC new operation counter raw value (with hints and flags). - * - * @param pageAddr Page address. - * @param dataOff Data offset. - * @param opCntr MVCC operation counter value. - */ - public void rawNewMvccOperationCounter(long pageAddr, int dataOff, int opCntr) { - assertPageType(pageAddr); - - long addr = pageAddr + dataOff; - - // Skip xid_min. - addr += 20; - - PageUtils.putInt(addr, 16, opCntr); - } - /** * @param buf Byte buffer. * @param ver Version. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneWalRecordsIterator.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneWalRecordsIterator.java index e4a16cc3608..f4572547f65 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneWalRecordsIterator.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneWalRecordsIterator.java @@ -29,10 +29,7 @@ import org.apache.ignite.internal.pagemem.wal.record.DataEntry; import org.apache.ignite.internal.pagemem.wal.record.DataRecord; import org.apache.ignite.internal.pagemem.wal.record.FilteredRecord; import org.apache.ignite.internal.pagemem.wal.record.MarshalledDataEntry; -import org.apache.ignite.internal.pagemem.wal.record.MvccDataEntry; -import org.apache.ignite.internal.pagemem.wal.record.MvccDataRecord; import org.apache.ignite.internal.pagemem.wal.record.UnwrapDataEntry; -import org.apache.ignite.internal.pagemem.wal.record.UnwrapMvccDataEntry; import org.apache.ignite.internal.pagemem.wal.record.WALRecord; import org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType; import org.apache.ignite.internal.processors.cache.CacheObject; @@ -351,8 +348,7 @@ class StandaloneWalRecordsIterator extends AbstractWalRecordsIterator { if (proc != null && (rec.type() == RecordType.DATA_RECORD || rec.type() == RecordType.DATA_RECORD_V2 - || rec.type() == RecordType.CDC_DATA_RECORD - || rec.type() == RecordType.MVCC_DATA_RECORD)) { + || rec.type() == RecordType.CDC_DATA_RECORD)) { try { return postProcessDataRecord((DataRecord)rec, kernalCtx, proc); } @@ -407,9 +403,7 @@ class StandaloneWalRecordsIterator extends AbstractWalRecordsIterator { postProcessedEntries.add(postProcessedEntry); } - DataRecord res = dataRec instanceof MvccDataRecord ? - new MvccDataRecord(postProcessedEntries, dataRec.timestamp()) : - new DataRecord(postProcessedEntries, dataRec.timestamp()); + DataRecord res = new DataRecord(postProcessedEntries, dataRec.timestamp()); res.size(dataRec.size()); res.position(dataRec.position()); @@ -470,34 +464,19 @@ class StandaloneWalRecordsIterator extends AbstractWalRecordsIterator { */ private DataEntry unwrapDataEntry(CacheObjectContext coCtx, DataEntry dataEntry, KeyCacheObject key, CacheObject val, boolean keepBinary) { - if (dataEntry instanceof MvccDataEntry) - return new UnwrapMvccDataEntry( - dataEntry.cacheId(), - key, - val, - dataEntry.op(), - dataEntry.nearXidVersion(), - dataEntry.writeVersion(), - dataEntry.expireTime(), - dataEntry.partitionId(), - dataEntry.partitionCounter(), - ((MvccDataEntry)dataEntry).mvccVer(), - coCtx, - keepBinary); - else - return new UnwrapDataEntry( - dataEntry.cacheId(), - key, - val, - dataEntry.op(), - dataEntry.nearXidVersion(), - dataEntry.writeVersion(), - dataEntry.expireTime(), - dataEntry.partitionId(), - dataEntry.partitionCounter(), - coCtx, - keepBinary, - dataEntry.flags()); + return new UnwrapDataEntry( + dataEntry.cacheId(), + key, + val, + dataEntry.op(), + dataEntry.nearXidVersion(), + dataEntry.writeVersion(), + dataEntry.expireTime(), + dataEntry.partitionId(), + dataEntry.partitionCounter(), + coCtx, + keepBinary, + dataEntry.flags()); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV1Serializer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV1Serializer.java index 6363f59d519..0a77869f3ff 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV1Serializer.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV1Serializer.java @@ -50,7 +50,6 @@ import org.apache.ignite.internal.pagemem.wal.record.LazyDataEntry; import org.apache.ignite.internal.pagemem.wal.record.MasterKeyChangeRecordV2; import org.apache.ignite.internal.pagemem.wal.record.MemoryRecoveryRecord; import org.apache.ignite.internal.pagemem.wal.record.MetastoreDataRecord; -import org.apache.ignite.internal.pagemem.wal.record.MvccDataEntry; import org.apache.ignite.internal.pagemem.wal.record.PageSnapshot; import org.apache.ignite.internal.pagemem.wal.record.PartitionClearingStartRecord; import org.apache.ignite.internal.pagemem.wal.record.ReencryptionStartRecord; @@ -61,9 +60,6 @@ import org.apache.ignite.internal.pagemem.wal.record.WalRecordCacheGroupAware; import org.apache.ignite.internal.pagemem.wal.record.delta.ClusterSnapshotRecord; import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageInsertFragmentRecord; import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageInsertRecord; -import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageMvccMarkUpdatedRecord; -import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageMvccUpdateNewTxStateHintRecord; -import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageMvccUpdateTxStateHintRecord; import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageRemoveRecord; import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageSetFreeListPageRecord; import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageUpdateRecord; @@ -434,15 +430,6 @@ public class RecordDataV1Serializer implements RecordDataSerializer { case DATA_PAGE_SET_FREE_LIST_PAGE: return 4 + 8 + 8; - case MVCC_DATA_PAGE_MARK_UPDATED_RECORD: - return 4 + 8 + 4 + 8 + 8 + 4; - - case MVCC_DATA_PAGE_TX_STATE_HINT_UPDATED_RECORD: - return 4 + 8 + 4 + 1; - - case MVCC_DATA_PAGE_NEW_TX_STATE_HINT_UPDATED_RECORD: - return 4 + 8 + 4 + 1; - case INIT_NEW_PAGE_RECORD: return 4 + 8 + 2 + 2 + 8; @@ -821,41 +808,6 @@ public class RecordDataV1Serializer implements RecordDataSerializer { break; - case MVCC_DATA_PAGE_MARK_UPDATED_RECORD: - cacheId = in.readInt(); - pageId = in.readLong(); - - itemId = in.readInt(); - long newMvccCrd = in.readLong(); - long newMvccCntr = in.readLong(); - int newMvccOpCntr = in.readInt(); - - res = new DataPageMvccMarkUpdatedRecord(cacheId, pageId, itemId, newMvccCrd, newMvccCntr, newMvccOpCntr); - - break; - - case MVCC_DATA_PAGE_TX_STATE_HINT_UPDATED_RECORD: - cacheId = in.readInt(); - pageId = in.readLong(); - - itemId = in.readInt(); - byte txState = in.readByte(); - - res = new DataPageMvccUpdateTxStateHintRecord(cacheId, pageId, itemId, txState); - - break; - - case MVCC_DATA_PAGE_NEW_TX_STATE_HINT_UPDATED_RECORD: - cacheId = in.readInt(); - pageId = in.readLong(); - - itemId = in.readInt(); - byte newTxState = in.readByte(); - - res = new DataPageMvccUpdateNewTxStateHintRecord(cacheId, pageId, itemId, newTxState); - - break; - case INIT_NEW_PAGE_RECORD: cacheId = in.readInt(); pageId = in.readLong(); @@ -1530,41 +1482,6 @@ public class RecordDataV1Serializer implements RecordDataSerializer { break; - case MVCC_DATA_PAGE_MARK_UPDATED_RECORD: - DataPageMvccMarkUpdatedRecord rmvRec = (DataPageMvccMarkUpdatedRecord)rec; - - buf.putInt(rmvRec.groupId()); - buf.putLong(rmvRec.pageId()); - - buf.putInt(rmvRec.itemId()); - buf.putLong(rmvRec.newMvccCrd()); - buf.putLong(rmvRec.newMvccCntr()); - buf.putInt(rmvRec.newMvccOpCntr()); - - break; - - case MVCC_DATA_PAGE_TX_STATE_HINT_UPDATED_RECORD: - DataPageMvccUpdateTxStateHintRecord txStRec = (DataPageMvccUpdateTxStateHintRecord)rec; - - buf.putInt(txStRec.groupId()); - buf.putLong(txStRec.pageId()); - - buf.putInt(txStRec.itemId()); - buf.put(txStRec.txState()); - - break; - - case MVCC_DATA_PAGE_NEW_TX_STATE_HINT_UPDATED_RECORD: - DataPageMvccUpdateNewTxStateHintRecord newTxStRec = (DataPageMvccUpdateNewTxStateHintRecord)rec; - - buf.putInt(newTxStRec.groupId()); - buf.putLong(newTxStRec.pageId()); - - buf.putInt(newTxStRec.itemId()); - buf.put(newTxStRec.txState()); - - break; - case INIT_NEW_PAGE_RECORD: InitNewPageRecord inpRec = (InitNewPageRecord)rec; @@ -2102,8 +2019,7 @@ public class RecordDataV1Serializer implements RecordDataSerializer { buf.putLong(entry.partitionCounter()); buf.putLong(entry.expireTime()); - if (!(entry instanceof MvccDataEntry)) - buf.put(entry.flags()); + buf.put(entry.flags()); } /** @@ -2412,7 +2328,7 @@ public class RecordDataV1Serializer implements RecordDataSerializer { /*part ID*/4 + /*expire Time*/8 + /*part cnt*/8 + - /*flags*/(entry instanceof MvccDataEntry ? 0 : 1); + /*flags*/1; } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV2Serializer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV2Serializer.java index 77cc5eb0cfe..18071eb8723 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV2Serializer.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV2Serializer.java @@ -33,10 +33,6 @@ import org.apache.ignite.internal.pagemem.wal.record.CheckpointRecord; import org.apache.ignite.internal.pagemem.wal.record.DataEntry; import org.apache.ignite.internal.pagemem.wal.record.DataRecord; import org.apache.ignite.internal.pagemem.wal.record.ExchangeRecord; -import org.apache.ignite.internal.pagemem.wal.record.LazyMvccDataEntry; -import org.apache.ignite.internal.pagemem.wal.record.MvccDataEntry; -import org.apache.ignite.internal.pagemem.wal.record.MvccDataRecord; -import org.apache.ignite.internal.pagemem.wal.record.MvccTxRecord; import org.apache.ignite.internal.pagemem.wal.record.PageSnapshot; import org.apache.ignite.internal.pagemem.wal.record.RollbackRecord; import org.apache.ignite.internal.pagemem.wal.record.SnapshotRecord; @@ -44,17 +40,10 @@ import org.apache.ignite.internal.pagemem.wal.record.TxRecord; import org.apache.ignite.internal.pagemem.wal.record.WALRecord; import org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType; import org.apache.ignite.internal.pagemem.wal.record.delta.TrackingPageRepairDeltaRecord; -import org.apache.ignite.internal.processors.cache.CacheObject; -import org.apache.ignite.internal.processors.cache.CacheObjectContext; -import org.apache.ignite.internal.processors.cache.GridCacheContext; -import org.apache.ignite.internal.processors.cache.GridCacheOperation; import org.apache.ignite.internal.processors.cache.GridCacheSharedContext; -import org.apache.ignite.internal.processors.cache.KeyCacheObject; -import org.apache.ignite.internal.processors.cache.mvcc.MvccVersion; import org.apache.ignite.internal.processors.cache.persistence.wal.ByteBufferBackedDataInput; import org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer; import org.apache.ignite.internal.processors.cache.persistence.wal.record.HeaderRecord; -import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; /** * Record data V2 serializer. @@ -90,7 +79,6 @@ public class RecordDataV2Serializer extends RecordDataV1Serializer { return 18 + cacheStatesSize + (walPtr == null ? 0 : 16); - case MVCC_DATA_RECORD: case CDC_DATA_RECORD: return 4/*entry count*/ + 8/*timestamp*/ + dataSize((DataRecord)rec); @@ -106,9 +94,6 @@ public class RecordDataV2Serializer extends RecordDataV1Serializer { case TX_RECORD: return txRecordSerializer.size((TxRecord)rec); - case MVCC_TX_RECORD: - return txRecordSerializer.size((MvccTxRecord)rec); - case ROLLBACK_TX_RECORD: return 4 + 4 + 8 + 8; @@ -178,17 +163,6 @@ public class RecordDataV2Serializer extends RecordDataV1Serializer { return new DataRecord(entries, timeStamp); } - case MVCC_DATA_RECORD: - entryCnt = in.readInt(); - timeStamp = in.readLong(); - - List<DataEntry> entries = new ArrayList<>(entryCnt); - - for (int i = 0; i < entryCnt; i++) - entries.add(readMvccDataEntry(in)); - - return new MvccDataRecord(entries, timeStamp); - case ENCRYPTED_DATA_RECORD: case ENCRYPTED_DATA_RECORD_V2: case ENCRYPTED_DATA_RECORD_V3: @@ -198,7 +172,7 @@ public class RecordDataV2Serializer extends RecordDataV1Serializer { if (entryCnt == 1) return new DataRecord(readEncryptedDataEntry(in, type), timeStamp); else { - entries = new ArrayList<>(entryCnt); + List<DataEntry> entries = new ArrayList<>(entryCnt); for (int i = 0; i < entryCnt; i++) entries.add(readEncryptedDataEntry(in, type)); @@ -222,9 +196,6 @@ public class RecordDataV2Serializer extends RecordDataV1Serializer { case TX_RECORD: return txRecordSerializer.readTx(in); - case MVCC_TX_RECORD: - return txRecordSerializer.readMvccTx(in); - case ROLLBACK_TX_RECORD: int grpId = in.readInt(); int partId = in.readInt(); @@ -272,7 +243,6 @@ public class RecordDataV2Serializer extends RecordDataV1Serializer { break; - case MVCC_DATA_RECORD: case DATA_RECORD_V2: case CDC_DATA_RECORD: DataRecord dataRec = (DataRecord)rec; @@ -317,11 +287,6 @@ public class RecordDataV2Serializer extends RecordDataV1Serializer { break; - case MVCC_TX_RECORD: - txRecordSerializer.write((MvccTxRecord)rec, buf); - - break; - case ROLLBACK_TX_RECORD: RollbackRecord rb = (RollbackRecord)rec; @@ -345,108 +310,6 @@ public class RecordDataV2Serializer extends RecordDataV1Serializer { } } - /** {@inheritDoc} */ - @Override void putPlainDataEntry(ByteBuffer buf, DataEntry entry) throws IgniteCheckedException { - if (entry instanceof MvccDataEntry) - putMvccDataEntry(buf, (MvccDataEntry)entry); - else - super.putPlainDataEntry(buf, entry); - } - - /** - * @param buf Buffer to write to. - * @param entry Data entry. - */ - private void putMvccDataEntry(ByteBuffer buf, MvccDataEntry entry) throws IgniteCheckedException { - super.putPlainDataEntry(buf, entry); - - txRecordSerializer.putMvccVersion(buf, entry.mvccVer()); - } - - /** - * @param in Input to read from. - * @return Read entry. - */ - private MvccDataEntry readMvccDataEntry(ByteBufferBackedDataInput in) throws IOException, IgniteCheckedException { - int cacheId = in.readInt(); - - int keySize = in.readInt(); - byte keyType = in.readByte(); - byte[] keyBytes = new byte[keySize]; - in.readFully(keyBytes); - - int valSize = in.readInt(); - - byte valType = 0; - byte[] valBytes = null; - - if (valSize >= 0) { - valType = in.readByte(); - valBytes = new byte[valSize]; - in.readFully(valBytes); - } - - byte ord = in.readByte(); - - GridCacheOperation op = GridCacheOperation.fromOrdinal(ord & 0xFF); - - GridCacheVersion nearXidVer = readVersion(in, true); - GridCacheVersion writeVer = readVersion(in, false); - - int partId = in.readInt(); - long partCntr = in.readLong(); - long expireTime = in.readLong(); - - MvccVersion mvccVer = txRecordSerializer.readMvccVersion(in); - - GridCacheContext cacheCtx = cctx.cacheContext(cacheId); - - if (cacheCtx != null) { - CacheObjectContext coCtx = cacheCtx.cacheObjectContext(); - - KeyCacheObject key = co.toKeyCacheObject(coCtx, keyType, keyBytes); - - if (key.partition() == -1) - key.partition(partId); - - CacheObject val = valBytes != null ? co.toCacheObject(coCtx, valType, valBytes) : null; - - return new MvccDataEntry( - cacheId, - key, - val, - op, - nearXidVer, - writeVer, - expireTime, - partId, - partCntr, - mvccVer - ); - } - else - return new LazyMvccDataEntry( - cctx, - cacheId, - keyType, - keyBytes, - valType, - valBytes, - op, - nearXidVer, - writeVer, - expireTime, - partId, - partCntr, - mvccVer); - } - - /** {@inheritDoc} */ - @Override protected int entrySize(DataEntry entry) throws IgniteCheckedException { - return super.entrySize(entry) + - /*mvcc version*/ ((entry instanceof MvccDataEntry) ? (8 + 8 + 4) : 0); - } - /** * @param buf Buffer to read from. * @return Read map. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/TxRecordSerializer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/TxRecordSerializer.java index 3a326cdfd60..0bee5449f5f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/TxRecordSerializer.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/TxRecordSerializer.java @@ -22,11 +22,7 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collection; import java.util.Map; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.internal.pagemem.wal.record.MvccTxRecord; import org.apache.ignite.internal.pagemem.wal.record.TxRecord; -import org.apache.ignite.internal.processors.cache.mvcc.MvccVersion; -import org.apache.ignite.internal.processors.cache.mvcc.MvccVersionImpl; import org.apache.ignite.internal.processors.cache.persistence.tree.io.CacheVersionIO; import org.apache.ignite.internal.processors.cache.persistence.wal.ByteBufferBackedDataInput; import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; @@ -37,38 +33,6 @@ import org.apache.ignite.transactions.TransactionState; * {@link TxRecord} WAL serializer. */ public class TxRecordSerializer { - /** Mvcc version record size. */ - static final int MVCC_VERSION_SIZE = 8 + 8 + 4; - - /** - * Reads {@link MvccVersion} from given input. - * - * @param in Data input to read from. - * @return Mvcc version. - */ - public MvccVersion readMvccVersion(ByteBufferBackedDataInput in) throws IOException { - in.ensure(MVCC_VERSION_SIZE); - - long coordVer = in.readLong(); - long cntr = in.readLong(); - int opCntr = in.readInt(); - - return new MvccVersionImpl(coordVer, cntr, opCntr); - } - - /** - * Writes {@link MvccVersion} to given buffer. - * - * @param buf Buffer to write. - * @param mvccVer Mvcc version. - */ - public void putMvccVersion(ByteBuffer buf, MvccVersion mvccVer) { - buf.putLong(mvccVer.coordinatorVersion()); - buf.putLong(mvccVer.counter()); - - buf.putInt(mvccVer.operationCounter()); - } - /** * Writes {@link TxRecord} to given buffer. * @@ -172,91 +136,4 @@ public class TxRecordSerializer { return size; } - - /** - * Reads {@link MvccTxRecord} from given input. - * - * @param in Input - * @return MvccTxRecord. - * @throws IOException In case of fail. - */ - public MvccTxRecord readMvccTx(ByteBufferBackedDataInput in) throws IOException { - byte txState = in.readByte(); - TransactionState state = TransactionState.fromOrdinal(txState); - - GridCacheVersion nearXidVer = RecordV1Serializer.readVersion(in, true); - GridCacheVersion writeVer = RecordV1Serializer.readVersion(in, true); - MvccVersion mvccVer = readMvccVersion(in); - - int participatingNodesSize = in.readInt(); - - Map<Short, Collection<Short>> participatingNodes = U.newHashMap(participatingNodesSize); - - for (int i = 0; i < participatingNodesSize; i++) { - short primaryNode = in.readShort(); - - int backupNodesSize = in.readInt(); - - Collection<Short> backupNodes = new ArrayList<>(backupNodesSize); - - for (int j = 0; j < backupNodesSize; j++) { - short backupNode = in.readShort(); - - backupNodes.add(backupNode); - } - - participatingNodes.put(primaryNode, backupNodes); - } - - long ts = in.readLong(); - - return new MvccTxRecord(state, nearXidVer, writeVer, participatingNodes, mvccVer, ts); - } - - /** - * Writes {@link MvccTxRecord} to given buffer. - * - * @param rec MvccTxRecord. - * @param buf Byte buffer. - * @throws IgniteCheckedException In case of fail. - */ - public void write(MvccTxRecord rec, ByteBuffer buf) throws IgniteCheckedException { - buf.put((byte)rec.state().ordinal()); - - RecordV1Serializer.putVersion(buf, rec.nearXidVersion(), true); - RecordV1Serializer.putVersion(buf, rec.writeVersion(), true); - putMvccVersion(buf, rec.mvccVersion()); - - Map<Short, Collection<Short>> participatingNodes = rec.participatingNodes(); - - if (participatingNodes != null && !participatingNodes.isEmpty()) { - buf.putInt(participatingNodes.size()); - - for (Map.Entry<Short, Collection<Short>> e : participatingNodes.entrySet()) { - buf.putShort(e.getKey()); - - Collection<Short> backupNodes = e.getValue(); - - buf.putInt(backupNodes.size()); - - for (short backupNode : backupNodes) - buf.putShort(backupNode); - } - } - else - buf.putInt(0); // Put zero size of participating nodes. - - buf.putLong(rec.timestamp()); - } - - /** - * Returns size of marshalled {@link TxRecord} in bytes. - * - * @param rec TxRecord. - * @return Size of TxRecord in bytes. - * @throws IgniteCheckedException In case of fail. - */ - public int size(MvccTxRecord rec) throws IgniteCheckedException { - return size((TxRecord)rec) + MVCC_VERSION_SIZE; - } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java index f9ebfe46c16..70ab8acf91e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java @@ -95,7 +95,6 @@ import static org.apache.ignite.cluster.ClusterState.ACTIVE; import static org.apache.ignite.events.EventType.EVT_WAL_SEGMENT_ARCHIVED; import static org.apache.ignite.events.EventType.EVT_WAL_SEGMENT_COMPACTED; import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType.DATA_RECORD_V2; -import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType.MVCC_DATA_RECORD; import static org.apache.ignite.internal.processors.cache.GridCacheOperation.CREATE; import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE; import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR; @@ -279,7 +278,7 @@ public class IgniteWalReaderTest extends GridCommonAbstractTest { WALRecord walRecord = tup.get2(); - if (walRecord.type() == DATA_RECORD_V2 || walRecord.type() == MVCC_DATA_RECORD) { + if (walRecord.type() == DATA_RECORD_V2) { DataRecord record = (DataRecord)walRecord; for (int i = 0; i < record.entryCount(); i++) { @@ -1637,9 +1636,7 @@ public class IgniteWalReaderTest extends GridCommonAbstractTest { //noinspection EnumSwitchStatementWhichMissesCases switch (type) { - case DATA_RECORD_V2: - // Fallthrough. - case MVCC_DATA_RECORD: { + case DATA_RECORD_V2: { assert walRecord instanceof DataRecord; DataRecord dataRecord = (DataRecord)walRecord; @@ -1698,9 +1695,7 @@ public class IgniteWalReaderTest extends GridCommonAbstractTest { break; - case TX_RECORD: - // Fallthrough - case MVCC_TX_RECORD: { + case TX_RECORD: { assert walRecord instanceof TxRecord; TxRecord txRecord = (TxRecord)walRecord; 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 92d2a2a41a3..ac6846b19a3 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 @@ -35,8 +35,6 @@ import org.apache.ignite.internal.pagemem.wal.record.IndexRenameRootPageRecord; import org.apache.ignite.internal.pagemem.wal.record.MasterKeyChangeRecordV2; import org.apache.ignite.internal.pagemem.wal.record.MemoryRecoveryRecord; import org.apache.ignite.internal.pagemem.wal.record.MetastoreDataRecord; -import org.apache.ignite.internal.pagemem.wal.record.MvccDataRecord; -import org.apache.ignite.internal.pagemem.wal.record.MvccTxRecord; import org.apache.ignite.internal.pagemem.wal.record.PageSnapshot; import org.apache.ignite.internal.pagemem.wal.record.PartitionClearingStartRecord; import org.apache.ignite.internal.pagemem.wal.record.ReencryptionStartRecord; @@ -48,9 +46,6 @@ import org.apache.ignite.internal.pagemem.wal.record.WALRecord; import org.apache.ignite.internal.pagemem.wal.record.delta.ClusterSnapshotRecord; import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageInsertFragmentRecord; import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageInsertRecord; -import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageMvccMarkUpdatedRecord; -import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageMvccUpdateNewTxStateHintRecord; -import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageMvccUpdateTxStateHintRecord; import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageRemoveRecord; import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageSetFreeListPageRecord; import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageUpdateRecord; @@ -89,7 +84,6 @@ import org.apache.ignite.internal.pagemem.wal.record.delta.SplitExistingPageReco import org.apache.ignite.internal.pagemem.wal.record.delta.TrackingPageDeltaRecord; import org.apache.ignite.internal.pagemem.wal.record.delta.TrackingPageRepairDeltaRecord; import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState; -import org.apache.ignite.internal.processors.cache.mvcc.MvccVersionImpl; import org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer; import org.apache.ignite.internal.processors.cache.tree.DataInnerIO; import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; @@ -254,16 +248,11 @@ public class RecordUtils { 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, 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, 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)); @@ -276,6 +265,14 @@ public class RecordUtils { put(CDC_MANAGER_RECORD, RecordUtils::buildCdcManagerStopRecord); put(CDC_MANAGER_STOP_RECORD, RecordUtils::buildCdcManagerStopRecord); put(DATA_PAGE_FRAGMENTED_UPDATE_RECORD, buildUpsupportedWalRecord(DATA_PAGE_FRAGMENTED_UPDATE_RECORD)); + + put(MVCC_DATA_RECORD, buildUpsupportedWalRecord(MVCC_DATA_RECORD)); + put(MVCC_TX_RECORD, buildUpsupportedWalRecord(MVCC_TX_RECORD)); + put(MVCC_DATA_PAGE_MARK_UPDATED_RECORD, buildUpsupportedWalRecord(MVCC_DATA_PAGE_MARK_UPDATED_RECORD)); + put(MVCC_DATA_PAGE_TX_STATE_HINT_UPDATED_RECORD, + buildUpsupportedWalRecord(MVCC_DATA_PAGE_TX_STATE_HINT_UPDATED_RECORD)); + put(MVCC_DATA_PAGE_NEW_TX_STATE_HINT_UPDATED_RECORD, + buildUpsupportedWalRecord(MVCC_DATA_PAGE_NEW_TX_STATE_HINT_UPDATED_RECORD)); } /** */ @@ -573,37 +570,6 @@ public class RecordUtils { return new RotatedIdPartRecord(1, 1, 2); } - /** **/ - public static DataPageMvccMarkUpdatedRecord buildDataPageMvccMarkUpdatedRecord() { - return new DataPageMvccMarkUpdatedRecord(1, 1, 2, 1, 1, 1); - } - - /** **/ - public static DataPageMvccUpdateTxStateHintRecord buildDataPageMvccUpdateTxStateHintRecord() { - return new DataPageMvccUpdateTxStateHintRecord(1, 1, 2, (byte)1); - } - - /** **/ - public static DataPageMvccUpdateNewTxStateHintRecord buildDataPageMvccUpdateNewTxStateHintRecord() { - return new DataPageMvccUpdateNewTxStateHintRecord(1, 1, 2, (byte)1); - } - - /** **/ - public static MvccDataRecord buildMvccDataRecord() { - return new MvccDataRecord(Collections.emptyList(), 1); - } - - /** **/ - public static MvccTxRecord buildMvccTxRecord() { - return new MvccTxRecord( - TransactionState.PREPARED, - new GridCacheVersion(), - new GridCacheVersion(), - new HashMap<>(), - new MvccVersionImpl() - ); - } - /** * Return {@code true} if include to write-ahead log. * diff --git a/modules/dev-utils/src/main/java/org/apache/ignite/development/utils/WalStat.java b/modules/dev-utils/src/main/java/org/apache/ignite/development/utils/WalStat.java index 93f0d1b145f..d4e77d81fc7 100644 --- a/modules/dev-utils/src/main/java/org/apache/ignite/development/utils/WalStat.java +++ b/modules/dev-utils/src/main/java/org/apache/ignite/development/utils/WalStat.java @@ -128,10 +128,9 @@ public class WalStat { if (type == WALRecord.RecordType.PAGE_RECORD) registerPageSnapshot((PageSnapshot)record); else if (type == WALRecord.RecordType.DATA_RECORD - || type == WALRecord.RecordType.DATA_RECORD_V2 - || type == WALRecord.RecordType.MVCC_DATA_RECORD) + || type == WALRecord.RecordType.DATA_RECORD_V2) registerDataRecord((DataRecord)record); - else if (type == WALRecord.RecordType.TX_RECORD || type == WALRecord.RecordType.MVCC_TX_RECORD) + else if (type == WALRecord.RecordType.TX_RECORD) registerTxRecord((TxRecord)record); incrementStat(type.toString(), record, recTypeSizes);