Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ public void testCacheIdleVerifyDump() throws Exception {

assertContains(log, dumpWithZeros, "The check procedure has finished, found " + parts + " partitions");
assertContains(log, dumpWithZeros, "Partition: PartitionKey [grpId=1544803905, grpName=default, partId=0]");
assertContains(log, dumpWithZeros, "updateCntr=0, partitionState=OWNING, size=0, partHash=0");
assertContains(log, dumpWithZeros, "updateCntr=0, partitionState=OWNING, metaSize=0, realSize=0, partHash=0");
assertContains(log, dumpWithZeros, "no conflicts have been found");
assertCompactFooterStat(dumpWithZeros, 0, 0, 0, keysCnt);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private boolean needToAdd(List<PartitionHashRecord> records) {

PartitionHashRecord record = records.get(0);

if (record.size() != 0)
if (record.realSize() != 0)
return true;

int firstHash = record.partitionHash();
Expand All @@ -155,7 +155,7 @@ record = records.get(i);

if (record.partitionHash() != firstHash
|| record.partitionVersionsHash() != firstVerHash
|| record.size() != 0
|| record.realSize() != 0
)
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ else if (txRec.state() == TransactionState.ROLLED_BACK) {
sft.consistentId(),
null,
0,
0,
null,
new VerifyPartitionContext(e.getValue())
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ public SnapshotPartitionsQuickVerifyHandler(GridCacheSharedContext<?, ?> cctx) {
PartitionHashRecord other = total.putIfAbsent(part, val);

if ((other != null && !wrnGrps.contains(part.groupId()))
&& ((!val.hasExpiringEntries() && !other.hasExpiringEntries() && val.size() != other.size())
&& ((!val.hasExpiringEntries() && !other.hasExpiringEntries()
&& (val.metaSize() != other.metaSize() || val.realSize() != other.realSize()))
|| !Objects.equals(val.updateCounter(), other.updateCounter())))
wrnGrps.add(part.groupId());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,31 +403,36 @@ private PartitionHashRecord calculateDumpedPartitionHash(Dump dump, String folde
cctx.localNode().consistentId(),
null,
0,
0,
PartitionHashRecord.PartitionState.OWNING,
new VerifyPartitionContext()
);
}

try {
try (Dump.DumpedPartitionIterator iter = dump.iterator(folderName, CU.cacheId(grpName), part, null)) {
long size = 0;
long totalSize = 0;
long realSize = 0;

VerifyPartitionContext ctx = new VerifyPartitionContext();

while (iter.hasNext()) {
DumpEntry e = iter.next();
totalSize++;

ctx.update((KeyCacheObject)e.key(), (CacheObject)e.value(), e.version());

size++;
if (e.expireTime() <= 0) {
ctx.update((KeyCacheObject)e.key(), (CacheObject)e.value(), e.version());
realSize++;
}
}

return new PartitionHashRecord(
new PartitionKey(CU.cacheId(grpName), part, grpName),
false,
cctx.localNode().consistentId(),
null,
size,
totalSize,
realSize,
PartitionHashRecord.PartitionState.OWNING,
ctx
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ public static List<Integer> compareUpdateCounters(
updCntr,
state == GridDhtPartitionState.MOVING ?
PartitionHashRecord.MOVING_PARTITION_SIZE : 0,
0,
state == GridDhtPartitionState.MOVING ?
PartitionHashRecord.PartitionState.MOVING : PartitionHashRecord.PartitionState.LOST,
new VerifyPartitionContext()
Expand Down Expand Up @@ -327,6 +328,7 @@ public static List<Integer> compareUpdateCounters(
consId,
updCntr,
partSize,
ctx.entryCount,
PartitionHashRecord.PartitionState.OWNING,
ctx
);
Expand Down Expand Up @@ -391,6 +393,9 @@ public static class VerifyPartitionContext {
/** */
public int regular;

/** */
public int entryCount;

/** */
public VerifyPartitionContext() {
// No-op.
Expand All @@ -410,6 +415,8 @@ public void update(
CacheObject val,
CacheEntryVersion ver
) throws IgniteCheckedException {
entryCount++;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like entryCount = regular + binary.


partHash += key.hashCode();

if (ver != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@ public class PartitionHashRecord extends IgniteDataTransferObject {
@GridToStringInclude
private Object updateCntr;

/** Size. */
/** Size from partition metadata. */
@GridToStringExclude
private long size;
private long metaSize;

/** Actual number of entries in partition. */
@GridToStringExclude
private long realSize;

/** Partition state. */
private PartitionState partitionState;
Expand Down Expand Up @@ -105,7 +109,8 @@ public class PartitionHashRecord extends IgniteDataTransferObject {
* @param isPrimary Is primary.
* @param consistentId Consistent id.
* @param updateCntr Update counter.
* @param size Size.
* @param metaSize Size from partition metadata.
* @param realSize Actual number of entries in partition.
* @param partitionState Partition state.
* @param ctx Verify partition data.
*/
Expand All @@ -114,7 +119,8 @@ public PartitionHashRecord(
boolean isPrimary,
Object consistentId,
Object updateCntr,
long size,
long metaSize,
long realSize,
PartitionState partitionState,
VerifyPartitionContext ctx
) {
Expand All @@ -124,7 +130,8 @@ public PartitionHashRecord(
this.partHash = ctx.partHash;
this.partVerHash = ctx.partVerHash;
this.updateCntr = updateCntr;
this.size = size;
this.metaSize = metaSize;
this.realSize = realSize;
this.partitionState = partitionState;
this.cfKeys = ctx.cf;
this.noCfKeys = ctx.noCf;
Expand Down Expand Up @@ -181,10 +188,17 @@ public Object updateCounter() {
}

/**
* @return Size.
* @return Size from metadata.
*/
public long metaSize() {
return metaSize;
}

/**
* @return Actual number of entries in partition.
*/
public long size() {
return size;
public long realSize() {
return realSize;
}

/**
Expand Down Expand Up @@ -232,7 +246,8 @@ public void hasExpiringEntries(boolean hasExpiringEntries) {
out.writeInt(partHash);
out.writeInt(partVerHash);
out.writeObject(updateCntr);
out.writeLong(size);
out.writeLong(metaSize);
out.writeLong(realSize);
U.writeEnum(out, partitionState);
out.writeInt(cfKeys);
out.writeInt(noCfKeys);
Expand All @@ -249,7 +264,8 @@ public void hasExpiringEntries(boolean hasExpiringEntries) {
partHash = in.readInt();
partVerHash = in.readInt();
updateCntr = in.readObject();
size = in.readLong();
metaSize = in.readLong();
realSize = in.readLong();
partitionState = PartitionState.fromOrdinal(in.readByte());
cfKeys = in.readInt();
noCfKeys = in.readInt();
Expand All @@ -260,9 +276,13 @@ public void hasExpiringEntries(boolean hasExpiringEntries) {

/** {@inheritDoc} */
@Override public String toString() {
return size == MOVING_PARTITION_SIZE ?
return metaSize == MOVING_PARTITION_SIZE ?
S.toString(PartitionHashRecord.class, this, "state", "MOVING") :
S.toString(PartitionHashRecord.class, this, "size", size, "partHash", partHash, "partVerHash", partVerHash);
S.toString(PartitionHashRecord.class, this,
"metaSize", metaSize,
"realSize", realSize,
"partHash", partHash,
"partVerHash", partVerHash);
}

/** {@inheritDoc} */
Expand All @@ -276,15 +296,16 @@ public void hasExpiringEntries(boolean hasExpiringEntries) {
PartitionHashRecord v2 = (PartitionHashRecord)o;

return partHash == v2.partHash && partVerHash == v2.partVerHash && Objects.equals(updateCntr, v2.updateCntr) &&
size == v2.size && partKey.equals(v2.partKey) && consistentId.equals(v2.consistentId) &&
metaSize == v2.metaSize && realSize == v2.realSize &&
partKey.equals(v2.partKey) && consistentId.equals(v2.consistentId) &&
partitionState == v2.partitionState &&
cfKeys == v2.cfKeys && noCfKeys == v2.noCfKeys &&
binKeys == v2.binKeys && regKeys == v2.regKeys;
}

/** {@inheritDoc} */
@Override public int hashCode() {
return Objects.hash(partKey, consistentId, partHash, partVerHash, updateCntr, size, partitionState,
return Objects.hash(partKey, consistentId, partHash, partVerHash, updateCntr, metaSize, realSize, partitionState,
cfKeys, noCfKeys, binKeys, regKeys);
}

Expand Down