Vyacheslav Koptilin created IGNITE-17883:
--------------------------------------------

             Summary: Remove the invoke method from KeyValurView and RecordView 
interfaces
                 Key: IGNITE-17883
                 URL: https://issues.apache.org/jira/browse/IGNITE-17883
             Project: Ignite
          Issue Type: Bug
    Affects Versions: 3.0.0-alpha6
            Reporter: Vyacheslav Koptilin


_KeyValueView_ and _RecordView_ provide the following methods:
{code:java}
/**
 * Executes invoke processor code against the value associated with the 
provided key.
 *
 * @param tx The transaction or {@code null} to auto commit.
 * @param key A key associated with the value that invoke processor will be 
applied to. The key cannot be {@code null}.
 * @param proc An invocation processor.
 * @param args Optional invoke processor arguments.
 * @param <R> Invoke processor result type.
 * @return Result of the processing.
 * @see InvokeProcessor
 */
<R extends Serializable> R invoke(@Nullable Transaction tx, @NotNull K key, 
InvokeProcessor<K, V, R> proc, Serializable... args);

/**
 * Asynchronously executes invoke processor code against the value associated 
with the provided key.
 *
 * @param tx The transaction or {@code null} to auto commit.
 * @param key A key associated with the value that invoke processor will be 
applied to. The key cannot be {@code null}.
 * @param proc An invocation processor.
 * @param args Optional invoke processor arguments.
 * @param <R> Invoke processor result type.
 * @return Future representing pending completion of the operation.
 * @see InvokeProcessor
 */
@NotNull <R extends Serializable> CompletableFuture<R> invokeAsync(
        @Nullable Transaction tx,
        @NotNull K key,
        InvokeProcessor<K, V, R> proc,
        Serializable... args);

/**
 * Executes invoke processor code against values associated with the provided 
keys.
 *
 * @param tx The transaction or {@code null} to auto commit.
 * @param <R> Invoke processor result type.
 * @param keys Ordered collection of keys which values associated with should 
be processed. The keys cannot be {@code null}.
 * @param proc An invocation processor.
 * @param args Optional invoke processor arguments.
 * @return Results of the processing.
 * @see InvokeProcessor
 */
<R extends Serializable> Map<K, R> invokeAll(
        @Nullable Transaction tx,
        @NotNull Collection<K> keys,
        InvokeProcessor<K, V, R> proc,
        Serializable... args);

/**
 * Asynchronously executes invoke processor code against values associated with 
the provided keys.
 *
 * @param tx The transaction or {@code null} to auto commit.
 * @param <R> Invoke processor result type.
 * @param keys Ordered collection of keys which values associated with should 
be processed. The keys cannot be {@code null}.
 * @param proc An invocation processor.
 * @param args Optional invoke processor arguments.
 * @return Future representing pending completion of the operation.
 * @see InvokeProcessor
 */
@NotNull <R extends Serializable> CompletableFuture<Map<K, R>> invokeAllAsync(
        @Nullable Transaction tx,
        @NotNull Collection<K> keys,
        InvokeProcessor<K, V, R> proc,
        Serializable... args);
 {code}
The main problem with these methods assume that the user defined closure - 
_InvokeProcessor_ must be idempotent. This is a consequence of the limitations 
of the replication protocol. However, the implementation does not have the 
right way to check this requirement. For example, a simple closure that 
increments a value for a key could lead to data inconsistency under some 
circumstances.

For now, _IgniteCompute.executeColocated_ can be used in order to handle these 
needs.



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

Reply via email to