[ 
https://issues.apache.org/jira/browse/IGNITE-23584?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vladimir Steshin updated IGNITE-23584:
--------------------------------------
    Description: 
_SnapshotPartitionsQuickVerifyHandler_ continues checking partitions even if 
detects the `no-need-to-work` condition and then skips the collected results. 
We should not do any checks is the streamer warning is detected. 

{code:java}
for (SnapshotHandlerResult<Map<PartitionKeyV2, PartitionHashRecordV2>> result : 
results) {
            if (result.error() != null)
                throw new IgniteCheckedException(result.error());

            if (result.data() == null) {
                noData = true;

                continue;
            }

            Map<PartitionKeyV2, PartitionHashRecordV2> partsData = 
result.data();

            partsData.forEach((part, val) -> {
                PartitionHashRecordV2 other = total.putIfAbsent(part, val);

                if ((other != null && !wrnGrps.contains(part.groupId()))
                    && ((!val.hasExpiringEntries() && 
!other.hasExpiringEntries() && val.size() != other.size())
                        || !Objects.equals(val.updateCounter(), 
other.updateCounter())))
                    wrnGrps.add(part.groupId());
            });
        }

        if (noData)
            return;

        if (!wrnGrps.isEmpty()) {
            throw new SnapshotWarningException("Cache partitions differ for 
cache groups " +
                S.toStringSortedDistinct(wrnGrps) + ". " + WRN_MSG);
        }
{code}

Suggestion:
{code:java}
 if (result.data() == null)
     return;
{code}


  was:
_SnapshotPartitionsQuickVerifyHandler_ is a bit wierd. It continues checking 
partitions even if detects the `no-need-to-work` condition. And then skips the 
collected results. We should not do any checks is the streamer warning is 
detected. 

{code:java}
for (SnapshotHandlerResult<Map<PartitionKeyV2, PartitionHashRecordV2>> result : 
results) {
            if (result.error() != null)
                throw new IgniteCheckedException(result.error());

            if (result.data() == null) {
                noData = true;

                continue;
            }

            Map<PartitionKeyV2, PartitionHashRecordV2> partsData = 
result.data();

            partsData.forEach((part, val) -> {
                PartitionHashRecordV2 other = total.putIfAbsent(part, val);

                if ((other != null && !wrnGrps.contains(part.groupId()))
                    && ((!val.hasExpiringEntries() && 
!other.hasExpiringEntries() && val.size() != other.size())
                        || !Objects.equals(val.updateCounter(), 
other.updateCounter())))
                    wrnGrps.add(part.groupId());
            });
        }

        if (noData)
            return;

        if (!wrnGrps.isEmpty()) {
            throw new SnapshotWarningException("Cache partitions differ for 
cache groups " +
                S.toStringSortedDistinct(wrnGrps) + ". " + WRN_MSG);
        }
{code}

Suggestion:
{code:java}
 if (result.data() == null)
     return;
{code}



> Snapshot. Fix logic of the quick snapshot handler.
> --------------------------------------------------
>
>                 Key: IGNITE-23584
>                 URL: https://issues.apache.org/jira/browse/IGNITE-23584
>             Project: Ignite
>          Issue Type: Bug
>    Affects Versions: 2.14
>            Reporter: Vladimir Steshin
>            Assignee: Vladimir Steshin
>            Priority: Minor
>
> _SnapshotPartitionsQuickVerifyHandler_ continues checking partitions even if 
> detects the `no-need-to-work` condition and then skips the collected results. 
> We should not do any checks is the streamer warning is detected. 
> {code:java}
> for (SnapshotHandlerResult<Map<PartitionKeyV2, PartitionHashRecordV2>> result 
> : results) {
>             if (result.error() != null)
>                 throw new IgniteCheckedException(result.error());
>             if (result.data() == null) {
>                 noData = true;
>                 continue;
>             }
>             Map<PartitionKeyV2, PartitionHashRecordV2> partsData = 
> result.data();
>             partsData.forEach((part, val) -> {
>                 PartitionHashRecordV2 other = total.putIfAbsent(part, val);
>                 if ((other != null && !wrnGrps.contains(part.groupId()))
>                     && ((!val.hasExpiringEntries() && 
> !other.hasExpiringEntries() && val.size() != other.size())
>                         || !Objects.equals(val.updateCounter(), 
> other.updateCounter())))
>                     wrnGrps.add(part.groupId());
>             });
>         }
>         if (noData)
>             return;
>         if (!wrnGrps.isEmpty()) {
>             throw new SnapshotWarningException("Cache partitions differ for 
> cache groups " +
>                 S.toStringSortedDistinct(wrnGrps) + ". " + WRN_MSG);
>         }
> {code}
> Suggestion:
> {code:java}
>  if (result.data() == null)
>      return;
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to