Mmuzaf commented on a change in pull request #8767:
URL: https://github.com/apache/ignite/pull/8767#discussion_r584882187



##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/AtomicBitSet.java
##########
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.ignite.internal.processors.cache.persistence.snapshot;
+
+import java.util.concurrent.atomic.AtomicIntegerArray;
+
+/**
+ * Atomic bitset array.
+ */
+class AtomicBitSet {
+    /**
+     * Container of bits.
+     */
+    private final AtomicIntegerArray arr;
+
+    /**
+     * Size of array of bits.
+     */
+    private final int size;
+
+    /**
+     * @param size Size of array.
+     */
+    public AtomicBitSet(int size) {
+        this.size = size;
+
+        arr = new AtomicIntegerArray((size + 31) >>> 5);
+    }
+
+    /**
+     * @return Size of bitset in bits.
+     */
+    public int size() {
+        return size;
+    }
+
+    /**
+     * @param idx Index in bitset array.
+     * @return {@code true} if the bit is set.
+     */
+    public boolean check(long idx) {
+        if (idx >= size)
+            return false;
+
+        int bit = 1 << idx;
+        int bucket = (int)(idx >>> 5);
+
+        int cur = arr.get(bucket);
+
+        return (cur & bit) == bit;
+    }
+
+    /**
+     * @param off Bit position to change.
+     * @return {@code true} if bit has been set,
+     * {@code false} if bit changed by another thread or out of range.
+     */
+    public boolean touch(long off) {

Review comment:
       I've rollbacked the changes related to the AtomicBitSet. BitSet used 
instead.
   
   

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/IdleVerifyUtility.java
##########
@@ -223,6 +228,66 @@ public static String formatUpdateCountersDiff(IgniteEx ig, 
List<Integer> diff) {
         return diff;
     }
 
+    /**
+     * @param updCntr Partition update counter prior check.
+     * @param grpId Group id.
+     * @param partId Partition id.
+     * @param grpName Group name.
+     * @param consId Local node consistent id.
+     * @param state Partition state to check.
+     * @param isPrimary {@code true} if partition is primary.
+     * @param partSize Partition size on disk.
+     * @param it Iterator though partition data rows.
+     * @throws IgniteCheckedException If fails.
+     * @return Map of calculated partition.
+     */
+    public static Map<PartitionKeyV2, PartitionHashRecordV2> 
calculatePartitionHash(
+        long updCntr,
+        int grpId,
+        int partId,
+        String grpName,
+        Object consId,
+        GridDhtPartitionState state,
+        boolean isPrimary,
+        long partSize,
+        GridIterator<CacheDataRow> it
+    ) throws IgniteCheckedException {
+        int partHash = 0;
+
+        PartitionKeyV2 partKey = new PartitionKeyV2(grpId, partId, grpName);
+
+        if (state == GridDhtPartitionState.MOVING || state == 
GridDhtPartitionState.LOST) {
+            PartitionHashRecordV2 movingHashRecord = new PartitionHashRecordV2(
+                partKey,
+                isPrimary,
+                consId,
+                partHash,
+                updCntr,
+                state == GridDhtPartitionState.MOVING ? 
PartitionHashRecordV2.MOVING_PARTITION_SIZE : 0,
+                state == GridDhtPartitionState.MOVING ? 
PartitionHashRecordV2.PartitionState.MOVING : 
PartitionHashRecordV2.PartitionState.LOST
+            );
+
+            return Collections.singletonMap(partKey, movingHashRecord);
+        }
+
+        if (state != GridDhtPartitionState.OWNING)
+            return emptyMap();
+
+        while (it.hasNextX()) {
+            CacheDataRow row = it.nextX();
+
+            partHash += row.key().hashCode();
+
+            // Object context may be null since the value bytes have been read 
directly from page.

Review comment:
       Fixed.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to