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

Evgeny Stanilovsky updated IGNITE-25600:
----------------------------------------
    Description: 
FragmentMappingTest is always executed with mapOnBackup = true, need to also 
have a possibilty to run it with mapOnBackup = false.
Now test execution is goes through:
MappingTestRunner#produceMapping with: 

{code:java}
mappedFragments = await(mappingService.map(plan, MappingParameters.EMPTY));
{code}

and we can see that MappingParameters.EMPTY -> mapOnBackups == false but it not 
considered in further assignments calculations, check:

{code:java}
ExecutionDistributionProviderBuilder#build
{code}

and thus all possible through assignments nodes are goes into further 
consideration.

Code need to be changed on smth like :

{noformat}
        public ExecutionDistributionProvider build() {
            Map<String, List<List<String>>> owningNodesByTableName = 
Map.copyOf(this.owningNodesByTableName);

            Function<String, AssignmentsProvider> sourceProviderFunction = 
tableName ->
                    (AssignmentsProvider) (partitionsCount, includeBackups) -> {
                        List<List<String>> assignments = 
owningNodesByTableName.get(tableName);

                        if (nullOrEmpty(assignments)) {
                            throw new AssertionError("Assignments are not 
configured for table " + tableName);
                        }

                        if (includeBackups) {
                            return assignments;
                        } else {
                            List<List<String>> primaryAssignments = new 
ArrayList<>();

                            for (List<String> assign : assignments) {
                                primaryAssignments.add(List.of(assign.get(0)));
                            }

                            return primaryAssignments;
                        }
                    };

            return new TestExecutionDistributionProvider(
                    owningNodesBySystemViewName,
                    sourceProviderFunction,
                    useTablePartitions
            );
        }
{noformat}


  was:
FragmentMappingTest is always executed with mapOnBackup = true, need to also 
have a possibilty to run it with mapOnBackup = false.
Now test execution is goes through:
MappingTestRunner#produceMapping with: 

{code:java}
mappedFragments = await(mappingService.map(plan, MappingParameters.EMPTY));
{code}

and we can see that MappingParameters.EMPTY -> mapOnBackups == false but it not 
considered in further assignments calculations, check:

{code:java}
ExecutionDistributionProviderBuilder#build
{code}

and thus all possible through assignments nodes are goes into further 
consideration.



> Sql. FragmentMappingTest need to have a possibility to test cases with 
> mapOnBackup=false
> ----------------------------------------------------------------------------------------
>
>                 Key: IGNITE-25600
>                 URL: https://issues.apache.org/jira/browse/IGNITE-25600
>             Project: Ignite
>          Issue Type: Test
>          Components: sql ai3
>            Reporter: Evgeny Stanilovsky
>            Priority: Major
>              Labels: ignite-3
>
> FragmentMappingTest is always executed with mapOnBackup = true, need to also 
> have a possibilty to run it with mapOnBackup = false.
> Now test execution is goes through:
> MappingTestRunner#produceMapping with: 
> {code:java}
> mappedFragments = await(mappingService.map(plan, MappingParameters.EMPTY));
> {code}
> and we can see that MappingParameters.EMPTY -> mapOnBackups == false but it 
> not considered in further assignments calculations, check:
> {code:java}
> ExecutionDistributionProviderBuilder#build
> {code}
> and thus all possible through assignments nodes are goes into further 
> consideration.
> Code need to be changed on smth like :
> {noformat}
>         public ExecutionDistributionProvider build() {
>             Map<String, List<List<String>>> owningNodesByTableName = 
> Map.copyOf(this.owningNodesByTableName);
>             Function<String, AssignmentsProvider> sourceProviderFunction = 
> tableName ->
>                     (AssignmentsProvider) (partitionsCount, includeBackups) 
> -> {
>                         List<List<String>> assignments = 
> owningNodesByTableName.get(tableName);
>                         if (nullOrEmpty(assignments)) {
>                             throw new AssertionError("Assignments are not 
> configured for table " + tableName);
>                         }
>                         if (includeBackups) {
>                             return assignments;
>                         } else {
>                             List<List<String>> primaryAssignments = new 
> ArrayList<>();
>                             for (List<String> assign : assignments) {
>                                 
> primaryAssignments.add(List.of(assign.get(0)));
>                             }
>                             return primaryAssignments;
>                         }
>                     };
>             return new TestExecutionDistributionProvider(
>                     owningNodesBySystemViewName,
>                     sourceProviderFunction,
>                     useTablePartitions
>             );
>         }
> {noformat}



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

Reply via email to