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

Kirill Gusakov updated IGNITE-24138:
------------------------------------
    Description: 
[DistributionZoneManager.onUpdatePartitionDistributionResetBusy|https://github.com/apache/ignite-3/blob/2a8d29f860aa1122130f037319a6bf5fee3d63ca/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java#L416]
 has the issue with the following assertion:
{code:java}
Optional<Long> highestRevision = zoneState.highestRevision(true);

assert highestRevision.isEmpty() || causalityToken >= highestRevision.get() : 
IgniteStringFormatter.format(
        "Expected causalityToken that is greater or equal to already seen meta 
storage events: highestRevision={}, "
                + "causalityToken={}",
        highestRevision.orElse(null), causalityToken
);
{code}
The tricky part is {{zoneState.highestRevision(true)}} - actually we can't use 
the addition=true|false semantic here for this method, because it is a reset 
timer configuration update. Instead we should introduce and use here the 
general version:

{code:java}
Optional<Long> highestRevision() {
    return topologyAugmentationMap().entrySet()
            .stream()
            .max(Map.Entry.comparingByKey())
            .map(Map.Entry::getKey);
}
{code}


  was:
[DistributionZoneManager.onUpdatePartitionDistributionResetBusy|https://github.com/apache/ignite-3/blob/2a8d29f860aa1122130f037319a6bf5fee3d63ca/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java#L416]
 has the issue with the following assertion:
{code:java}
                Optional<Long> highestRevision = 
zoneState.highestRevision(true);

                assert highestRevision.isEmpty() || causalityToken >= 
highestRevision.get() : IgniteStringFormatter.format(
                        "Expected causalityToken that is greater or equal to 
already seen meta storage events: highestRevision={}, "
                                + "causalityToken={}",
                        highestRevision.orElse(null), causalityToken
                );
{code}
The tricky part is {{zoneState.highestRevision(true)}} - actually we can't use 
the addition=true|false semantic here for this method, because it is a reset 
timer configuration update. Instead we should introduce and use here the 
general version:

{code:java}
        Optional<Long> highestRevision() {
            return topologyAugmentationMap().entrySet()
                    .stream()
                    .max(Map.Entry.comparingByKey())
                    .map(Map.Entry::getKey);
        }
{code}



> DistributionZoneManager.onUpdatePartitionDistributionResetBusy has the wrong 
> highestRevision usage
> --------------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-24138
>                 URL: https://issues.apache.org/jira/browse/IGNITE-24138
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Kirill Gusakov
>            Priority: Major
>              Labels: ignite-3
>
> [DistributionZoneManager.onUpdatePartitionDistributionResetBusy|https://github.com/apache/ignite-3/blob/2a8d29f860aa1122130f037319a6bf5fee3d63ca/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java#L416]
>  has the issue with the following assertion:
> {code:java}
> Optional<Long> highestRevision = zoneState.highestRevision(true);
> assert highestRevision.isEmpty() || causalityToken >= highestRevision.get() : 
> IgniteStringFormatter.format(
>         "Expected causalityToken that is greater or equal to already seen 
> meta storage events: highestRevision={}, "
>                 + "causalityToken={}",
>         highestRevision.orElse(null), causalityToken
> );
> {code}
> The tricky part is {{zoneState.highestRevision(true)}} - actually we can't 
> use the addition=true|false semantic here for this method, because it is a 
> reset timer configuration update. Instead we should introduce and use here 
> the general version:
> {code:java}
> Optional<Long> highestRevision() {
>     return topologyAugmentationMap().entrySet()
>             .stream()
>             .max(Map.Entry.comparingByKey())
>             .map(Map.Entry::getKey);
> }
> {code}



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

Reply via email to