test_class.file: modules/core/src/test/java/org/apache/ignite/internal/processors/cache/checker/tasks/CollectPartitionKeysByBatchTaskTest.java
test_class.identifier: CollectPartitionKeysByBatchTaskTest
test_class.superclass: extends CollectPartitionInfoAbstractTest
test_case.body: @Test
      public void testShouldReturnKeysByBatches() throws Exception {
          IgniteEx node = startGrids(3);
  
          node.cluster().active(true);
  
          AffinityTopologyVersion ver = lastTopologyVersion(node);
  
          IgniteCache<Object, Object> cache = node.cache(DEFAULT_CACHE_NAME);
          List<Integer> keys = new ArrayList<>();
  
          int elements = 0;
          for (int i = 0; i < 100_000; i++) {
              if (node.affinity(DEFAULT_CACHE_NAME).partition(i) == FIRST_PARTITION) {
                  cache.put(i, i);
                  keys.add(i);
  
                  elements++;
              }
          }
  
          for (Integer key : keys) {
              corruptDataEntry(
                  node.cachex(DEFAULT_CACHE_NAME).context(),
                  key
              );
          }
  
          Collection<ClusterNode> nodes = node.affinity(DEFAULT_CACHE_NAME)
              .mapPartitionToPrimaryAndBackups(FIRST_PARTITION);
  
          int batchSize = (elements + 1) / 2; // two batch for all rows
  
          Set<KeyCacheObject> fetched = new HashSet<>();
  
          T2<KeyCacheObject, Map<KeyCacheObject, Map<UUID, GridCacheVersion>>> firstBatch = node.compute(group(node, nodes)).execute(
              CollectPartitionKeysByBatchTask.class,
              new PartitionBatchRequest(ReconciliationExecutionContext.IGNORE_JOB_PERMITS_SESSION_ID, UUID.randomUUID(),
                  DEFAULT_CACHE_NAME, FIRST_PARTITION, batchSize, null, ver)
          ).result();
  
          fetched.addAll(firstBatch.get2().keySet());
  
          KeyCacheObject firstMaxKey = firstBatch.get1();
  
          T2<KeyCacheObject, Map<KeyCacheObject, Map<UUID, GridCacheVersion>>> secondBatch = node.compute(group(node, nodes)).execute(
              CollectPartitionKeysByBatchTask.class,
              new PartitionBatchRequest(ReconciliationExecutionContext.IGNORE_JOB_PERMITS_SESSION_ID, UUID.randomUUID(),
                  DEFAULT_CACHE_NAME, FIRST_PARTITION, batchSize, firstMaxKey, ver)
          ).result();
  
          KeyCacheObject secondMaxKey = secondBatch.get1();
  
          fetched.addAll(secondBatch.get2().keySet());
  
          T2<KeyCacheObject, Map<KeyCacheObject, Map<UUID, GridCacheVersion>>> thirdBatch = node.compute(group(node, nodes)).execute(
              CollectPartitionKeysByBatchTask.class,
              new PartitionBatchRequest(ReconciliationExecutionContext.IGNORE_JOB_PERMITS_SESSION_ID, UUID.randomUUID(),
                  DEFAULT_CACHE_NAME, FIRST_PARTITION, batchSize, secondMaxKey, ver)
          ).result();
  
          assertNull(thirdBatch.get1());
          assertEquals(0, thirdBatch.get2().size());
  
          assertEquals(elements, fetched.size());
      }
test_case.class_method_signature: CollectPartitionKeysByBatchTaskTest.testShouldReturnKeysByBatches()
test_case.full_signature: @Test public void testShouldReturnKeysByBatches()
test_case.identifier: testShouldReturnKeysByBatches
test_case.invocations: startGrids active cluster lastTopologyVersion cache partition affinity put add corruptDataEntry context cachex mapPartitionToPrimaryAndBackups affinity result execute compute group randomUUID addAll keySet get2 get1 result execute compute group randomUUID get1 addAll keySet get2 result execute compute group randomUUID assertNull get1 assertEquals size get2 assertEquals size
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testShouldReturnKeysByBatches()
focal_class.declarator: serialVersionUID = 0L
focal_class.modifier: private static final
focal_class.original_string: private static final long serialVersionUID = 0L;
focal_class.type: long
focal_class.var_name: serialVersionUID
focal_class.declarator: KEY_COMPARATOR = new KeyComparator()
focal_class.modifier: private static final
focal_class.original_string: private static final KeyComparator KEY_COMPARATOR = new KeyComparator();
focal_class.type: KeyComparator
focal_class.var_name: KEY_COMPARATOR
focal_class.declarator: log
focal_class.modifier: @LoggerResource
      private
focal_class.original_string: @LoggerResource
      private IgniteLogger log;
focal_class.type: IgniteLogger
focal_class.var_name: log
focal_class.declarator: ignite
focal_class.modifier: @IgniteInstanceResource
      private
focal_class.original_string: @IgniteInstanceResource
      private IgniteEx ignite;
focal_class.type: IgniteEx
focal_class.var_name: ignite
focal_class.declarator: partBatch
focal_class.modifier: private volatile
focal_class.original_string: private volatile PartitionBatchRequest partBatch;
focal_class.type: PartitionBatchRequest
focal_class.var_name: partBatch
focal_class.file: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/checker/tasks/CollectPartitionKeysByBatchTask.java
focal_class.identifier: CollectPartitionKeysByBatchTask
focal_class.class_method_signature: CollectPartitionKeysByBatchTask.map(List<ClusterNode> subgrid,
          PartitionBatchRequest partBatch)
focal_class.full_signature: @NotNull @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
          PartitionBatchRequest partBatch)
focal_class.identifier: map
focal_class.modifiers: @NotNull @Override public
focal_class.parameters: (List<ClusterNode> subgrid,
          PartitionBatchRequest partBatch)
focal_class.return: Map<? extends ComputeJob, ClusterNode>
focal_class.signature: Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
          PartitionBatchRequest partBatch)
focal_class.class_method_signature: CollectPartitionKeysByBatchTask.result(ComputeJobResult res, List<ComputeJobResult> rcvd)
focal_class.full_signature: @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd)
focal_class.identifier: result
focal_class.modifiers: @Override public
focal_class.parameters: (ComputeJobResult res, List<ComputeJobResult> rcvd)
focal_class.return: ComputeJobResultPolicy
focal_class.signature: ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd)
focal_class.class_method_signature: CollectPartitionKeysByBatchTask.reduce(
          List<ComputeJobResult> results)
focal_class.full_signature: @Override public @Nullable ExecutionResult<T2<KeyCacheObject, Map<KeyCacheObject, Map<UUID, GridCacheVersion>>>> reduce(
          List<ComputeJobResult> results)
focal_class.identifier: reduce
focal_class.modifiers: @Override public @Nullable
focal_class.parameters: (
          List<ComputeJobResult> results)
focal_class.return: ExecutionResult<T2<KeyCacheObject, Map<KeyCacheObject, Map<UUID, GridCacheVersion>>>>
focal_class.signature: ExecutionResult<T2<KeyCacheObject, Map<KeyCacheObject, Map<UUID, GridCacheVersion>>>> reduce(
          List<ComputeJobResult> results)
focal_class.class_method_signature: CollectPartitionKeysByBatchTask.hasConflict(Collection<GridCacheVersion> keyVersions)
focal_class.full_signature: private boolean hasConflict(Collection<GridCacheVersion> keyVersions)
focal_class.identifier: hasConflict
focal_class.modifiers: private
focal_class.parameters: (Collection<GridCacheVersion> keyVersions)
focal_class.return: boolean
focal_class.signature: boolean hasConflict(Collection<GridCacheVersion> keyVersions)
focal_class.superclass: extends ComputeTaskAdapter<PartitionBatchRequest, ExecutionResult<T2<KeyCacheObject, Map<KeyCacheObject, Map<UUID, GridCacheVersion>>>>>
focal_method.body: @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) {
          ComputeJobResultPolicy superRes = super.result(res, rcvd);
  
          // Deny failover.
          if (superRes == ComputeJobResultPolicy.FAILOVER) {
              superRes = ComputeJobResultPolicy.WAIT;
  
              log.warning("CollectPartitionEntryHashesJob failed on node " +
                  "[consistentId=" + res.getNode().consistentId() + "]", res.getException());
          }
  
          return superRes;
      }
focal_method.class_method_signature: CollectPartitionKeysByBatchTask.result(ComputeJobResult res, List<ComputeJobResult> rcvd)
focal_method.full_signature: @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd)
focal_method.identifier: result
focal_method.invocations: result warning consistentId getNode getException
focal_method.modifiers: @Override public
focal_method.parameters: (ComputeJobResult res, List<ComputeJobResult> rcvd)
focal_method.return: ComputeJobResultPolicy
focal_method.signature: ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd)